Jump to content

Recommended Posts

Posted

Yes, this can be done by adding your tool as a special tool for harvesting the crop, or what ever you're harvesting.

Have a look at the vanilla file blocktypes/plant/tallgrass.json to see how this is done in vanilla:
 

dropsByType: {
		"tallgrass-eaten-*": [],
		"*": [
			{ type: "item", code: "drygrass", quantity: { avg: 1 }, tool: "knife"  },
			{ type: "item", code: "drygrass", quantity: { avg: 1 }, tool: "scythe"  }
		],
	},

Here, the knife and scythe are both defined as valid tools that can be used for harvesting grass. This is why you don't get any grass drop by just punching the grass, but have to use a tool.

This means you'll need to patch every type of crop that you wish to adjust the drop when using your tool.

 

Note that the tool property, is not the actual key for the item, but a hardcoded list of tool types defined in the API here: EnumTools.cs

So, to get your tool to work, you need to assign it to one of these. Take a look at any of the files in "itemtypes/tool/" to see how it's used.

Posted

@xXx_Ape_xXx

Awesome. Been awhile since I made anything other than content mod. I think I have to overwrite the vanilia game file right with mine? 

 

Here is the block of code for example I think I need to modify:

dropsByType: {
		"*-6": [
			{ type: "item", code: "seeds-carrot", quantity: { avg: 0.99 }  },
			{ type: "item", code: "vegetable-carrot", quantity: { avg: 3, var: 1 }  },
		],
		"*-7": [
			{ type: "item", code: "seeds-carrot", quantity: { avg: 1.2 }  },
			{ type: "item", code: "vegetable-carrot", quantity: { avg: 11, var: 2 }  },
		],
  		"*-8": [
			{ type: "item", code: "seeds-carrot", quantity: { avg: 3 }, tool: "Tool Goes Here"  },
			{ type: "item", code: "vegetable-carrot", quantity: { avg: 15, var: 4 }, tool: "Tool Goes Here"   },
		],
		"*": [
			{ type: "item", code: "seeds-carrot", quantity: { avg: 0.7 }  },
		]
	},

I assume something like this for carrot for example. My current mod is content mod. So how would that work? I don't remember how to do this part. I think I make a copy of existing right and drop it in my folder and it will over right vanilla? 

 

Path: /blocktypes/plant/crop/carrot.json

 

do the same in my mod folder? But with my version? Sorry been awhile. 

Posted

It's still a content mod, unless you plan to provide your own dll with custom classes etc.

Yes, this can be done via the Compability api, by having your file replace the vanilla file. CompabilityLib

If you want to replace the carrot like in your example above, just place the edited file in you mods asset folder:  assets/game/blocktypes/plant/crop/carrot.json
Also make sure your modinfo's "side:" is either "server" or "universal".

Posted (edited)

@xXx_Ape_xXx

Making sure I did this correctly. Would look like this:

image.png.17b3b6b86f02e0c4791cf4f0da8cc7d5.png

 

And my Carrot.json file would merge/overwrite the vanilla games files right? Or do I need to place this in a different directory? Wood Working is the current mod in development.  Likely go in different mod but just making sure I understand.  

 

Code would look like this?

{
	code: "woodworking:crop",
	class: "BlockCrop",
	behaviors: [{name: "Unstable"}],
	variantgroups: [
		{ code: "type", states: ["carrot"] },
		{ code: "stage", states: ["1", "2", "3", "4", "5", "6", "7"] },
	],
	creativeinventory: { "general": [""], "plants": [""] },
	renderpass: "OpaqueNoCull",
	shapeByType: {
		"*-5": { base: "block/plant/crop/carrot/stage5" },
		"*-6": { base: "block/plant/crop/carrot/stage6" },
		"*-7": { base: "block/plant/crop/carrot/stage7" },
		"*": { base: "block/plant/crop/carrot/stage1to4" }
	},
	blockmaterial: "Plant",
	textures: {
		"s": { base: "block/plant/crop/carrot/s{stage}" },
		"e": { base: "block/plant/crop/carrot/e{stage}" },
	},
	attributes: {
		foodTags: ["nibbleCrop"],
		butterflyFeedByType: {
			"*-1": false,
			"*-7": false,
			"*": true
		},
		beeFeedByType: {
			"*-1": false,
			"*-7": false,
			"*": true
		},
		sitHeight: 0.35,
		tickGrowthProbability: 0.05,
		handbook: {
			include: true
		}
	},
	sideopaque: {
		all: false
	},
	sidesolid: {
		all: false
	},
	replaceable: 3000,
	lightAbsorption: 0,
	resistance: 0.5,
	sounds: {
		place: "block/plant",
		break: "block/plant",
		hit: "block/plant"
	},
	rainPermeable: false,
	dropsByType: {
		"*-6": [
			{ type: "item", code: "seeds-carrot", quantity: { avg: 1 }, tool: "Tool Goes Here"  },
            { type: "item", code: "seeds-carrot", quantity: { avg: 0.99 } },
			{ type: "item", code: "vegetable-carrot", quantity: { avg: 4, var: 1 }, tool: "Tool Goes Here"  },
            { type: "item", code: "vegetable-carrot", quantity: { avg: 3, var: 1 } }
		],
		"*-7": [
			{ type: "item", code: "seeds-carrot", quantity: { avg: 2 }, tool: "Tool Goes Here"  },
            { type: "item", code: "seeds-carrot", quantity: { avg: 1.2 } },
			{ type: "item", code: "vegetable-carrot", quantity: { avg: 15, var: 4 }, tool: "Tool Goes Here" },
            { type: "item", code: "vegetable-carrot", quantity: { avg: 11, var: 2 } }
		],
		"*": [
			{ type: "item", code: "seeds-carrot", quantity: { avg: 0.7 }  }
		]
	},
	cropProps: {
		// Choose a fertilizer that has little nitrogen and more potassium and phosphate - 0-10-10 or 5-15-15 will work well. - http://www.backyard-vegetable-gardening.com/watering-carrots.html
		requiredNutrient: "K",
		nutrientConsumption: 40,
		growthStages: 7,
		totalGrowthMonths: 1.2,
		coldDamageBelow: -10,
		damageGrowthStuntMul: 0.75,
		coldDamageRipeMul: 0.5,
		heatDamageAbove: 32
	},
	collisionbox: null,
	selectionbox: { x1: 0.0625, y1: 0, z1: 0.0625, x2: 0.9375, y2: 0.25, z2: 0.9375 },
	materialDensity: 200,
	combustibleProps: {
		burnTemperature: 600,
		burnDuration: 10,
	},
	frostable: true
}

 

Edited by Micah Holmes
Posted

@xXx_Ape_xXx

Trying this with a raccoon and not having much luck. No code errors but I cant spawn raccoons now into the world. Here is the code:

{
	code: "woodworking:raccoon",
	class: "EntityAgent",
	tags: ["animal", "huntable", "adult", "habitat-land"],
	weight: 15,
	variantgroups:  [ 
		{ code: "type", states: ["common"]},
		{ code: "age", states: ["adult"] },
		{ code: "gender", states: ["male", "female"] },
	] ,
	hitboxSize: { x: 0.75, y: 0.5 },
	deadHitboxSize: { x: 0.75, y: 0.4 },
	eyeHeight: 0.7,
	drops: [],
	attributes: {
		creatureDiet: {
			foodCategories: ["Fruit"],
			weightedFoodTags: [
				{ weight: 0.9, code: "fruit" },
				{ weight: 1, code: "egg" },
				{ weight: 1, code: "lootableSweet" },
				{ weight: 1, code: "sweetBerryBush" },
				{ weight: 0.2, code: "peanut" }
			]
		},
		trappable: {
			"small": { trapChance: 0.0,	trapDestroyChance: 0.5 },
			"large": { trapChance: 0.0,	trapDestroyChance: 0.0 }
		},
		handbook: {
			groupcode: "creaturegroup-raccoon"
		}
	},
	client: {
		renderer: "Shape",
		shape: { base: "game:entity/animal/mammal/raccoon/{type}-{gender}" },
		texture: { base: "game:entity/animal/mammal/raccoon/{type}-{gender}1" },
		behaviors: [
			{ code: "repulseagents" }, 
			{ code: "controlledphysics", stepHeight: 1.1251 }, 
			{ code: "floatupwhenstuck", onlyWhenDead: true },
			{ code: "interpolateposition" },
			{ code: "harvestable" },
			{ code: "mouthinventory", acceptStacks: [ { type: "item", code: "honeycomb" } ] },
			{ code: "despawn", minPlayerDistance: 8, belowLightLevel: 8, minSeconds: 300 },
			{ code: "ropetieable", minGeneration: 2 }
		],
		animations: [
			{
				code: "hurt",
				animation: "hurt", 
				animationSpeed: 2.2,
				weight: 10,
				blendMode: "AddAverage" 
			},
			{
				code: "die",
				animation: "death", 
				animationSpeed: 1.25,
				weight: 10,
				blendMode: "Average",
				triggeredBy: { onControls: ["dead"] }
			},
			{
				code: "idle", 
				animation: "idle",
				blendMode: "AddAverage",
				easeOutSpeed: 4,
				triggeredBy: { defaultAnim: true },
			},
			{ 
				code: "walk",
				animation: "walk",
				weight: 5
			}
		]
	},
	server: {
		behaviors: [
			{ code: "ropetieable", minGeneration: 2 },
			{ code: "repulseagents" }, 
			{ code: "controlledphysics", stepHeight: 1.1251 },
			{ code: "despawn", minPlayerDistance: 8, belowLightLevel: 8, minSeconds: 300 },
			{ code: "health", currenthealth: 6, maxhealth: 6, },
			{ code: "deaddecay", hoursToDecay: 96, decayedBlock: "carcass-small" },
			{ code: "floatupwhenstuck", onlyWhenDead: true },
			{ code: "harvestable", drops: [
				{
					type: "item", 
					code: "game:bushmeat-raw", 
					quantity: { avg: 2, var: 1 } 
				},
				{
					type: "item", code: "game:bushmeat-raw", quantity: { avg: 2, var: 1, tool: "skinningknife-*"  } 
				},
				{
					type: "item", 
					code: "game:hide-raw-small", 
					quantity: { avg: 1.25, var: 0 } 
				},
				{
					type: "item", 
					code: "game:fat", 
					quantity: { avg: 0.25, var: 0 } 
				}
				]
			},
			{ code: "breathe" },
			{ 
				code: "emotionstates",
				states: [
					{ code: "aggressiveondamage", duration: 5, chance: 0, slot: 0, priority: 2, accumType: "noaccum" },
					{ code: "fleeondamage", duration: 10, chance: 1, slot: 0, priority: 1, accumType: "max" },
					{ code: "saturated", duration: 1200, chance: 1, slot: 0, priority: 1, accumType: "sum" }
				],
			},
			{ 
				code: "taskai",
				aiCreatureType: "LandCreature",
				aitasks: [
					{
						code: "meleeattack",
						entityCodes: ["player"],
						priority: 3,
						damage: 3,
						slot: 1,
						mincooldown: 1500, 
						maxcooldown: 1500, 
						attackDurationMs: 800,
						damagePlayerAtMs: 500,
						animation: "Attack",
						animationSpeed: 2.5,
						whenInEmotionState: "aggressiveondamage"
					},
					{
						code: "seekentity",
						entityCodes: ["player"],
						priority: 2.5,
						movespeed: 0.022,
						seekingRange: 20,
						animation: "Run",
						animationSpeed: 1.5,
						sound: "creature/raccoon/aggro",
						whenInEmotionState: "aggressiveondamage"
					},
					{
						code: "fleeentity",
						entityCodes: ["player", "wolf-*", "bear-*"],
						priority: 2,
						movespeed: 0.035,
						animationSpeed: 3.5,
						seekingRange: 12,
						animation: "Run"
					},
					{
						code: "fleeentity",
						entityCodes: ["beemob"],
						priority: 2,
						movespeed: 0.03,
						animationSpeed: 3,
						seekingRange: 9,
						fleeDurationMs: 20000,
						fleeingDistance: 25,
						animation: "Run",
						retaliateAttacks: false,
						whenInEmotionState: "fleeondamage"
					},
					{
						code: "seekfoodandeat",
						movespeed: 0.010,
						priority: 1.6,
						animationSpeed: 1.75,
						eatTime: 2,
						eatLooseItems: true,
						animation: "Walk",
						eatAnimation: "gather",
						eatAnimationLooseItems: "eat",
						mincooldownHours: 6,
						maxcooldownHours: 12,
					},
					{
						code: "useinventory",
						animation: "eat",
						priority: 1.5,
						priorityForCancel: 1.7,
						eatItemCategories: ["Fruit"],
						eatItemCodes: ["honeycomb"],
						useTime: 3,
						mincooldownHours: 0,
						maxcooldownHours: 0.5,
					},
					{
						code: "followleadholder",
						minGeneration: 2,
						priority: 1.45,
						animation: "walk",
						animationSpeed: 2,
						movespeed: 0.008
					},
					{
						code: "getoutofwater",
						priority: 1.4,
						movespeed: 0.015,
						animation: "Walk",
						animationSpeed: 2.2
					},
					{
						code: "stayclosetoentity",
						enabledByType: {
							"*-adult-female": true,
							"*": false
						},
						priority: 1.4,
						entityCode: "raccoon-{type}-adult-male",
						movespeed: 0.02,
						animationSpeed: 3,
						maxDistance: 5,
						searchRange: 25,
						animation: "Run"
					},
					{
						code: "idle",
						priority: 1.2,
						priorityForCancel: 1.35,
						minduration: 2500,
						maxduration: 2500,
						mincooldown: 6000,
						maxcooldown: 20000,
						animation: "Sniff",
						animationSpeed: 1.25
					},
					{
						code: "wander", 
						priority: 1.0, 
						priorityForCancel: 1.35,
						animation: "Walk",
						preferredLightLevel: 20,
						movespeed: 0.008,
						animationSpeed: 2
					},
					{
						code: "idle",
						priority: 0.9,
						minduration: 5000,
						maxduration: 30000,
						mincooldown: 2000,
						maxcooldown: 120000,
						priorityForCancel: 1.28,
						animation: "Sit",
						stopOnNearbyEntityCodes: ["player"],
						stopRange: 5
					},
					{ 
						code: "lookaround", 
						priority: 0.5
					}
				]
			},
			{ code: "collectitems" }, 
			{ code: "mouthinventory", acceptStacks: [ { type: "item", code: "honeycomb" }, { type: "item", code: "fruit-blueberry" }, { type: "item", code: "fruit-cranberry" }, { type: "item", code: "fruit-redcurrant" }, { type: "item", code: "fruit-whitecurrant" }, { type: "item", code: "fruit-blackcurrant" } ] },
			{ code: "entitystatetags" }
		],
		spawnconditions: {
			worldgen: {
				TriesPerChunk: { avg: 0.06, var: 0 },
				tryOnlySurface: true,
				groupSize: { dist: "verynarrowgaussian", avg: 2, var: 3 },
				insideBlockCodes: ["air", "tallgrass-*", "snowlayer-1"],
				minTemp: -15,
				maxTemp: 15,
				minRain: 0.25,
				minForestOrShrubs: 0.25,
				maxForest: 0.75,
				maxShrubs: 0.75,
				companions: ["raccoon-{type}-adult-female", "raccoon-{type}-baby-male", "raccoon-{type}-baby-female"]
			},
			runtime: {
				group: "neutral",
				tryOnlySurface: true,
				chance: 0.0009,
				maxQuantity: 4,
				// Make them spawn away from artifical light so they don't spawn inside farmland
				maxLightLevel: 7,
				groupSize: { avg: 1, var: 0 },
				insideBlockCodes: ["air", "tallgrass-*", "snowlayer-1"],
				minTemp: -4,
				maxTemp: 15,
				minRain: 0.4,
				minForestOrShrubs: 0.5,
				maxForest: 1,
				maxShrubs: 1,
				companions: ["raccoon-{type}-adult-female", "raccoon-{type}-baby-male", "raccoon-{type}-baby-female"]
			}
		}
	},
	sounds: {
		hurt: "creature/raccoon/hurt",
		death: "creature/raccoon/death",
		idle: "creature/raccoon/idle"
	},
	idleSoundChance: 0.01
}

I know I'm likely missing a bunch of stuff. Just not sure where. I put a crazy number in for testing. 

 

{
	code: "skinningknife",
	// ItemKnife contains code for harvesting animal carcasses
	class: "ItemKnife",
	tags: ["weapon", "weapon-melee"],
	damagedby: ["blockbreaking", "attacking"],
	tool: "knife",
	attributes: {
		heldItemPitchFollow: 1,
		knifeHitBlockAnimation: "knifecut",
		knifeHitEntityAnimation: "knifestab",
		handbook: {
			groupBy: ["knife-*"]
		},
		toolrackTransformByType: {
			"*": {
				translation: { x: -0.3, y: 0.6, z: -0.1 },
				rotation: { x: 97, y: 180, z: 3 },
				origin: { x: 0.5, y: 0, z: 0.5 },
				scale: 1.8
			}
		},
		groundStorageTransformByType: {
			"*": {
				translation: { x: 0, y: 0.04, z: -0.104 },
				rotation: { x: 26, y: 88, z: -87 },
				scale: 1
			}
		}
	},
	behaviors: [{ 
		name: "GroundStorable",
		properties: {
			layout: 'WallHalves',
			wallOffY: 1,
			ctrlKey: true,
			selectionBox: { x1: 0, y1: 0, z1: 0, x2: 1, y2: 0.1, z2: 1 },
			collisionBox: { x1: 0, y1: 0, z1: 0, x2: 0, y2: 0, z2: 0 },
		},
	}, { name: "AnimationAuthoritative" }],
	variantgroups: [ { code: "type", states: ["apprentice", "journeyman", "artisan", "master", "grandmaster" ] } ],
	shapeByType: {
		"skinningknife-apprentice": { base: "special/skinningknife" },
		"skinningknife-journeyman": { base: "special/skinningknife" },
		"skinningknife-artisan": { base: "special/skinningknifeartisan" },
		"skinningknife-master": { base: "special/skinningknifemaster" },
		"skinningknife-grandmaster": { base: "special/skinningknifegrandmaster" }
	},
	heldTpHitAnimation: "knifestab",
	texturesByType: {
		"skinningknife-apprentice": {
			"Blade": { base: "game:block/stone/flint" },
            "Handle": { base: "stain/maple-1" }
		},
		"skinningknife-journeyman": {
			"Blade": { base: "game:block/stone/rock/basalt1" },
            "Handle": { base: "stain/acacia-1" }
		},
		"skinningknife-artisan": {
			"Blade": { base: "game:block/stone/rock/obsidian1" },
            "Handle": { base: "stain/ebony-1" },
            "Cap": { base: "game:block/metal/ingot/tinbronze" }
		},
		"skinningknife-master": {
			"Blade": { base: "game:block/stone/rock/granite1" },
            "Handle": { base: "stain/aged-1" },
            "Cap": { base: "game:block/metal/ingot/tinbronze" },
            "grip": { base: "game:block/leather/plain" }
		},
		"skinningknife-grandmaster": {
			"Blade": { base: "game:block/stone/rock/peridotite1" },
            "Handle": { base: "stain/aged-1" },
            "Cap": { base: "game:block/metal/ingot/tinbronze" },
            "grip": { base: "game:block/leather/plain" }
		}
	},
	durabilitybytype: {
		"skinningknife-apprentice": 190,
		"skinningknife-journeyman": 500,
		"skinningknife-artisan": 750,
		"skinningknife-master": 980,
        "skinningknife-grandmaster": 1500
	},
	miningspeedbytype: {
		"skinningknife-apprentice": {
			"plant": 3,
		},
		"skinningknife-journeyman": {
			"plant": 4.5,
		},
		"skinningknife-artisan": {
			"plant": 5,
		},
		"skinningknife-master": {
			"plant": 6,
		},
		"skinningknife-grandmaster": {
			"plant": 6.7,
		}
	},
	attackpowerbytype: {
		"skinningknife-apprentice": 1,
		"skinningknife-journeyman": 1.7,
		"skinningknife-artisan": 2.5,
		"skinningknife-master": 3.8,
		"skinningknife-grandmaster": 4.2
	},
	creativeinventory: { "general": ["*"], "items": ["*"], "tools": ["*"] },
	fpHandTransformByType: {
		"*": {
			translation: { x: 0.2, y: 0.1, z: 0.5 },
			rotation: { x: 140, y: 93, z: -75 },
			scale: 2.5
		}
	},
	guiTransformByType: {
		"*": {
			rotate: false,
			translation: { x: 0, y: 0, z: 0 },
			rotation: { x: -158, y: 0, z: 48 },
			origin: { x: 0.48, y: 0.1, z: 0.5 },
			scale: 2.41
		},
	},
	groundTransform: {
			translation: { x: 0, y: 0, z: 0 },
			rotation: { x: -90, y: 0, z: 0 },
			origin: { x: 0.5, y: 0.5, z: 0.45 },
			scale: 3.6
	},
	tpHandTransformByType: {
		"*": {
			translation: { x: -0.84, y: -0.11, z: -0.48 },
			rotation: { x: 0, y: 0, z: -15 },
			scale: 1
		}
	}
}

 

Posted

update able to get it spawning but its not doing anything or giving any meat when harvested:

{
	code: "raccoon",
	class: "EntityAgent",
	tags: ["animal", "huntable", "adult", "habitat-land"],
	weight: 15,
	variantgroups:  [ 
		{ code: "type", states: ["common"]},
		{ code: "age", states: ["adult"] },
		{ code: "gender", states: ["male", "female"] },
	] ,
	hitboxSize: { x: 0.75, y: 0.5 },
	deadHitboxSize: { x: 0.75, y: 0.4 },
	eyeHeight: 0.7,
	drops: [],
	attributes: {
		creatureDiet: {
			foodCategories: ["Fruit"],
			weightedFoodTags: [
				{ weight: 0.9, code: "fruit" },
				{ weight: 1, code: "egg" },
				{ weight: 1, code: "lootableSweet" },
				{ weight: 1, code: "sweetBerryBush" },
				{ weight: 0.2, code: "peanut" }
			]
		},
		trappable: {
			"small": { trapChance: 0.0,	trapDestroyChance: 0.5 },
			"large": { trapChance: 0.0,	trapDestroyChance: 0.0 }
		},
		handbook: {
			groupcode: "creaturegroup-raccoon"
		}
	},
	client: {
		renderer: "Shape",
		shape: { base: "game:entity/animal/mammal/raccoon/{type}-{gender}" },
		texture: { base: "game:entity/animal/mammal/raccoon/{type}-{gender}1" },
		behaviors: [
			{ code: "repulseagents" }, 
			{ code: "controlledphysics", stepHeight: 1.1251 }, 
			{ code: "floatupwhenstuck", onlyWhenDead: true },
			{ code: "interpolateposition" },
			{ code: "harvestable" },
			{ code: "mouthinventory", acceptStacks: [ { type: "item", code: "honeycomb" } ] },
			{ code: "despawn", minPlayerDistance: 8, belowLightLevel: 8, minSeconds: 300 },
			{ code: "ropetieable", minGeneration: 2 }
		],
		animations: [
			{
				code: "game:hurt",
				animation: "hurt", 
				animationSpeed: 2.2,
				weight: 10,
				blendMode: "AddAverage" 
			},
			{
				code: "game:die",
				animation: "death", 
				animationSpeed: 1.25,
				weight: 10,
				blendMode: "Average",
				triggeredBy: { onControls: ["dead"] }
			},
			{
				code: "game:idle", 
				animation: "idle",
				blendMode: "AddAverage",
				easeOutSpeed: 4,
				triggeredBy: { defaultAnim: true },
			},
			{ 
				code: "game:walk",
				animation: "walk",
				weight: 5
			}
		]
	},
	server: {
		behaviors: [
			{ code: "ropetieable", minGeneration: 2 },
			{ code: "repulseagents" }, 
			{ code: "controlledphysics", stepHeight: 1.1251 },
			{ code: "despawn", minPlayerDistance: 8, belowLightLevel: 8, minSeconds: 300 },
			{ code: "health", currenthealth: 6, maxhealth: 6, },
			{ code: "deaddecay", hoursToDecay: 96, decayedBlock: "carcass-small" },
			{ code: "floatupwhenstuck", onlyWhenDead: true },
			{ code: "game:harvestable", drops: [
				{
					type: "item", 
					code: "game:bushmeat-raw", 
					quantity: { avg: 2, var: 1 } 
				},
				{
					type: "item", code: "game:bushmeat-raw", quantity: { avg: 2, var: 1, tool: "skinningknife-*"  } 
				},
				{
					type: "item", 
					code: "game:hide-raw-small", 
					quantity: { avg: 1.25, var: 0 } 
				},
				{
					type: "item", 
					code: "game:fat", 
					quantity: { avg: 0.25, var: 0 } 
				}
				]
			},
			{ code: "breathe" },
			{ 
				code: "emotionstates",
				states: [
					{ code: "aggressiveondamage", duration: 5, chance: 0, slot: 0, priority: 2, accumType: "noaccum" },
					{ code: "fleeondamage", duration: 10, chance: 1, slot: 0, priority: 1, accumType: "max" },
					{ code: "saturated", duration: 1200, chance: 1, slot: 0, priority: 1, accumType: "sum" }
				],
			},
			{ 
				code: "game:taskai",
				aiCreatureType: "LandCreature",
				aitasks: [
					{
						code: "meleeattack",
						entityCodes: ["player"],
						priority: 3,
						damage: 3,
						slot: 1,
						mincooldown: 1500, 
						maxcooldown: 1500, 
						attackDurationMs: 800,
						damagePlayerAtMs: 500,
						animation: "Attack",
						animationSpeed: 2.5,
						whenInEmotionState: "aggressiveondamage"
					},
					{
						code: "seekentity",
						entityCodes: ["player"],
						priority: 2.5,
						movespeed: 0.022,
						seekingRange: 20,
						animation: "Run",
						animationSpeed: 1.5,
						sound: "creature/raccoon/aggro",
						whenInEmotionState: "aggressiveondamage"
					},
					{
						code: "fleeentity",
						entityCodes: ["player", "wolf-*", "bear-*"],
						priority: 2,
						movespeed: 0.035,
						animationSpeed: 3.5,
						seekingRange: 12,
						animation: "Run"
					},
					{
						code: "fleeentity",
						entityCodes: ["beemob"],
						priority: 2,
						movespeed: 0.03,
						animationSpeed: 3,
						seekingRange: 9,
						fleeDurationMs: 20000,
						fleeingDistance: 25,
						animation: "Run",
						retaliateAttacks: false,
						whenInEmotionState: "fleeondamage"
					},
					{
						code: "seekfoodandeat",
						movespeed: 0.010,
						priority: 1.6,
						animationSpeed: 1.75,
						eatTime: 2,
						eatLooseItems: true,
						animation: "Walk",
						eatAnimation: "gather",
						eatAnimationLooseItems: "eat",
						mincooldownHours: 6,
						maxcooldownHours: 12,
					},
					{
						code: "useinventory",
						animation: "eat",
						priority: 1.5,
						priorityForCancel: 1.7,
						eatItemCategories: ["Fruit"],
						eatItemCodes: ["honeycomb"],
						useTime: 3,
						mincooldownHours: 0,
						maxcooldownHours: 0.5,
					},
					{
						code: "followleadholder",
						minGeneration: 2,
						priority: 1.45,
						animation: "walk",
						animationSpeed: 2,
						movespeed: 0.008
					},
					{
						code: "getoutofwater",
						priority: 1.4,
						movespeed: 0.015,
						animation: "Walk",
						animationSpeed: 2.2
					},
					{
						code: "stayclosetoentity",
						enabledByType: {
							"*-adult-female": true,
							"*": false
						},
						priority: 1.4,
						entityCode: "raccoon-{type}-adult-male",
						movespeed: 0.02,
						animationSpeed: 3,
						maxDistance: 5,
						searchRange: 25,
						animation: "Run"
					},
					{
						code: "idle",
						priority: 1.2,
						priorityForCancel: 1.35,
						minduration: 2500,
						maxduration: 2500,
						mincooldown: 6000,
						maxcooldown: 20000,
						animation: "Sniff",
						animationSpeed: 1.25
					},
					{
						code: "wander", 
						priority: 1.0, 
						priorityForCancel: 1.35,
						animation: "Walk",
						preferredLightLevel: 20,
						movespeed: 0.008,
						animationSpeed: 2
					},
					{
						code: "idle",
						priority: 0.9,
						minduration: 5000,
						maxduration: 30000,
						mincooldown: 2000,
						maxcooldown: 120000,
						priorityForCancel: 1.28,
						animation: "Sit",
						stopOnNearbyEntityCodes: ["player"],
						stopRange: 5
					},
					{ 
						code: "lookaround", 
						priority: 0.5
					}
				]
			},
			{ code: "collectitems" }, 
			{ code: "mouthinventory", acceptStacks: [ { type: "item", code: "honeycomb" }, { type: "item", code: "fruit-blueberry" }, { type: "item", code: "fruit-cranberry" }, { type: "item", code: "fruit-redcurrant" }, { type: "item", code: "fruit-whitecurrant" }, { type: "item", code: "fruit-blackcurrant" } ] },
			{ code: "entitystatetags" }
		],
		spawnconditions: {
			worldgen: {
				TriesPerChunk: { avg: 0.06, var: 0 },
				tryOnlySurface: true,
				groupSize: { dist: "verynarrowgaussian", avg: 2, var: 3 },
				insideBlockCodes: ["air", "tallgrass-*", "snowlayer-1"],
				minTemp: -15,
				maxTemp: 15,
				minRain: 0.25,
				minForestOrShrubs: 0.25,
				maxForest: 0.75,
				maxShrubs: 0.75,
				companions: ["raccoon-{type}-adult-female", "raccoon-{type}-baby-male", "raccoon-{type}-baby-female"]
			},
			runtime: {
				group: "neutral",
				tryOnlySurface: true,
				chance: 0.0009,
				maxQuantity: 4,
				// Make them spawn away from artifical light so they don't spawn inside farmland
				maxLightLevel: 7,
				groupSize: { avg: 1, var: 0 },
				insideBlockCodes: ["air", "tallgrass-*", "snowlayer-1"],
				minTemp: -4,
				maxTemp: 15,
				minRain: 0.4,
				minForestOrShrubs: 0.5,
				maxForest: 1,
				maxShrubs: 1,
				companions: ["raccoon-{type}-adult-female", "raccoon-{type}-baby-male", "raccoon-{type}-baby-female"]
			}
		}
	},
	sounds: {
		hurt: "game:creature/raccoon/hurt",
		death: "game:creature/raccoon/death",
		idle: "game:creature/raccoon/idle"
	},
	idleSoundChance: 0.01
}

 

Posted
11 minutes ago, Micah Holmes said:
				{
					type: "item", code: "game:bushmeat-raw", quantity: { avg: 2, var: 1, tool: "skinningknife-*"  } 
				},

The tool needs to be the same as in your skinningknife json:

 

10 minutes ago, Micah Holmes said:
	code: "skinningknife",
	// ItemKnife contains code for harvesting animal carcasses
	class: "ItemKnife",
	tags: ["weapon", "weapon-melee"],
	damagedby: ["blockbreaking", "attacking"],
	tool: "knife",                                    <--- this line!

 

 

 

If you want to prevent a regular knife from being used, you'll need to assign a different tool type from the list I posted earlier here:

12 hours ago, xXx_Ape_xXx said:

EnumTools.cs

In this list, there are several that are not used in the game. Try using "sickle", as that is not used by any currently available tools in the game.

So change "tool: knife" to "tool: sickle" in your skinningknife.json, and same in the raccoon harvesting properties.

Posted

@xXx_Ape_xXx

The idea behind the skinning knife was you get a bonus to meat when using it to skin animals vs regular knife. However, I dont think this is going to work. Grass used "dropsByType:" and the entity drops use "drops:". I tried switching it over to by type no luck. I'll keep playing with it and maybe ill get it to work but not very hopefully currently. 

Posted

Grass uses "dropsByType" because there are several types of grass registered by the tallgrass.json

 

{
	code: "tallgrass",
	class: "BlockTallGrass",
	entityClassByType: {
		"tallgrass-eaten-*": "Transient"
	},
	variantgroups: [
		{ loadFromProperties: "block/tallgrass" },
		{ code: "cover", states: ["free", "snow", "snow2", "snow3"] },
	],

This results in tallgrass-veryshort-free, tallgrass-veryshort-snow etc etc

The "dropsByType" matches the key to find what it drops when harvested/cut.

What you want to achieve does not require "dropsByType", unless you want to have different drops for male/female types of raccoons.
I've had a closer look at your files above, and there's several things that needs fixing. I'll attach them under, so you can test to see if they work now.

 

Spoiler

{
    code: "skinningknife",
    // ItemKnife contains code for harvesting animal carcasses
    class: "ItemKnife",
    tags: ["weapon", "weapon-melee"],
    damagedby: ["blockbreaking", "attacking"],
    tool: "sickle",
    attributes: {
        heldItemPitchFollow: 1,
        knifeHitBlockAnimation: "knifecut",
        knifeHitEntityAnimation: "knifestab",
        handbook: {
            groupBy: ["skinningknife-*"]
        },
        toolrackTransformByType: {
            "*": {
                translation: { x: -0.3, y: 0.6, z: -0.1 },
                rotation: { x: 97, y: 180, z: 3 },
                origin: { x: 0.5, y: 0, z: 0.5 },
                scale: 1.8
            }
        },
        groundStorageTransformByType: {
            "*": {
                translation: { x: 0, y: 0.04, z: -0.104 },
                rotation: { x: 26, y: 88, z: -87 },
                scale: 1
            }
        }
    },
    behaviors: [{ 
        name: "GroundStorable",
        properties: {
            layout: 'WallHalves',
            wallOffY: 1,
            ctrlKey: true,
            selectionBox: { x1: 0, y1: 0, z1: 0, x2: 1, y2: 0.1, z2: 1 },
            collisionBox: { x1: 0, y1: 0, z1: 0, x2: 0, y2: 0, z2: 0 },
            },
        },
        { name: "AnimationAuthoritative" }
    ],
    variantgroups: [ { code: "type", states: ["apprentice", "journeyman", "artisan", "master", "grandmaster" ] } ],
    shapeByType: {
        "skinningknife-apprentice": { base: "special/skinningknife" },
        "skinningknife-journeyman": { base: "special/skinningknife" },
        "skinningknife-artisan": { base: "special/skinningknifeartisan" },
        "skinningknife-master": { base: "special/skinningknifemaster" },
        "skinningknife-grandmaster": { base: "special/skinningknifegrandmaster" }
    },
    heldTpHitAnimation: "knifestab",
    texturesByType: {
        "skinningknife-apprentice": {
            "Blade": { base: "game:block/stone/flint" },
            "Handle": { base: "stain/maple-1" }
        },
        "skinningknife-journeyman": {
            "Blade": { base: "game:block/stone/rock/basalt1" },
            "Handle": { base: "stain/acacia-1" }
        },
        "skinningknife-artisan": {
            "Blade": { base: "game:block/stone/rock/obsidian1" },
            "Handle": { base: "stain/ebony-1" },
            "Cap": { base: "game:block/metal/ingot/tinbronze" }
        },
        "skinningknife-master": {
            "Blade": { base: "game:block/stone/rock/granite1" },
            "Handle": { base: "stain/aged-1" },
            "Cap": { base: "game:block/metal/ingot/tinbronze" },
            "grip": { base: "game:block/leather/plain" }
        },
        "skinningknife-grandmaster": {
            "Blade": { base: "game:block/stone/rock/peridotite1" },
            "Handle": { base: "stain/aged-1" },
            "Cap": { base: "game:block/metal/ingot/tinbronze" },
            "grip": { base: "game:block/leather/plain" }
        }
    },
    durabilitybytype: {
        "skinningknife-apprentice": 190,
        "skinningknife-journeyman": 500,
        "skinningknife-artisan": 750,
        "skinningknife-master": 980,
        "skinningknife-grandmaster": 1500
    },
    miningspeedbytype: {
        "skinningknife-apprentice": {
            "plant": 3,
        },
        "skinningknife-journeyman": {
            "plant": 4.5,
        },
        "skinningknife-artisan": {
            "plant": 5,
        },
        "skinningknife-master": {
            "plant": 6,
        },
        "skinningknife-grandmaster": {
            "plant": 6.7,
        }
    },
    attackpowerbytype: {
        "skinningknife-apprentice": 1,
        "skinningknife-journeyman": 1.7,
        "skinningknife-artisan": 2.5,
        "skinningknife-master": 3.8,
        "skinningknife-grandmaster": 4.2
    },
    creativeinventory: { "general": ["*"], "items": ["*"], "tools": ["*"] },
    fpHandTransformByType: {
        "*": {
            translation: { x: 0.2, y: 0.1, z: 0.5 },
            rotation: { x: 140, y: 93, z: -75 },
            scale: 2.5
        }
    },
    guiTransformByType: {
        "*": {
            rotate: false,
            translation: { x: 0, y: 0, z: 0 },
            rotation: { x: -158, y: 0, z: 48 },
            origin: { x: 0.48, y: 0.1, z: 0.5 },
            scale: 2.41
        },
    },
    groundTransform: {
            translation: { x: 0, y: 0, z: 0 },
            rotation: { x: -90, y: 0, z: 0 },
            origin: { x: 0.5, y: 0.5, z: 0.45 },
            scale: 3.6
    },
    tpHandTransformByType: {
        "*": {
            translation: { x: -0.84, y: -0.11, z: -0.48 },
            rotation: { x: 0, y: 0, z: -15 },
            scale: 1
        }
    }
}

Spoiler

{
    code: "raccoon",
    class: "EntityAgent",
    tags: ["animal", "huntable", "adult", "habitat-land"],
    weight: 15,
    variantgroups:  [ 
        { code: "type", states: ["common"]},
        { code: "age", states: ["adult"] },
        { code: "gender", states: ["male", "female"] },
    ] ,
    hitboxSize: { x: 0.75, y: 0.5 },
    deadHitboxSize: { x: 0.75, y: 0.4 },
    eyeHeight: 0.7,
    drops: [],
    attributes: {
        creatureDiet: {
            foodCategories: ["Fruit"],
            weightedFoodTags: [
                { weight: 0.9, code: "fruit" },
                { weight: 1, code: "egg" },
                { weight: 1, code: "lootableSweet" },
                { weight: 1, code: "sweetBerryBush" },
                { weight: 0.2, code: "peanut" }
            ]
        },
        trappable: {
            "small": { trapChance: 0.0,    trapDestroyChance: 0.5 },
            "large": { trapChance: 0.0,    trapDestroyChance: 0.0 }
        },
        handbook: {
            groupcode: "creaturegroup-raccoon"
        }
    },
    client: {
        renderer: "Shape",
        shape: { base: "entity/animal/mammal/raccoon/{type}-{gender}" },
        texture: { base: "entity/animal/mammal/raccoon/{type}-{gender}1" },
        behaviors: [
            { code: "repulseagents" }, 
            { code: "controlledphysics", stepHeight: 1.1251 }, 
            { code: "floatupwhenstuck", onlyWhenDead: true },
            { code: "interpolateposition" },
            { code: "harvestable" },
            { code: "mouthinventory", acceptStacks: [ { type: "item", code: "honeycomb" } ] },
            { code: "despawn", minPlayerDistance: 8, belowLightLevel: 8, minSeconds: 300 },
            { code: "ropetieable", minGeneration: 2 }
        ],
        animations: [
            {
                code: "hurt",
                animation: "hurt", 
                animationSpeed: 2.2,
                weight: 10,
                blendMode: "AddAverage" 
            },
            {
                code: "die",
                animation: "death", 
                animationSpeed: 1.25,
                weight: 10,
                blendMode: "Average",
                triggeredBy: { onControls: ["dead"] }
            },
            {
                code: "idle", 
                animation: "idle",
                blendMode: "AddAverage",
                easeOutSpeed: 4,
                triggeredBy: { defaultAnim: true },
            },
            { 
                code: "walk",
                animation: "walk",
                weight: 5
            }
        ]
    },
    server: {
        behaviors: [
            { code: "ropetieable", minGeneration: 2 },
            { code: "repulseagents" }, 
            { code: "controlledphysics", stepHeight: 1.1251 },
            { code: "despawn", minPlayerDistance: 8, belowLightLevel: 8, minSeconds: 300 },
            { code: "health", currenthealth: 6, maxhealth: 6, },
            { code: "deaddecay", hoursToDecay: 96, decayedBlock: "carcass-small" },
            { code: "floatupwhenstuck", onlyWhenDead: true },
            { code: "harvestable", drops: [
                {
                    type: "item", 
                    code: "bushmeat-raw", 
                    quantity: { avg: 2, var: 1 } 
                },
                {
                    type: "item", code: "bushmeat-raw", quantity: { avg: 2, var: 1, tool: "sickle"  } 
                },
                {
                    type: "item", 
                    code: "hide-raw-small", 
                    quantity: { avg: 1.25, var: 0 } 
                },
                {
                    type: "item", 
                    code: "fat", 
                    quantity: { avg: 0.25, var: 0 } 
                }
                ]
            },
            { code: "breathe" },
            { 
                code: "emotionstates",
                states: [
                    { code: "aggressiveondamage", duration: 5, chance: 0, slot: 0, priority: 2, accumType: "noaccum" },
                    { code: "fleeondamage", duration: 10, chance: 1, slot: 0, priority: 1, accumType: "max" },
                    { code: "saturated", duration: 1200, chance: 1, slot: 0, priority: 1, accumType: "sum" }
                ],
            },
            { 
                code: "taskai",
                aiCreatureType: "LandCreature",
                aitasks: [
                    {
                        code: "meleeattack",
                        entityCodes: ["player"],
                        priority: 3,
                        damage: 3,
                        slot: 1,
                        mincooldown: 1500, 
                        maxcooldown: 1500, 
                        attackDurationMs: 800,
                        damagePlayerAtMs: 500,
                        animation: "Attack",
                        animationSpeed: 2.5,
                        whenInEmotionState: "aggressiveondamage"
                    },
                    {
                        code: "seekentity",
                        entityCodes: ["player"],
                        priority: 2.5,
                        movespeed: 0.022,
                        seekingRange: 20,
                        animation: "Run",
                        animationSpeed: 1.5,
                        sound: "creature/raccoon/aggro",
                        whenInEmotionState: "aggressiveondamage"
                    },
                    {
                        code: "fleeentity",
                        entityCodes: ["player", "wolf-*", "bear-*"],
                        priority: 2,
                        movespeed: 0.035,
                        animationSpeed: 3.5,
                        seekingRange: 12,
                        animation: "Run"
                    },
                    {
                        code: "fleeentity",
                        entityCodes: ["beemob"],
                        priority: 2,
                        movespeed: 0.03,
                        animationSpeed: 3,
                        seekingRange: 9,
                        fleeDurationMs: 20000,
                        fleeingDistance: 25,
                        animation: "Run",
                        retaliateAttacks: false,
                        whenInEmotionState: "fleeondamage"
                    },
                    {
                        code: "seekfoodandeat",
                        movespeed: 0.010,
                        priority: 1.6,
                        animationSpeed: 1.75,
                        eatTime: 2,
                        eatLooseItems: true,
                        animation: "Walk",
                        eatAnimation: "gather",
                        eatAnimationLooseItems: "eat",
                        mincooldownHours: 6,
                        maxcooldownHours: 12,
                    },
                    {
                        code: "useinventory",
                        animation: "eat",
                        priority: 1.5,
                        priorityForCancel: 1.7,
                        eatItemCategories: ["Fruit"],
                        eatItemCodes: ["honeycomb"],
                        useTime: 3,
                        mincooldownHours: 0,
                        maxcooldownHours: 0.5,
                    },
                    {
                        code: "followleadholder",
                        minGeneration: 2,
                        priority: 1.45,
                        animation: "walk",
                        animationSpeed: 2,
                        movespeed: 0.008
                    },
                    {
                        code: "getoutofwater",
                        priority: 1.4,
                        movespeed: 0.015,
                        animation: "Walk",
                        animationSpeed: 2.2
                    },
                    {
                        code: "stayclosetoentity",
                        enabledByType: {
                            "*-adult-female": true,
                            "*": false
                        },
                        priority: 1.4,
                        entityCode: "raccoon-{type}-adult-male",
                        movespeed: 0.02,
                        animationSpeed: 3,
                        maxDistance: 5,
                        searchRange: 25,
                        animation: "Run"
                    },
                    {
                        code: "idle",
                        priority: 1.2,
                        priorityForCancel: 1.35,
                        minduration: 2500,
                        maxduration: 2500,
                        mincooldown: 6000,
                        maxcooldown: 20000,
                        animation: "Sniff",
                        animationSpeed: 1.25
                    },
                    {
                        code: "wander", 
                        priority: 1.0, 
                        priorityForCancel: 1.35,
                        animation: "Walk",
                        preferredLightLevel: 20,
                        movespeed: 0.008,
                        animationSpeed: 2
                    },
                    {
                        code: "idle",
                        priority: 0.9,
                        minduration: 5000,
                        maxduration: 30000,
                        mincooldown: 2000,
                        maxcooldown: 120000,
                        priorityForCancel: 1.28,
                        animation: "Sit",
                        stopOnNearbyEntityCodes: ["player"],
                        stopRange: 5
                    },
                    { 
                        code: "lookaround", 
                        priority: 0.5
                    }
                ]
            },
            { code: "collectitems" }, 
            { code: "mouthinventory", acceptStacks: [ { type: "item", code: "honeycomb" }, { type: "item", code: "fruit-blueberry" }, { type: "item", code: "fruit-cranberry" }, { type: "item", code: "fruit-redcurrant" }, { type: "item", code: "fruit-whitecurrant" }, { type: "item", code: "fruit-blackcurrant" } ] },
            { code: "entitystatetags" }
        ],
        spawnconditions: {
            worldgen: {
                TriesPerChunk: { avg: 0.06, var: 0 },
                tryOnlySurface: true,
                groupSize: { dist: "verynarrowgaussian", avg: 2, var: 3 },
                insideBlockCodes: ["air", "tallgrass-*", "snowlayer-1"],
                minTemp: -15,
                maxTemp: 15,
                minRain: 0.25,
                minForestOrShrubs: 0.25,
                maxForest: 0.75,
                maxShrubs: 0.75,
                companions: ["raccoon-{type}-adult-female", "raccoon-{type}-baby-male", "raccoon-{type}-baby-female"]
            },
            runtime: {
                group: "neutral",
                tryOnlySurface: true,
                chance: 0.0009,
                maxQuantity: 4,
                // Make them spawn away from artifical light so they don't spawn inside farmland
                maxLightLevel: 7,
                groupSize: { avg: 1, var: 0 },
                insideBlockCodes: ["air", "tallgrass-*", "snowlayer-1"],
                minTemp: -4,
                maxTemp: 15,
                minRain: 0.4,
                minForestOrShrubs: 0.5,
                maxForest: 1,
                maxShrubs: 1,
                companions: ["raccoon-{type}-adult-female", "raccoon-{type}-baby-male", "raccoon-{type}-baby-female"]
            }
        }
    },
    sounds: {
        hurt: "creature/raccoon/hurt",
        death: "creature/raccoon/death",
        idle: "creature/raccoon/idle"
    },
    idleSoundChance: 0.01
}

 

Posted (edited)

@xXx_Ape_xXx

tested it nope does not work. The knife and "sickle" both give high amount. It does not choose one over the other. Instead of giving ether 2 raw meat or 10 raw meat. It gives 2 raw meat in one slot and 10 in another slot. So I assume I would need to do a dll update or something? Based on what I can tell so far the Tool is optional for Tall grass for example but for entities they do not have a optional param for harvesting (guessing). so I would need to ad a optional param to force it to determine which tool you used to skin the creature or add a default. 

Edited by Micah Holmes
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.