export const blockEggBreakTypes = {
	"megaverse:parasaurolophus_egg": {
		sound: "block.turtle_egg.break",
		amountCount: {
			type: "integer",
			state: "megaverse:amount",
			min: 0
		},
		crackedState: {
			type: "string",
			state: "megaverse:cracked_state",
			values: [ "no_cracks", "cracked", "max_cracked" ]
		}
	},
	"megaverse:dusksand_dracon_egg": {
		sound: "block.turtle_egg.break",
		amountCount: {
			type: "string",
			state: "megaverse:egg_count",
			values: [ "one_egg", "two_egg", "three_egg", "four_egg" ]
		},
		crackedState: {
			type: "string",
			state: "megaverse:cracked_state",
			values: [ "no_cracks", "cracked", "max_cracked" ]
		}
	},
	"megaverse:pineclaw_dracon_egg": {
		sound: "block.turtle_egg.break",
		amountCount: {
			type: "string",
			state: "megaverse:egg_count",
			values: [ "one_egg", "two_egg", "three_egg", "four_egg" ]
		},
		crackedState: {
			type: "string",
			state: "megaverse:cracked_state",
			values: [ "no_cracks", "cracked", "max_cracked" ]
		}
	},
	"megaverse:sunscale_dracon_egg": {
		sound: "block.turtle_egg.break",
		amountCount: {
			type: "string",
			state: "megaverse:egg_count",
			values: [ "one_egg", "two_egg", "three_egg", "four_egg" ]
		},
		crackedState: {
			type: "string",
			state: "megaverse:cracked_state",
			values: [ "no_cracks", "cracked", "max_cracked" ]
		}
	},
	"megaverse:veilshade_dracon_egg": {
		sound: "block.turtle_egg.break",
		amountCount: {
			type: "string",
			state: "megaverse:egg_count",
			values: [ "one_egg", "two_egg", "three_egg", "four_egg" ]
		},
		crackedState: {
			type: "string",
			state: "megaverse:cracked_state",
			values: [ "no_cracks", "cracked", "max_cracked" ]
		}
	}
};
export const blockEggFallOnTypes = {
	"megaverse:parasaurolophus_egg": {
		breakInto: "minecraft:air",
		breakDenominator: 3,
		count: {
			type: "integer",
			state: "megaverse:amount",
			min: 0
		},
		breakParticle: "megaverse:parasaurolophus_egg_breaking",
		crackSound: "fall.egg",
		breakSound: "block.turtle_egg.break"
	},
	"megaverse:dusksand_dracon_egg": {
		breakInto: "minecraft:air",
		breakDenominator: 3,
		count: {
			type: "string",
			state: "megaverse:egg_count",
			values: [ "one_egg", "two_egg", "three_egg", "four_egg" ]
		},
		breakParticle: "megaverse:frosted_gravel",
		crackSound: "fall.egg",
		breakSound: "block.turtle_egg.break"
	},
	"megaverse:pineclaw_dracon_egg": {
		breakInto: "minecraft:air",
		breakDenominator: 3,
		count: {
			type: "string",
			state: "megaverse:egg_count",
			values: [ "one_egg", "two_egg", "three_egg", "four_egg" ]
		},
		breakParticle: "megaverse:frosted_gravel",
		crackSound: "fall.egg",
		breakSound: "block.turtle_egg.break"
	},
	"megaverse:sunscale_dracon_egg": {
		breakInto: "minecraft:air",
		breakDenominator: 3,
		count: {
			type: "string",
			state: "megaverse:egg_count",
			values: [ "one_egg", "two_egg", "three_egg", "four_egg" ]
		},
		breakParticle: "megaverse:frosted_gravel",
		crackSound: "fall.egg",
		breakSound: "block.turtle_egg.break"
	},
	"megaverse:veilshade_dracon_egg": {
		breakInto: "minecraft:air",
		breakDenominator: 3,
		count: {
			type: "string",
			state: "megaverse:egg_count",
			values: [ "one_egg", "two_egg", "three_egg", "four_egg" ]
		},
		breakParticle: "megaverse:frosted_gravel",
		crackSound: "fall.egg",
		breakSound: "block.turtle_egg.break"
	}
};
export const blockEggHatchTypes = {
	"megaverse:parasaurolophus_egg": {
		check: (block,face,array)=>{
			const b = block.dimension.getBlock(block.below(1));
			return b.typeId=="minecraft:hay_block"||b.hasTag("megaverse:compact_plant_blocks")||b.hasTag("dirt")||b.hasTag("grass");
		},
		entity: "megaverse:parasaurolophus",
		entitySpawnAt: (block)=>block.center(),
		event: "minecraft:entity_born",
		addEvents: { value: false },
		count: 1,
		addCount: {
			boolean: true,
			state: "megaverse:amount"
		},
		hatching: {
			type: "string",
			state: "megaverse:cracked_state",
			values: [ "no_cracks", "cracked", "max_cracked" ]
		},
		blockTurnsInto: "minecraft:air",
		crackSound: "block.sniffer_egg.crack",
		crackParticle: "minecraft:crop_growth_emitter",
		hatchSound: "block.sniffer_egg.hatch",
		hatchParticle: "megaverse:parasaurolophus_egg_breaking"
	},
	"megaverse:dusksand_dracon_egg": {
		check: (block,face,array)=>{
			const b = block.dimension.getBlock(block.below(1));
			return b.typeId=="minecraft:hay_block"||b.hasTag("megaverse:compact_plant_blocks");
		},
		entity: "megaverse:dracon",
		entitySpawnAt: (block)=>block.center(),
		entitySpawnBlockState: { boolean: false },
		event: "minecraft:on_hatch_dusksand_dracon",
		addEvents: { value: false },
		count: 1,
		addCount: {
			boolean: true,
			type: "string",
			state: "megaverse:egg_count",
			values: [ "one_egg", "two_egg", "three_egg", "four_egg" ]
		},
		hatching: {
			type: "string",
			state: "megaverse:cracked_state",
			values: [ "no_cracks", "cracked", "max_cracked" ]
		},
		blockTurnsInto: "minecraft:air",
		crackSound: "block.sniffer_egg.crack",
		crackParticle: "minecraft:crop_growth_emitter",
		hatchSound: "block.sniffer_egg.hatch",
		hatchParticle: "megaverse:frosted_gravel"
	},
	"megaverse:pineclaw_dracon_egg": {
		check: (block,face,array)=>{
			const b = block.dimension.getBlock(block.below(1));
			return b.typeId=="minecraft:hay_block"||b.hasTag("megaverse:compact_plant_blocks");
		},
		entity: "megaverse:dracon",
		entitySpawnAt: (block)=>block.center(),
		entitySpawnBlockState: { boolean: false },
		event: "minecraft:on_hatch_pineclaw_dracon",
		addEvents: { value: false },
		count: 1,
		addCount: {
			boolean: true,
			type: "string",
			state: "megaverse:egg_count",
			values: [ "one_egg", "two_egg", "three_egg", "four_egg" ]
		},
		hatching: {
			type: "string",
			state: "megaverse:cracked_state",
			values: [ "no_cracks", "cracked", "max_cracked" ]
		},
		blockTurnsInto: "minecraft:air",
		crackSound: "block.sniffer_egg.crack",
		crackParticle: "minecraft:crop_growth_emitter",
		hatchSound: "block.sniffer_egg.hatch",
		hatchParticle: "megaverse:frosted_gravel"
	},
	"megaverse:sunscale_dracon_egg": {
		check: (block,face,array)=>{
			const b = block.dimension.getBlock(block.below(1));
			return b.typeId=="minecraft:hay_block"||b.hasTag("megaverse:compact_plant_blocks");
		},
		entity: "megaverse:dracon",
		entitySpawnAt: (block)=>block.center(),
		entitySpawnBlockState: { boolean: false },
		event: "minecraft:on_hatch_sunscale_dracon",
		addEvents: { value: false },
		count: 1,
		addCount: {
			boolean: true,
			type: "string",
			state: "megaverse:egg_count",
			values: [ "one_egg", "two_egg", "three_egg", "four_egg" ]
		},
		hatching: {
			type: "string",
			state: "megaverse:cracked_state",
			values: [ "no_cracks", "cracked", "max_cracked" ]
		},
		blockTurnsInto: "minecraft:air",
		crackSound: "block.sniffer_egg.crack",
		crackParticle: "minecraft:crop_growth_emitter",
		hatchSound: "block.sniffer_egg.hatch",
		hatchParticle: "megaverse:frosted_gravel"
	},
	"megaverse:veilshade_dracon_egg": {
		check: (block,face,array)=>{
			const b = block.dimension.getBlock(block.below(1));
			return b.typeId=="minecraft:hay_block"||b.hasTag("megaverse:compact_plant_blocks");
		},
		entity: "megaverse:dracon",
		entitySpawnAt: (block)=>block.center(),
		entitySpawnBlockState: { boolean: false },
		event: "minecraft:on_hatch_veilshade_dracon",
		addEvents: { value: false },
		count: 1,
		addCount: {
			boolean: true,
			type: "string",
			state: "megaverse:egg_count",
			values: [ "one_egg", "two_egg", "three_egg", "four_egg" ]
		},
		hatching: {
			type: "string",
			state: "megaverse:cracked_state",
			values: [ "no_cracks", "cracked", "max_cracked" ]
		},
		blockTurnsInto: "minecraft:air",
		crackSound: "block.sniffer_egg.crack",
		crackParticle: "minecraft:crop_growth_emitter",
		hatchSound: "block.sniffer_egg.hatch",
		hatchParticle: "megaverse:frosted_gravel"
	},
	"megaverse:silkworm_cocoon": {
		check: (block,face,array)=>{
			let position, opening;
			switch (face) {
				case "down": position = block.above(1); opening = block.below(1); break;
				case "up": position = block.below(1); opening = block.above(1); break;
				case "north": position = block.south(1); opening = block.north(1); break;
				case "south": position = block.north(1); opening = block.south(1); break;
				case "west": position = block.east(1); opening = block.west(1); break;
				case "east": position = block.west(1); opening = block.east(1); break;
				default: return false;
			}
			const a = block.dimension.getBlock(position);
			const b = block.dimension.getBlock(opening);
			return !a.isAir&&b.isAir&&!block.isWaterlogged&&!array.silkwormCocoonDenyBlocks.includes(a.typeId);
		},
		entity: "megaverse:silkmoth",
		entitySpawnAt: (block)=>block.center(),
		entitySpawnBlockFace: "minecraft:block_face",
		entitySpawnUsingBlockFace: (block,permutation,state)=>{
			const face = permutation.getState(state);
			let pos;
			switch (face) {
				case "down": pos = {x:block.center().x,y:block.center().y-0.5,z:block.center().z}; break;
				case "up": pos = {x:block.center().x,y:block.center().y+0.5,z:block.center().z}; break;
				case "north": pos = {x:block.center().x,y:block.center().y,z:block.center().z-0.5}; break;
				case "south": pos = {x:block.center().x,y:block.center().y,z:block.center().z+0.5}; break;
				case "west": pos = {x:block.center().x-0.5,y:block.center().y,z:block.center().z}; break;
				case "east": pos = {x:block.center().x+0.5,y:block.center().y,z:block.center().z}; break;
				default: return pos = block.center();
			}
			return pos;
		},
		event: "minecraft:entity_transformed",
		addEvents: { value: false },
		count: 1,
		addCount: { boolean: false },
		hatching: {
			type: "string",
			state: "megaverse:cracked_state",
			values: [ "no_cracks", "cracked", "max_cracked" ]
		},
		blockTurnsInto: "megaverse:empty_silkworm_cocoon",
		blockTurnsWithBlockFace: "minecraft:block_face",
		blockIntoBlockFaceState: (permutation,state)=>{
			const face = permutation.getState(state);
			return face;
		},
		crackSound: "break.web",
		crackParticle: "megaverse:silkworm_cocoon_silking",
		hatchSound: "hatch.frog_spawn",
		hatchParticle: "megaverse:silkworm_cocoon_silking"
	},
	"megaverse:silkworm_egg_cluster": {
		check: (block,face,array)=>{
			let pos;
			switch (face) {
				case "down": pos = block.above(1); break;
				case "up": pos = block.below(1); break;
				case "north": pos = block.south(1); break;
				case "south": pos = block.north(1); break;
				case "west": pos = block.east(1); break;
				case "east": pos = block.west(1); break;
				default: return false;
			}
			const b = block.dimension.getBlock(pos);
			return b.typeId=="megaverse:mulberry_leaves"||b.typeId=="megaverse:fruiting_mulberry_leaves";
		},
		entity: "megaverse:silkworm",
		entitySpawnAt: (block)=>block.center(),
		event: "minecraft:entity_born",
		addEvents: { value: false },
		count: (mathUtilities)=>mathUtilities.randomInteger(2,6),
		addCount: { boolean: false },
		hatching: {
			type: "integer",
			state: "megaverse:growth",
			max: 4
		},
		blockTurnsInto: "minecraft:air",
		crackSound: "break.frog_spawn",
		crackParticle: "megaverse:frosted_gravel",
		hatchSound: "hatch.frog_spawn",
		hatchParticle: "megaverse:frosted_gravel"
	}
};
export const blockEggInteractTypes = {
	"megaverse:parasaurolophus_egg": {
		sound: "dig.bone_block",
		interaction: {
			type: "integer",
			state: "megaverse:amount",
			max: 3
		}
	},
	"megaverse:dusksand_dracon_egg": {
		sound: "dig.bone_block",
		particle: "minecraft:crop_growth_emitter",
		interaction: {
			type: "string",
			state: "megaverse:egg_count",
			values: [ "one_egg", "two_egg", "three_egg", "four_egg" ]
		}
	},
	"megaverse:pineclaw_dracon_egg": {
		sound: "dig.bone_block",
		particle: "minecraft:crop_growth_emitter",
		interaction: {
			type: "string",
			state: "megaverse:egg_count",
			values: [ "one_egg", "two_egg", "three_egg", "four_egg" ]
		}
	},
	"megaverse:sunscale_dracon_egg": {
		sound: "dig.bone_block",
		particle: "minecraft:crop_growth_emitter",
		interaction: {
			type: "string",
			state: "megaverse:egg_count",
			values: [ "one_egg", "two_egg", "three_egg", "four_egg" ]
		}
	},
	"megaverse:veilshade_dracon_egg": {
		sound: "dig.bone_block",
		particle: "minecraft:crop_growth_emitter",
		interaction: {
			type: "string",
			state: "megaverse:egg_count",
			values: [ "one_egg", "two_egg", "three_egg", "four_egg" ]
		}
	}
};
export const blockSlabUseOnBlocks = [
	{
		matches: id=>id=="megaverse:great_velanidia_slab"||id=="megaverse:mulberry_slab"||id=="megaverse:burnt_slab",
		sound: "dig.wood",
		pitch: 0.8
	},
	{
		matches: id=>id=="megaverse:smooth_golden_marble_slab"||id=="megaverse:smooth_marble_slab"||id=="megaverse:smooth_rose_marble_slab",
		sound: "place.deepslate"
	},
	{
		matches: id=>id=="megaverse:polished_golden_marble_slab"||id=="megaverse:polished_marble_slab"||id=="megaverse:polished_rose_marble_slab",
		sound: "place.deepslate_bricks"
	},
	{
		matches: id=>id.endsWith("_slab")
	}
];
export const blockSlabNoRequiredTool = [
	"megaverse:mulberry_double_slab",
	"megaverse:burnt_double_slab"
];
export const blockTrapCoverTypes = [
	"megaverse:grass_trap_cover",
	"megaverse:leaf_trap_cover",
	"megaverse:moss_trap_cover"
];
export const blockChiseledTypes = {
	"minecraft:cobbled_deepslate": "minecraft:chiseled_deepslate",
	"minecraft:copper_block": "minecraft:chiseled_copper",
	"minecraft:exposed_copper": "minecraft:exposed_chiseled_copper",
	"minecraft:infested_stone_bricks": "minecraft:infested_chiseled_stone_bricks",
	"minecraft:nether_brick": "minecraft:chiseled_nether_bricks",
	"minecraft:oxidized_copper": "minecraft:oxidized_chiseled_copper",
	"minecraft:polished_blackstone": "minecraft:chiseled_polished_blackstone",
	"minecraft:quartz_block": "minecraft:chiseled_quartz_block",
	"minecraft:red_sandstone": "minecraft:chiseled_red_sandstone",
	"minecraft:resin_bricks": "minecraft:chiseled_resin_bricks",
	"minecraft:sandstone": "minecraft:chiseled_sandstone",
	"minecraft:stone_bricks": "minecraft:chiseled_stone_bricks",
	"minecraft:tuff": "minecraft:chiseled_tuff",
	"minecraft:tuff_bricks": "minecraft:chiseled_tuff_bricks",
	"minecraft:waxed_copper": "minecraft:waxed_chiseled_copper",
	"minecraft:waxed_exposed_copper": "minecraft:waxed_exposed_chiseled_copper",
	"minecraft:waxed_oxidized_copper": "minecraft:waxed_oxidized_chiseled_copper",
	"minecraft:waxed_weathered_copper": "minecraft:waxed_weathered_chiseled_copper",
	"minecraft:weathered_copper": "minecraft:weathered_chiseled_copper",
	"megaverse:frosted_sandstone": "megaverse:frosted_chiseled_sandstone",
	"megaverse:frosted_stone_bricks": "megaverse:frosted_chiseled_stone_bricks",
	"megaverse:glaciered_sandstone": "megaverse:glaciered_chiseled_sandstone",
	"megaverse:glaciered_stone_bricks": "megaverse:glaciered_chiseled_stone_bricks",
	"megaverse:polished_golden_marble": "megaverse:chiseled_polished_golden_marble",
	"megaverse:polished_marble": "megaverse:chiseled_polished_marble",
	"megaverse:polished_rose_marble": "megaverse:chiseled_polished_rose_marble"
};
export const blockWoodStrippedTypes = {
	"megaverse:burnt_log": {
		"blockTurnsInto": "megaverse:stripped_burnt_log",
		"blockTurnsWithBlockFace": "minecraft:block_face",
		"blockIntoBlockFaceState": (block,state)=>block.permutation.getState(state)
	},
	"megaverse:burnt_wood": {
		"blockTurnsInto": "megaverse:stripped_burnt_wood",
		"blockTurnsWithBlockFace": "minecraft:block_face",
		"blockIntoBlockFaceState": (block,state)=>block.permutation.getState(state)
	},
	"megaverse:great_velanidia_log": {
		"blockTurnsInto": "megaverse:stripped_great_velanidia_log",
		"blockTurnsWithBlockFace": "minecraft:block_face",
		"blockIntoBlockFaceState": (block,state)=>block.permutation.getState(state)
	},
	"megaverse:great_velanidia_wood": {
		"blockTurnsInto": "megaverse:stripped_great_velanidia_wood",
		"blockTurnsWithBlockFace": "minecraft:block_face",
		"blockIntoBlockFaceState": (block,state)=>block.permutation.getState(state)
	},
	"megaverse:mulberry_log": {
		"blockTurnsInto": "megaverse:stripped_mulberry_log",
		"blockTurnsWithBlockFace": "minecraft:block_face",
		"blockIntoBlockFaceState": (block,state)=>block.permutation.getState(state)
	},
	"megaverse:mulberry_wood": {
		"blockTurnsInto": "megaverse:stripped_mulberry_wood",
		"blockTurnsWithBlockFace": "minecraft:block_face",
		"blockIntoBlockFaceState": (block,state)=>block.permutation.getState(state)
	},
	"megaverse:smoldering_log": {
		"blockTurnsInto": "megaverse:stripped_smoldering_log",
		"blockTurnsWithBlockFace": "minecraft:block_face",
		"blockIntoBlockFaceState": (block,state)=>block.permutation.getState(state)
	},
	"megaverse:smoldering_wood": {
		"blockTurnsInto": "megaverse:stripped_smoldering_wood",
		"blockTurnsWithBlockFace": "minecraft:block_face",
		"blockIntoBlockFaceState": (block,state)=>block.permutation.getState(state)
	}
};
export const sconceParticleOffsets = {
	"up": {x:0.0,y:0.25,z:0.0},
	"down": {x:0.0,y:0.25,z:0.0},
	"north": {x:0.0,y:0.25,z:0.3},
	"south": {x:0.0,y:0.25,z:-0.3},
	"west": {x:0.3,y:0.25,z:0.0},
	"east": {x:-0.3,y:0.25,z:0.0}
};
export const silkwormCocoonDenyBlocks = [
	"minecraft:flowing_lava",
	"minecraft:flowing_water",
	"minecraft:lava",
	"minecraft:water",
	"megaverse:boiled_silkworm_cocoon",
	"megaverse:empty_silkworm_cocoon",
	"megaverse:silkworm_cocoon"
];
export const silkwormCocoonTypes = {
	"megaverse:silkworm_cocoon": {
		check: (block)=>{
			return block.isWaterlogged;
		},
		criteria: (block)=>{
			const directions = [
				block.below(1),
				block.above(1),
				block.north(1),
				block.south(1),
				block.west(1),
				block.east(1)
			];
			for (const pos of directions) {
				const b = block.dimension.getBlock(pos);
				if (b.typeId=="minecraft:magma") return true;
			}
			return false;
		},
		condition: {
			type: "bool",
			state: "megaverse:boiling"
		},
		addition: {
			type: "string",
			state: "megaverse:cracked_state",
			values: [ "no_cracks", "cracked", "max_cracked" ]
		},
		blockTurnsInto: "megaverse:boiled_silkworm_cocoon",
		blockTurnsWithBlockFace: "minecraft:block_face",
		blockIntoBlockFaceState: (permutation,state)=>{
			const face = permutation.getState(state);
			return face;
		},
		turnSound: "fall.honey_block",
		turnParticle: "megaverse:silkworm_cocoon_silking"
	}
};