{
	code: "pig",
	class: "EntityAgent",
	tags: ["animal", "huntable", "habitat-land"],
	weight: 1,
	variantgroups:  [ 
		{ code: "type", states: ["eurasian","redriver","warthog"]},
		{ code: "age", states: ["baby"] },
		{ code: "gender", states: ["male", "female"] },
	] ,
	hitboxSize: { x: 0.6, y: 0.5 },
	deadHitboxSize: { x: 0.6, y: 0.25 },
	eyeHeight: 0.4,
	attributes: {
		creatureDiet: {
			foodCategories: ["Grain", "Fruit", "Vegetable", "Protein"],
			weightedFoodTags: [
				{ weight: 0.7, code: "grain" }, 
				{ weight: 0.9, code: "fruitmash" },
				{ weight: 0.9, code: "fruit" },
				{ weight: 1, code: "tastyvegetable" },
				{ weight: 1, code: "nibbleCrop" },
				{ weight: 0.2, code: "cassava" }
			],
			skipFoodTags: ["rice", "parsnip"]
		},
		trappable: {
			"small": { trapChance: 0.5,	trapDestroyChance: 0.05 }
		},
		handbook: {
			groupcode: "creaturegroup-pig",
			trappableGroupCode: "creaturegroup-pig-{type}-{age}"
		}
	},
	drops: [],
	client: {
		renderer: "Shape",
		shape: { base: "entity/animal/mammal/hooved/pig/eurasian/baby" },
		textureByType: {
			"*-redriver-baby-*": { base: "entity/animal/mammal/hooved/pig/eurasian-baby" },
			"*-warthog-baby-*": { base: "entity/animal/mammal/hooved/pig/warthog-baby" }
		},
		size: 0.9,
		sizeGrowthFactor: 0.33,
		behaviors: [
			{ code: "repulseagents" }, 
			{ code: "controlledphysics", stepHeight: 1.1251 }, 
			{ code: "floatupwhenstuck", onlyWhenDead: true },
			{ code: "interpolateposition" },
			{ code: "harvestable" },
			{ code: "despawn", minPlayerDistance: 8, belowLightLevel: 8, minSeconds: 300 },
			{ code: "ropetieable", minGeneration: 2 }
		],
		animations: [
			{
				code: "hurt",
				animation: "hurt", 
				animationSpeed: 1.5,
				weight: 10,
				blendMode: "AddAverage" 
			},
			{
				code: "die",
				animation: "die", 
				animationSpeed: 1,
				weight: 10,
				blendMode: "Average",
				triggeredBy: { onControls: ["dead"] }
			},
			{ 
				code: "idle", 
				animation: "idle",
				blendMode: "AddAverage",
				easeOutSpeed: 4,
				triggeredBy: { defaultAnim: true },
			},
			{
				code: "sleep", 
				animation: "sleep",
				easeInSpeed: 4,
				easeOutSpeed: 4,
				supressDefaultAnimation: true,
				blendMode: "Average", 
			},
			{
				code: "sit", 
				animation: "sit",
				easeInSpeed: 4,
				easeOutSpeed: 4,
				supressDefaultAnimation: true,
				blendMode: "Average", 
			}
		]
	},
	server: {
		behaviors: [
			{ code: "repulseagents" }, 
			{ code: "controlledphysics", stepHeight: 1.1251 },
			{ code: "health", currenthealth: 7, maxhealth: 7, },
			{ code: "deaddecay", hoursToDecay: 96, decayedBlock: "carcass-small" },
			{ code: "floatupwhenstuck", onlyWhenDead: true },
			{ code: "despawn", minPlayerDistance: 8, belowLightLevel: 8, minSeconds: 300 },
			{ code: "harvestable", drops: [
				{
					type: "item", 
					code: "redmeat-raw", 
					quantity: { avg: 1.5, var: 0 } 
				},
				{
					type: "item", 
					code: "hide-raw-small", 
					quantity: { avg: 1, var: 0 } 
				}
				]
			},
			{ code: "breathe" }, 
			{ 
				code: "emotionstates",
				states: [
					{ code: "alarmherdondamage", chance: 1, slot: 1, priority: 1, accumType: "max" }
				],
			},
			{ 
				code: "grow",
				hoursToGrow: 168,
				adultEntityCodes: ["pig-{type}-adult-{gender}"],
			},
			{ 
				code: "taskai",
				aiCreatureType: "LandCreature",
				aitasks: [
					{
						code: "fleeentity",
						instafleeOnDamageChance: 1,
						entityCodes: ["player", "bear-*", "wolf-*"],
						priority: 1.5,
						movespeed: 0.015,
						seekingRange: 10,
						animationSpeed: 1.5,
						animation: "Run",
						sound: "creature/pig/piglet-hurt"
					},
					{
						code: "followleadholder",
						minGeneration: 2,
						priority: 1.45,
						animation: "Trot",
						animationSpeed: 1,
						movespeed: 0.003
					},
					{
						code: "seekfoodandeat",
						priority: 1.35,
						eatSound: "creature/animal-eat-small",
						eatTime: 1.5,
						movespeed: 0.0065,
						animation: "Walk",
						mincooldownHours: 1,
						maxcooldownHours: 4,
					},
					{
						code: "getoutofwater",
						priority: 1.4,
						movespeed: 0.005,
						animation: "Swim",
						animationSpeed: 1
					},
					{
						code: "stayclosetoentity",
						priority: 1.4,
						entityCode: "pig-{type}-adult-female",
						movespeed: 0.003,
						maxDistance: 5,
						searchRange: 25,
						animation: "Trot",
						animationSpeed: 1.5
					},
					{
						code: "idle",
						priority: 1.35,
						minduration: 200000,
						maxduration: 800000,
						mincooldown: 10000,
						maxcooldown: 30000,
						priorityForCancel: 1.35,
						animation: "Sleep",
						whenNotInEmotionState: "aggressiveondamage",
						duringDayTimeFrames: [ { fromHour: 4, toHour: 15 } ],
						stopOnNearbyEntityCodes: ["player"],
						stopRange: 6,
						stopOnHurt: true
					},
					{
						code: "idle",
						priority: 1.1,
						priorityForCancel: 1.35,
						minduration: 4166,
						maxduration: 4166,
						mincooldown: 80000,
						maxcooldown: 220000,
						animation: "Sit"
					},
					{
						code: "idle",
						priority: 1.1,
						priorityForCancel: 1.35,
						minduration: 4166,
						maxduration: 4166,
						mincooldown: 80000,
						maxcooldown: 220000,
						animation: "Lie"
					},					
					{
						code: "wander", 
						priority: 1.0, 
						priorityForCancel: 1.35,
						movespeed: 0.001,
						animationSpeed: 1.5,
						animation: "Walk",
						preferredLightLevel: 20
					},
					{
						code: "idle",
						priority: 0.8,
						priorityForCancel: 1.35,
						minduration: 5000,
						maxduration: 15000,
						mincooldown: 2000,
						maxcooldown: 120000,
						animation: "Sit",
						animationSpeed: 1.0
					},
					{ 
						code: "lookaround", 
						priority: 0.5
					}
				]
			},
			{ code: "ropetieable", minGeneration: 2 },
			{ code: "pettable", minGeneration: 0 },
			{ code: "entitystatetags" }
		]
	},
	sounds: {
		hurt: "creature/pig/piglet-hurt",
		death: "creature/pig/piglet-hurt",
		idle: { path: "creature/pig/piglet-idle", pitch: { avg: 1, var: 0.25 } }
	},
	idleSoundChance: 0.01
}
