import {world,system,BlockPermutation,ItemStack} from '@minecraft/server';
import {ActionFormData} from '@minecraft/server-ui';
import {foods,magicItems,magicWeapons,bossBlocks,layeredBlocks,enchantments,potions,projectiles,pickUpItems,grassTypes,ringItems,trinketItems,leaves,logTypes,fishingRod,buckets,fishTrapLoot,lootBox,msgInDaBottle,experienceTome,dropsFiber,ores} from '../config.js';
import {randomNumber,shootProjectile,enchantConfirmForm,lootTable,teleportToWorldSpawn,getAttributes,setAttributes} from '../utils.js';
import {cropManager} from '../classes/cropManager.js';
import { CakeCustomComponent } from '../classes/cakeManager.js';
import {redstoneManager,playOpenSound,playCloseSound} from '../classes/redstoneManager.js';

world.beforeEvents.worldInitialize.subscribe(event => {
	const {itemComponentRegistry,blockComponentRegistry} = event;
	itemComponentRegistry.registerCustomComponent('dlcraft:durability', {
		onHitEntity: data => {
			const {itemStack,attackingEntity} = data;
			if (itemStack.hasTag('minecraft:is_sword') || !itemStack) return;
			else itemStack.durabilityModifier(attackingEntity, 'Mainhand', 2);
		},
		onMineBlock: data => {
			const {itemStack,source: player} = data;
			if (!itemStack) return;
			if (itemStack.hasTag('minecraft:is_sword')) itemStack.durabilityModifier(player, 'Mainhand', 2);
			else itemStack.durabilityModifier(player, 'Mainhand', 1);
		}
	});
	itemComponentRegistry.registerCustomComponent('dlcraft:foods', {
		onConsume: data => {
			const {itemStack, source: player} = data;
			const rng = Math.floor(Math.random()*100);
			if (!itemStack) return;
			const foodEffects = foods[itemStack.typeId];
			if (!foodEffects) return;
			if (Array.isArray(foodEffects)) {
				foodEffects.forEach((effect) => {
					if(rng > effect.weight  && effect.weight) return;
					if (effect.removeEffects) effect.removeEffects.forEach(f => player.removeEffect(f));
					if (effect.typeId) player.addEffect(effect.typeId, effect.duration * 20, {amplifier: effect.amplifier ?? 0});
					if (effect.onConsume) effect.onConsume(player);
				});
			} else {
				if (rng > foodEffects.weight && foodEffects.weight) return;
				if (foodEffects.removeEffects) foodEffects.removeEffects.forEach(f => player.removeEffect(f));
				if (foodEffects.typeId) player.addEffect(foodEffects.typeId, foodEffects.duration * 20, {amplifier: foodEffects.amplifier ?? 0});
				if (foodEffects.onConsume) foodEffects.onConsume(player);
			}
		}
	});
	itemComponentRegistry.registerCustomComponent('dlcraft:magicItems', {
		onUse: data => {
			const {itemStack, source: player} = data;
			if (!itemStack) return;
			const {x: x1,y: y1,z: z1} = player.location;
			const items = magicItems[itemStack.typeId];
			if (!items) return;
			const headLoc = player.getHeadLocation();
			const viewDir = player.getViewDirection();
			const direction = { x: headLoc.x + viewDir.x, y: headLoc.y + viewDir.y, z: headLoc.z + viewDir.z };
			if (Array.isArray(items)) {
				items.forEach((comp) => {
					if (comp.projectile) {
						const proj = player.dimension.spawnEntity(comp.projectile, direction);
						const projectile = proj.getComponent("projectile");
						projectile.owner = player;
						const vel = { x: viewDir.x * comp.launch_power, y: viewDir.y * comp.launch_power, z: viewDir.z * comp.launch_power };
						projectile.shoot(vel);
					}
					if (comp.effect) player.addEffect(comp.effect, comp.duration * 20, {amplifier: comp.amplifier, showParticles: comp.show_particles ?? true});
					if (comp.onUse) comp.onUse(player);
					if (comp.particles) player.dimension.spawnParticle(comp.particles, player.location);
					if (comp.sound) player.dimension.playSound(comp.sound, player.location);
					if (comp.entity) {
						const e = player.dimension.getEntities({maxDistance: comp.radius}).find(entity => entity.typeId == comp.entity);
						if (e) e.triggerEvent(comp.event);
					}
					if (comp.summon) player.dimension.spawnEntity(comp.summon, {x: x1 + randomNumber(1, 5), y: y1 + randomNumber(1, 3), z: z1 + randomNumber(1, 5)});
					if (comp.decrementStack) itemStack.amountDecrease(player, 'Mainhand', comp.decrementStack);
					else if (comp.damage) itemStack.durabilityModifier(player, 'Mainhand', comp.damage);
					if (comp.transformItem) player.getComponent('equippable').setEquipment('Mainhand', new ItemStack(comp.transformItem));
					if (itemStack.getComponent('cooldown')) itemStack.getComponent('cooldown').startCooldown(player);
				});
			} else {
				if (items.projectile) {
					const proj = player.dimension.spawnEntity(items.projectile, direction);
					const projectile = proj.getComponent("projectile");
					projectile.owner = player;
					const vel = { x: viewDir.x * items.launch_power, y: viewDir.y * items.launch_power, z: viewDir.z * items.launch_power };
					projectile.shoot(vel);
				}
				if (items.effect) player.addEffect(items.effect, items.duration * 20, {amplifier: items.amplifier, showParticles: items.show_particles ?? true});
				if (items.onUse) items.onUse(player);
				if (items.particles) player.dimension.spawnParticle(items.particles, player.location);
				if (items.sound) player.dimension.playSound(items.sound, player.location);
				if (items.entity) {
					const e = player.dimension.getEntities({maxDistance: items.radius}).find(entity => entity.typeId == items.entity);
					if (e) e.triggerEvent(items.event);
				}
				if (items.summon) player.dimension.spawnEntity(items.summon, {x: x1 + randomNumber(1, 5), y: y1 + randomNumber(1, 3), z: z1 + randomNumber(1, 5)});
				if (items.decrementStack) itemStack.amountDecrease(player, 'Mainhand', items.decrementStack);
				else if (items.damage) itemStack.durabilityModifier(player, 'Mainhand', items.damage);
				if (items.transformItem) player.getComponent('equippable').setEquipment('Mainhand', new ItemStack(items.transformItem));
				if (itemStack.getComponent('cooldown')) itemStack.getComponent('cooldown').startCooldown(player);
			}
		}
	});
	itemComponentRegistry.registerCustomComponent('dlcraft:magicWeapons', {
		onUse: data => {
			const {itemStack, source: player} = data;
			if (!itemStack) return;
			const {x: x1,y: y1,z: z1} = player.location;
			const items = magicWeapons[itemStack.typeId];
			if (!items) return;
			const rng = Math.floor(Math.random()*100);
			const headLoc = player.getHeadLocation();
			const viewDir = player.getViewDirection();
			const direction = { x: headLoc.x + viewDir.x, y: headLoc.y + viewDir.y, z: headLoc.z + viewDir.z };
			if (Array.isArray(items)) {
				items.forEach((comp) => {
					if(rng > comp.weight  && comp.weight) return;
					if (comp.effect) player.addEffect(comp.effect, comp.duration * 20, {amplifier: comp.amplifier, showParticles: comp.show_particles ?? true});
					if (comp.onUse) comp.onUse(player);
					if (comp.particles) player.dimension.spawnParticle(comp.particles, player.location);
					if (comp.sound) player.dimension.playSound(comp.sound, player.location);
					if (comp.decrementStack) itemStack.amountDecrease(player, 'Mainhand', comp.decrementStack);
					else if (comp.damage) itemStack.durabilityModifier(player, 'Mainhand', comp.damage);
					if (comp.transformItem) player.getComponent('equippable').setEquipment('Mainhand', new ItemStack(comp.transformItem));
					if (itemStack.getComponent('cooldown')) itemStack.getComponent('cooldown').startCooldown(player);
				});
			} else {
				if(rng > items.weight  && items.weight) return;
				if (items.effect) player.addEffect(items.effect, items.duration * 20, {amplifier: items.amplifier, showParticles: items.show_particles ?? true});
				if (items.onUse) items.onUse(player);
				if (items.particles) player.dimension.spawnParticle(items.particles, player.location);
				if (items.sound) player.dimension.playSound(items.sound, player.location);
				if (items.decrementStack) itemStack.amountDecrease(player, 'Mainhand', items.decrementStack);
				else if (items.damage) itemStack.durabilityModifier(player, 'Mainhand', items.damage);
				if (items.transformItem) player.getComponent('equippable').setEquipment('Mainhand', new ItemStack(items.transformItem));
				if (itemStack.getComponent('cooldown')) itemStack.getComponent('cooldown').startCooldown(player);
			}
		}
	});
	itemComponentRegistry.registerCustomComponent('dlcraft:potions', {
		onConsume: data => {
			const {itemStack, source: player} = data;
			const rng = Math.floor(Math.random()*100);
			if (!itemStack) return;
			const potionEffects = potions[itemStack.typeId];
			if (!potionEffects) return;
			if (Array.isArray(potionEffects)) {
				potionEffects.forEach((effect) => {
					if (effect.removeEffects) effect.removeEffects.forEach(f => player.removeEffect(f));
					if (effect.typeId) player.addEffect(effect.typeId, effect.duration * 20, {amplifier: effect.amplifier ?? 0});
					if (effect.onConsume) effect.onConsume(player);
				});
			} else {
				if (potionEffects.removeEffects) potionEffects.removeEffects.forEach(f => player.removeEffect(f));
				if (potionEffects.typeId) player.addEffect(potionEffects.typeId, potionEffects.duration * 20, {amplifier: potionEffects.amplifier ?? 0});
				if (potionEffects.onConsume) potionEffects.onConsume(player);
			}
		}
	});
	itemComponentRegistry.registerCustomComponent('dlcraft:projectiles', {
		onUse: data => {
			const {itemStack, source: player} = data;
			if (!itemStack) return;
			const {x: x1,y: y1,z: z1} = player.location;
			const items = projectiles[itemStack.typeId];
			if (!items) return;
			const headLoc = player.getHeadLocation();
			const viewDir = player.getViewDirection();
			const direction = { x: headLoc.x + viewDir.x, y: headLoc.y + viewDir.y, z: headLoc.z + viewDir.z };
			if (Array.isArray(items)) {
				items.forEach((comp) => {
					if (comp.projectile) {
						const proj = player.dimension.spawnEntity(comp.projectile, direction);
						const projectile = proj.getComponent("projectile");
						projectile.owner = player;
						const vel = { x: viewDir.x * comp.launch_power, y: viewDir.y * comp.launch_power, z: viewDir.z * comp.launch_power };
						projectile.shoot(vel);
					}
					if (comp.effect) player.addEffect(comp.effect, comp.duration * 20, {amplifier: comp.amplifier, showParticles: comp.show_particles ?? true});
					if (comp.sound) player.dimension.playSound(comp.sound, player.location);
					if (comp.summon) player.dimension.spawnEntity(comp.summon, {x: x1 + randomNumber(1, 5), y: y1 + randomNumber(1, 3), z: z1 + randomNumber(1, 5)});
					if (comp.decrementStack) itemStack.amountDecrease(player, 'Mainhand', comp.decrementStack);
					if (comp.transformItem) player.getComponent('equippable').setEquipment('Mainhand', new ItemStack(comp.transformItem));
					if (itemStack.getComponent('cooldown')) itemStack.getComponent('cooldown').startCooldown(player);
				});
			} else {
				if (items.projectile) {
					const proj = player.dimension.spawnEntity(items.projectile, direction);
					const projectile = proj.getComponent("projectile");
					projectile.owner = player;
					const vel = { x: viewDir.x * items.launch_power, y: viewDir.y * items.launch_power, z: viewDir.z * items.launch_power };
					projectile.shoot(vel);
				}
				if (items.effect) player.addEffect(items.effect, items.duration * 20, {amplifier: items.amplifier, showParticles: items.show_particles ?? true});
				if (items.sound) player.dimension.playSound(items.sound, player.location);
				if (items.summon) player.dimension.spawnEntity(items.summon, {x: x1 + randomNumber(1, 5), y: y1 + randomNumber(1, 3), z: z1 + randomNumber(1, 5)});
				if (items.decrementStack) itemStack.amountDecrease(player, 'Mainhand', items.decrementStack);
				if (items.transformItem) player.getComponent('equippable').setEquipment('Mainhand', new ItemStack(items.transformItem));
				if (itemStack.getComponent('cooldown')) itemStack.getComponent('cooldown').startCooldown(player);
			}
		}
	});
	itemComponentRegistry.registerCustomComponent('knw:knowledgeTome', {
		onUse: data => {
			const {itemStack, source: player} = data;
			if (!itemStack) return;
			const vitality = player.getProperty('dlcraft:vitality');
			const husbandry = player.getDynamicProperty('Husbandry') ?? 0;
			const combat = player.getDynamicProperty('Combat') ?? 0;
			const defense = player.getDynamicProperty('Defense') ?? 0;
			const mining = player.getDynamicProperty('Mining') ?? 0;
			const ender = player.getDynamicProperty('Ender') ?? 0;
			const weaponry = player.getDynamicProperty('Weaponry') ?? 0;
			const form = new ActionFormData()
			.title('Skill Book')
			.body('Choose the skill to upgrade')
			.button(`Vitality Skill: ${vitality}`)
			.button(`Husbandry Skill: ${husbandry}`)
			.button(`Combat Skill: ${combat}`)
			.button(`Defense Skill: ${defense}`)
			.button(`Mining Skill: ${mining}`)
			.button(`Ender Skill: ${ender}`)
			.button(`Weaponry Skill: ${weaponry}`);
			form.show(player).then((response) => {
				switch (response.selection) {
					case 0:
						player.skillUp('Vitality');
						break;
					case 1:
						player.skillUp('Husbandry');
						break;
					case 2:
						player.skillUp('Combat');
						break;
					case 3:
						player.skillUp('Defense');
						break;
					case 4:
						player.skillUp('Mining');
						break;
					case 5:
						player.skillUp('Ender');
						break;
					case 6:
						player.skillUp('Weaponry');
						break;
					default: break;
				}
			});
		}
	});
	itemComponentRegistry.registerCustomComponent('rng:rings', {
		onUse: data => {
			const {itemStack, source: player} = data;
			if (!itemStack) return;
			const items = ringItems[itemStack.typeId];
			if (!items) return;
			if (items.removeTags && Array.isArray(items.removeTags)) {
				items.removeTags.forEach(tag => {
					player.removeTag(tag);
				});
			}
			if (items.removeTags && !Array.isArray(items.removeTags)) {
				player.removeTag(items.removeTags);
			}
			if (items.addTag) {
				player.addTag(items.addTag);
			}
			if (items.replaceItem) {
				player.getComponent('equippable').setEquipment('Mainhand', new ItemStack(items.replaceItem));
			}
		}
	});
	itemComponentRegistry.registerCustomComponent('whs:whistle', {
		onUse: data => {
			const {itemStack,source: player} = data;
			if (itemStack.getDynamicProperty('whs:entityId')) {
				player.dimension.playSound('random.whistle', player.location);
				const entity = player.dimension.getEntities().find(entity => entity.hasTag(`${player.name}_${itemStack.getDynamicProperty('whs:entityId')}`));
				if (itemStack.getComponent('cooldown')) itemStack.getComponent('cooldown').startCooldown(player);
				try {entity.teleport(player.location,{checkForBlocks:true})} catch (e) {world.sendMessage(`§r§7Your mount is far away.`)};
			}
		}
	});
	itemComponentRegistry.registerCustomComponent('trr:trinkets', {
		onUse: data => {
			const {itemStack, source: player} = data;
			if (!itemStack) return;
			const items = trinketItems[itemStack.typeId];
			if (!items) return;
			if (items.removeTags && Array.isArray(items.removeTags)) {
				items.removeTags.forEach(tag => {
					player.removeTag(tag);
				});
			}
			if (items.removeTags && !Array.isArray(items.removeTags)) {
				player.removeTag(items.removeTags);
			}
			if (items.addTag) {
				player.addTag(items.addTag);
			}
			if (items.replaceItem) {
				player.getComponent('equippable').setEquipment('Mainhand', new ItemStack(items.replaceItem));
			}
		}
	});
	itemComponentRegistry.registerCustomComponent('trr:whoopieCushion', {
		onUse: data => {
			const {itemStack,source:player} = data;
			const randomWeight = Math.floor(Math.random()*100);
			if (randomWeight <= 75) {
				player.dimension.playSound('random.fart_small', player.location);
			} else player.dimension.playSound('random.fart_big', player.location);
			if (itemStack.getComponent('cooldown')) itemStack.getComponent('cooldown').startCooldown(player);
		}
	});
	itemComponentRegistry.registerCustomComponent('skl:trumpet', {
		onUse: data => {
			const {itemStack,source:player} = data;
			player.dimension.playSound('random.doot', player.location);
			if (itemStack.getComponent('cooldown')) itemStack.getComponent('cooldown').startCooldown(player);
		}
	});
	itemComponentRegistry.registerCustomComponent('ins:heartbeet', {
		onConsume: data => {
			const {source: player} = data;
			player.addEffect('regeneration', 5*20);
		}
	});
	itemComponentRegistry.registerCustomComponent('ins:crook', {
		onMineBlock: data => {
			const {minedBlockPermutation,block,itemStack,source: player} = data;
			const {x,y,z} = block.location;
			if (leaves.includes(minedBlockPermutation.type.id)) {
				console.log('what\'up')
				const lootSpawn = 'blocks/crook_leaves';
				player.runCommandAsync(`loot spawn ${x} ${y} ${z} loot "${lootSpawn}"`);
			}
			itemStack.durabilityModifier(player, 'Mainhand', 2);
		}
	});
	itemComponentRegistry.registerCustomComponent('str:fire_starter', {
		onCompleteUse: data => {
			const {source: player,itemStack} = data;
			const fireStarterFireStartChance = Math.random()*100
			const raycast = player.getBlockFromViewDirection({maxDistance: 12})
			if (!raycast) return;
			const raycastBlock = raycast.block
			// To set block as fire with Fire Starter
			if (fireStarterFireStartChance <= 50) {
				raycastBlock.permutation.matches('minecraft:campfire', {'extinguished': true}) ? raycastBlock.setPermutation(raycastBlock.permutation.withState('extinguished', false)) : raycastBlock.permutation.matches('minecraft:soul_campfire', {'extinguished': true}) ? raycastBlock.setPermutation(raycastBlock.permutation.withState('extinguished', false)) : player.runCommand(`setblock ${raycastBlock.x} ${raycastBlock.y+1} ${raycastBlock.z} fire keep`);
			}
			itemStack.durabilityModifier(player, 'Mainhand');
		}
	});
	itemComponentRegistry.registerCustomComponent('str:knife', {
		onMineBlock: data => {
			const {minedBlockPermutation,block,source: player} = data;
			const tallGrassDropGrassFiberChance = Math.floor(Math.random()*100);
			const brokenBlock = dropsFiber.includes(minedBlockPermutation.type.id);
			// To drop Grass Fiber when tallgrass are broken with Knife
			if (brokenBlock) lootTable(block, player, 'blocks/fiber_grass');
			else if (minedBlockPermutation.type.id == 'minecraft:vine') lootTable(block, player, 'blocks/fiber_vine');
		}
	});
	itemComponentRegistry.registerCustomComponent('happy:recallPotion', {
		onConsume: data => {
			const {itemStack, source: player} = data;
			const {x,y,z} = player.location;
			let spawn = player.getSpawnPoint();
			if (spawn) {
				system.runTimeout(() => {
					player.dimension.spawnParticle('happy:magic_mirror_particle_0', {x: x, y: y+1, z: z});
					player.dimension.spawnParticle('happy:magic_mirror_particle_1', {x: x, y: y+1, z: z});
					player.dimension.spawnParticle('happy:magic_mirror_particle_2', {x: x, y: y+1, z: z});
					player.dimension.playSound('random.magic_mirror_use', player.location);
					player.teleport({x: spawn.x, y: spawn.y, z: spawn.z}, {dimension: spawn.dimension, checkForBlocks: true});
					player.dimension.spawnParticle('happy:magic_mirror_particle_0', {x: x, y: y+1, z: z});
					player.dimension.spawnParticle('happy:magic_mirror_particle_1', {x: x, y: y+1, z: z});
					player.dimension.spawnParticle('happy:magic_mirror_particle_2', {x: x, y: y+1, z: z});
				}, 1);
			} else {
				spawn = world.getDefaultSpawnLocation();
				system.runTimeout(() => {
					player.dimension.spawnParticle('happy:magic_mirror_particle_0', {x: x, y: y+1, z: z});
					player.dimension.spawnParticle('happy:magic_mirror_particle_1', {x: x, y: y+1, z: z});
					player.dimension.spawnParticle('happy:magic_mirror_particle_2', {x: x, y: y+1, z: z});
					player.dimension.playSound('random.magic_mirror_use', player.location);
					teleportToWorldSpawn(player, world);
				}, 1);
			}
		}
	});
	itemComponentRegistry.registerCustomComponent('happy:magicMirrors', {
		onUse: data => {
			const {itemStack,source: player} = data;
			const {x,y,z} = player.location;
			const xpNeeded = Number(itemStack.getTags().find(tag => tag.startsWith('xp_use:')).slice(7));
			if (xpNeeded == 0 && (id == "happy:magic_mirror" || id == "happy:ice_mirror" )) xpNeeded = 1;
			if (player.level < xpNeeded) return player.onScreenDisplay.setActionBar(`§4Required ${xpNeeded} XP Level`);
			player.addLevels(-(xpNeeded))
			var spawn = player.getSpawnPoint();
			if (spawn) {
				player.dimension.spawnParticle('happy:magic_mirror_particle_0', {x: x, y: y+1, z: z});
				player.dimension.spawnParticle('happy:magic_mirror_particle_1', {x: x, y: y+1, z: z});
				player.dimension.spawnParticle('happy:magic_mirror_particle_2', {x: x, y: y+1, z: z});
				player.dimension.playSound('random.magic_mirror_use', player.location);
				system.runTimeout(() => {
					player.teleport({x: spawn.x, y: spawn.y, z: spawn.z}, {dimension: spawn.dimension, checkForBlocks: true});
					player.dimension.spawnParticle('happy:magic_mirror_particle_0', {x: x, y: y+1, z: z});
					player.dimension.spawnParticle('happy:magic_mirror_particle_1', {x: x, y: y+1, z: z});
					player.dimension.spawnParticle('happy:magic_mirror_particle_2', {x: x, y: y+1, z: z});
				}, 1);
			} else {
				spawn = world.getDefaultSpawnLocation()
				player.dimension.spawnParticle('happy:magic_mirror_particle_0', {x: x, y: y+1, z: z});
				player.dimension.spawnParticle('happy:magic_mirror_particle_1', {x: x, y: y+1, z: z});
				player.dimension.spawnParticle('happy:magic_mirror_particle_2', {x: x, y: y+1, z: z});
				player.dimension.playSound('random.magic_mirror_use', player.location);
				system.runTimeout(() => {
					teleportToWorldSpawn(player, world);
				}, 1);
			}
		}
	});
	itemComponentRegistry.registerCustomComponent('ard:heal', {
		onUse: data => {
			const {itemStack,source: player} = data;
			itemStack.typeId == 'ard:enchanted_medkit' || itemStack.typeId == 'ard:medkit' ? player.getComponent('health').setCurrentValue(player.getComponent('health').currentValue + 5) : player.getComponent('health').setCurrentValue(player.getComponent('health').currentValue + 3);
			itemStack.typeId == 'ard:salve' ? player.playSound('random.drink_honey') : player.playSound('armor.equip_leather');
			itemStack.durabilityModifier(player, 'Mainhand');
		}
	});
	itemComponentRegistry.registerCustomComponent('ard:morphine', {
		onConsume: data => {
			const {source: player} = data;
			player.removeEffect('fatal_poison');
			player.removeEffect('instant_damage');
			player.removeEffect('mining_fatigue');
			player.removeEffect('nausea');
			player.removeEffect('poison');
			player.removeEffect('slowness');
			player.removeEffect('weakness');
			player.removeEffect('wither');
		}
	});
	itemComponentRegistry.registerCustomComponent('dlcraft:fishingRod', {
		onUse: data => {
			const {itemStack, source: player} = data;
			if (!itemStack) return;
			const items = fishingRod[itemStack.typeId];
			if (!items) return;
			const headLoc = player.getHeadLocation();
			const viewDir = player.getViewDirection();
			const direction = { x: headLoc.x + viewDir.x, y: headLoc.y + viewDir.y, z: headLoc.z + viewDir.z };
			if (Array.isArray(items)) {
				items.forEach((comp) => {
					if (comp.projectile) {
						const proj = player.dimension.spawnEntity(comp.projectile, direction);
						const projectile = proj.getComponent("projectile");
						projectile.owner = player;
						const vel = { x: viewDir.x * comp.launch_power, y: viewDir.y * comp.launch_power, z: viewDir.z * comp.launch_power };
						projectile.shoot(vel);
					}
					if (comp.damage) itemStack.durabilityModifier(player, 'Mainhand', comp.damage);
					if (comp.sound) player.dimension.playSound(comp.sound, player.location);
				});
			} else {
				if (items.projectile) {
					const proj = player.dimension.spawnEntity(items.projectile, direction);
					const projectile = proj.getComponent("projectile");
					projectile.owner = player;
					const vel = { x: viewDir.x * items.launch_power, y: viewDir.y * items.launch_power, z: viewDir.z * items.launch_power };
					projectile.shoot(vel);
				}
				if (items.damage) itemStack.durabilityModifier(player, 'Mainhand', items.damage);
				if (items.sound) player.dimension.playSound(items.sound, player.location);
			}
			if (itemStack.getComponent('cooldown')) itemStack.getComponent('cooldown').startCooldown(player);

		}
	});
	itemComponentRegistry.registerCustomComponent('azc:lootBox', {
		onUse: data => {
			const {itemStack,source:player} = data;
			const lootItem = lootBox[itemStack.typeId];
			if (!lootItem) return;
			let lootSound;
			switch (itemStack.typeId) {
				case 'azc:box':
					lootSound = 'dig.wood';
					break;
				case 'azc:lockbox':
					lootSound = 'block.lantern.break';
					break;
				case 'azc:treasure_chest':
					lootSound = 'random.chestopen';
					break;
			}
			player.dimension.playSound(lootSound, player.location);
			system.runTimeout(() => {
				player.dimension.spawnLoot(lootItem, player.location);
			}, 5);
			itemStack.amountDecrease(player, 'Mainhand');
		}
	});
	itemComponentRegistry.registerCustomComponent('azc:msgInDaBottle', {
		onUse: data => {
			const {itemStack,source:player} = data;
			const msg = msgInDaBottle[Math.floor(Math.random()*msgInDaBottle.length)];
			player.dimension.playSound('random.glass', player.location);
			player.runCommandAsync('title @s times 160 200 160');
			player.onScreenDisplay.setActionBar(msg);
			itemStack.amountDecrease(player, 'Mainhand');
		}
	});
	itemComponentRegistry.registerCustomComponent('xtm:experienceTome', {
		onUse: data => {
			const {itemStack,source: player} = data;
			const totalXp = player.getTotalXp();
			if (!itemStack.getDynamicProperty('xp')) itemStack.setDynamicProperty('xp', 0);
			if (itemStack.getLore.length == 0) itemStack.setLore(['',`§7xp: ${itemStack.getDynamicProperty('xp')}§r`]);;
			if (totalXp < 1395 > itemStack.getDynamicProperty('xp') && player.isSneaking == false) {
				player.removeExp(totalXp);
				itemStack.setDynamicProperty('xp', itemStack.getDynamicProperty('xp') ? itemStack.getDynamicProperty('xp') + totalXp : totalXp);
				itemStack.setLore(['',`§7xp: ${itemStack.getDynamicProperty('xp')}§r`]);
			} else if (totalXp >= 1395 && itemStack.getDynamicProperty('xp') == 0 && player.isSneaking == false) {
				player.removeExp(1395);
				itemStack.setDynamicProperty('xp', 1395);
				itemStack.setLore(['',`§7xp: ${itemStack.getDynamicProperty('xp')}§r`]);
			} else if (itemStack.getDynamicProperty('xp') > 0 && player.isSneaking) {
				player.addExperience(itemStack.getDynamicProperty('xp'));
				itemStack.setDynamicProperty('xp', 0);
				itemStack.setLore(['',`§7xp: ${itemStack.getDynamicProperty('xp')}§r`]);
			}
			player.getComponent('equippable').setEquipment('Mainhand', itemStack);
		}
	});
	itemComponentRegistry.registerCustomComponent('xtm:experienceTomeLoot', {
		onUse: data => {
			const {itemStack,source: player} = data;
			if (!itemStack) return;
			const typeId = itemStack.typeId;
			const item = experienceTome[typeId];
			if (!item) return;
			player.addExperience(item.addExp);
			player.getComponent('equippable').setEquipment('Mainhand', new ItemStack('xtm:experience_tome'));
		}
	});
	itemComponentRegistry.registerCustomComponent('lst:ancientPearl', {
		onUse: data => {
			const {itemStack, source: player} = data;
			shootProjectile(player, 'lst:port');
			player.dimension.playSound('random.bow', player.location);
			itemStack.durabilityModifier(player, 'Mainhand');
			itemStack.getComponent('cooldown').startCooldown(player);
		}
	});
	itemComponentRegistry.registerCustomComponent('lst:boostworkBall', {
		onUse: data => {
			const {itemStack, source: player} = data;
			const entity = player.dimension.spawnEntity('lst:boom', player.location);
			entity.triggerEvent('boom');
			player.dimension.playSound('firework.launch', player.location);
			player.dimension.playSound('firework.large_blast', player.location);
			player.dimension.playSound('firework.twinkle', player.location);
			player.dimension.spawnParticle('minecraft:flash', player.location);
			player.dimension.spawnParticle('minecraft:sparkler_emitter', player.location);
			itemStack.durabilityModifier(player, 'Mainhand');
			itemStack.getComponent('cooldown').startCooldown(player);
		}
	});
	itemComponentRegistry.registerCustomComponent('lst:echoesPickaxe', {
		onMineBlock: data => {
			const {block,minedBlockPermutation,itemStack,source: player} = data;
			if (!ores.includes(minedBlockPermutation.type.id) || (itemStack.getComponent('enchantable') && itemStack.getComponent('enchantable').hasEnchantment('silk_touch'))) return;
			const rng = Math.floor(Math.random()*100);
			if (rng <= 25) {
				block.dimension.spawnEntity('minecraft:xp_orb', block.location);
			}
			else if (rng > 25 && rng <= 50) {
				block.dimension.spawnEntity('minecraft:xp_orb', block.location);
				block.dimension.spawnEntity('minecraft:xp_orb', block.location);
			}
			else if (rng > 50 && rng <= 75) {
				block.dimension.spawnEntity('minecraft:xp_orb', block.location);
				block.dimension.spawnEntity('minecraft:xp_orb', block.location);
				block.dimension.spawnEntity('minecraft:xp_orb', block.location);
			}
			else if (rng > 75 && rng <= 100) {
				block.dimension.spawnEntity('minecraft:xp_orb', block.location);
				block.dimension.spawnEntity('minecraft:xp_orb', block.location);
				block.dimension.spawnEntity('minecraft:xp_orb', block.location);
				block.dimension.spawnEntity('minecraft:xp_orb', block.location);
			}
		}
	});
	itemComponentRegistry.registerCustomComponent('lst:stormHammer', {
		onUse: data => {
			const {itemStack, source: player} = data;
			const common = player.dimension.getEntities({location: player.location, maxDistance: 4});
			const commonEntities = common.filter(entity => entity.typeId !== "minecraft:painting" && entity.typeId !== 'minecraft:item' && entity !== player.getRidingOn() && entity !== player && !entity.getComponent("is_tamed")?.isValid());
			commonEntities.forEach(entity => {
				player.dimension.spawnEntity('minecraft:lightning_bolt', entity.location);
			});
			player.addTag('btr:bash');
			const entity = player.dimension.spawnEntity('btr:slam', player.location);
			system.runTimeout(()=>{player.removeTag('btr:bash')},20);
			entity.triggerEvent('iron');
			itemStack.durabilityModifier(player, 'Mainhand');
			itemStack.getComponent('cooldown').startCooldown(player);
		}
	});
	itemComponentRegistry.registerCustomComponent('lst:holyDagger', {
		onUse: data => {
			const {itemStack,source: player} = data;
			player.applyDamage(2, {cause: 'magic'});
			player.dimension.playSound('random.orb', player.location);
			player.addEffect('regeneration', 5*20, {amplifier: 2, showParticles: false});
			itemStack.durabilityModifier(player, 'Mainhand', 5);
			itemStack.getComponent('cooldown').startCooldown(player);
		}
	});
	blockComponentRegistry.registerCustomComponent('btr:cyprium', {
		onPlayerInteract: data => {
			const {block,player} = data;
			const mainHand = player.getComponent('equippable').getEquipment('Mainhand');
			const entity = block.dimension.getEntities({ type: "btr:cyprium_entity", location: block.center(), maxDistance: 1, closest: 1 })[0];
			const entityInv = entity.getComponent('inventory');
			const entityMainHand = entityInv.container.getItem(0);
			if (mainHand === undefined && entity !== undefined) {
				player.getComponent('equippable').setEquipment('Mainhand', entityMainHand);
				entityInv.container.setItem(0, undefined);
				return;
			}
			if (mainHand.hasTag('btr:enchantment_book') && entityMainHand == undefined) {
				mainHand.amountDecrease(player, 'Mainhand', 1, false);
				system.runTimeout(() => {
					entityInv.container.setItem(0, new ItemStack(mainHand.typeId));
				}, 2);
				return;
			}
			if (!entity || !mainHand || !entityMainHand) return;
			const enchant = enchantments[entityMainHand.typeId];
			if ((mainHand.getDynamicProperty('btr:fling') || mainHand.getDynamicProperty('btr:science') || mainHand.getDynamicProperty('btr:freezing')) && (enchant.enchantmentId == 'btr:fling' || enchant.enchantmentId == 'btr:freezing' || enchant.enchantmentId == 'btr:science')) return;
			if (enchant && mainHand.hasTag(enchant.toolType) && mainHand.getDynamicProperty(enchant.enchantmentId) == undefined) {
				enchantConfirmForm(player, mainHand, enchant, entityInv);
			} else if (enchant && enchant.lvlUp && mainHand.hasTag(enchant.toolType) && mainHand.getDynamicProperty(enchant.enchantmentId) == enchant.lvl) {
				enchantConfirmForm(player, mainHand, enchant, entityInv, true);
			} else if (enchant && mainHand.hasTag(enchant.toolType) && mainHand.getDynamicProperty(enchant.enchantmentId) == enchant.lvl - 1) {
				enchantConfirmForm(player, mainHand, enchant, entityInv);
			} else if ((mainHand.hasTag('minecraft:is_longsword') || mainHand.hasTag('minecraft:is_claymore') || mainHand.hasTag('minecraft:is_glaive') || mainHand.hasTag('minecraft:is_katana')) && mainHand.getDynamicProperty('btr:swifter') == undefined && entityMainHand.typeId == 'btr:swifter_slashes_book') {
				const enchant = {
					enchantmentName: 'Swifter',
					enchantmentId: 'btr:swifter',
					lvl: 1
				};
				enchantConfirmForm(player, mainHand, enchant, entityInv);
			} else if ((mainHand.hasTag('minecraft:is_chestplate') || mainHand.typeId.includes('chestplate')) && mainHand.getDynamicProperty('btr:vitality') == undefined && entityMainHand.typeId == 'btr:vitality_book') {
				const enchant = {
					enchantmentName: 'Vitality',
					enchantmentId: 'btr:vitality',
					lvl: 1
				};
				enchantConfirmForm(player, mainHand, enchant, entityInv);
			} else if ((mainHand.hasTag('minecraft:is_pickaxe') || mainHand.hasTag('minecraft:is_shovel')) && mainHand.getDynamicProperty('btr:reinforced') == undefined && entityMainHand.typeId == 'btr:reinforced_book') {
				const enchant = {
					enchantmentName: 'Reinforced',
					enchantmentId: 'btr:reinforced',
					lvl: 1
				};
				enchantConfirmForm(player, mainHand, enchant, entityInv);
			} else if ((mainHand.hasTag('minecraft:is_boots') || mainHand.typeId.includes('boots')) && mainHand.getDynamicProperty('btr:lightWeight') == undefined && entityMainHand.typeId == 'btr:light_weight_book') {
				const enchant = {
					enchantmentName: 'Light Weight',
					enchantmentId: 'btr:lightWeight',
					lvl: 1
				};
				enchantConfirmForm(player, mainHand, enchant, entityInv);
			} else if ((mainHand.hasTag('minecraft:is_boots') || mainHand.typeId.includes('boots')) && mainHand.getDynamicProperty('btr:highJump') == undefined && entityMainHand.typeId == 'btr:high_jump_book') {
				const enchant = {
					enchantmentName: 'High Jump',
					enchantmentId: 'btr:highJump',
					lvl: 1
				};
				enchantConfirmForm(player, mainHand, enchant, entityInv);
			} else if ((mainHand.hasTag('minecraft:is_boots') || mainHand.typeId.includes('boots')) && mainHand.getDynamicProperty('chr:aerialAffinity') == undefined && entityMainHand.typeId == 'chr:aerial_affinity_book') {
				const enchant = {
					enchantmentName: 'Aerial Affinity',
					enchantmentId: 'chr:aerialAffinity',
					lvl: 1
				};
				enchantConfirmForm(player, mainHand, enchant, entityInv);
			} else if ((mainHand.hasTag('minecraft:is_leggings') || mainHand.typeId.includes('leggings')) && mainHand.getDynamicProperty('btr:agility') != 2 && entityMainHand.typeId == 'btr:agility_i_book') {
				const enchant = {
					enchantmentName: 'Agility',
					enchantmentId: 'btr:agility',
					lvl: 1
				};
				enchantConfirmForm(player, mainHand, enchant, entityInv, true);
			} else if ((mainHand.hasTag('minecraft:is_leggings') || mainHand.typeId.includes('leggings')) && mainHand.getDynamicProperty('btr:agility') != 2 && entityMainHand.typeId == 'btr:agility_ii_book') {
				const enchant = {
					enchantmentName: 'Agility',
					enchantmentId: 'btr:agility',
					lvl: 2
				};
				enchantConfirmForm(player, mainHand, enchant, entityInv);
			}
		},
		onPlace: data => {
			const {block} = data;
			const {x,y,z} = block.center();
			block.dimension.spawnEntity('btr:cyprium_entity', {x:x,y:y-0.5,z:z});
		},
		onPlayerDestroy: data => {
			const {block,dimension,player} = data;
			const mainHand = player.getComponent('equippable').getEquipment('Mainhand');
			if (!mainHand || mainHand.hasTag('minecraft:wooden_tier') || mainHand.hasTag('stone_tier') || mainHand.hasTag('golden_tier')) return;
			if (mainHand.hasTag('minecraft:is_pickaxe')) {
				dimension.spawnItem(new ItemStack('btr:cyprium'), block.center());
			}
		}
	});
	blockComponentRegistry.registerCustomComponent("reforge:reforging_table", {
		onPlayerInteract: ({player, block}) => {
			const playerEquippable = player?.getComponent('equippable');
			const playerHoldItem = playerEquippable.getEquipment('Mainhand');
			const newLocation = {
				x: block.location.x + 0.5,
				y: block.location.y + 0.5,
				z: block.location.z + 0.5
			};
			const entity = block.dimension.getEntities({
				type: "reforge:item_of_reforging_table", location: newLocation, maxDistance: 1, closest: 1
			})[0];
			if (playerHoldItem === void 0) {
				if (entity !== void 0) {
					const entityInventory = entity.getComponent('inventory');
					const entityHoldItem = entityInventory.container.getItem(0);
					playerEquippable.setEquipment('Mainhand', entityHoldItem);
					entity.remove();
				}
				return;
			}
			if (playerHoldItem.hasTag("minecraft:is_sword") || playerHoldItem.hasTag("minecraft:is_axe") || playerHoldItem.hasTag("minecraft:is_pickaxe") || playerHoldItem.hasTag("minecraft:is_shovel") || playerHoldItem.hasTag("minecraft:is_hoe") || playerHoldItem.hasTag("minecraft:is_armor") || playerHoldItem.hasTag("minecraft:is_trident") || playerHoldItem.typeId === "minecraft:bow" || playerHoldItem.typeId === "minecraft:crossbow" || playerHoldItem.typeId === "minecraft:mace" || playerHoldItem.typeId === "minecraft:shield") {
				if (entity === void 0) {
					block.dimension.spawnEntity("reforge:item_of_reforging_table", newLocation);
					playerEquippable.setEquipment('Mainhand', void 0);
					system.runTimeout(() => {
						const entity2 = block.dimension.getEntities({
							type: "reforge:item_of_reforging_table", location: newLocation, maxDistance: 1, closest: 1
						})[0];
						const entityInventory = entity2.getComponent('inventory');
						entityInventory.container.setItem(0, playerHoldItem);
						entity2.runCommand(`replaceitem entity @s slot.weapon.mainhand 0 ${playerHoldItem.typeId}`);
						if (playerHoldItem.hasTag("minecraft:is_sword") || playerHoldItem.hasTag("minecraft:is_axe") || playerHoldItem.hasTag("minecraft:is_pickaxe") || playerHoldItem.hasTag("minecraft:is_shovel") || playerHoldItem.hasTag("minecraft:is_hoe")) {
							entity2.playAnimation("animation.item_of_reforging_table.sword_axe_pickaxe_shovel_and_hoe", {
								blendOutTime: 200
							});
							return;
						} else if (playerHoldItem.typeId === "minecraft:bow") {
							entity2.playAnimation("animation.item_of_reforging_table.bow", {
								blendOutTime: 200
							});
							return;
						} else if (playerHoldItem.typeId === "minecraft:crossbow") {
							entity2.playAnimation("animation.item_of_reforging_table.crossbow", {
								blendOutTime: 200
							});
							return;
						} else if (playerHoldItem.hasTag("minecraft:is_trident")) {
							entity2.playAnimation("animation.item_of_reforging_table.trident", {
								blendOutTime: 200
							});
							return;
						} else if (playerHoldItem.hasTag("minecraft:is_armor")) {
							entity2.playAnimation("animation.item_of_reforging_table.armor", {
								blendOutTime: 200
							});
							return;
						} else if (playerHoldItem.typeId === "minecraft:shield") {
							entity2.playAnimation("animation.item_of_reforging_table.shield", {
								blendOutTime: 200
							});
							return;
						}
					},
						2);
				}
				return;
			}
			if (playerHoldItem.typeId === "reforge:reforging_hammer") {
				if (entity !== void 0) {
					const entityInventory = entity.getComponent('inventory');
					const item = entityInventory.container.getItem(0);
					const lore = item.getLore();
					const newLore = lore.filter((element) => !element.includes("\xA7r\xA7a\xA7t\xA7t\xA7r\xA7i\xA7b\xA7u\xA7t\xA7e\xA7s\xA7r") && !element.includes("\xA7r\xA7a\xA7d\xA7d\xA7i\xA7t\xA7i\xA7o\xA7n\xA7a\xA7l\xA7r") && !element.includes("\xA7r\xA7a\xA7t\xA7k\xA7d\xA7m\xA7g\xA7e\xA7r") && !element.includes("\xA7r\xA7p\xA7j\xA7t\xA7d\xA7m\xA7g\xA7e\xA7r") && !element.includes("\xA7r\xA7c\xA7t\xA7c\xA7c\xA7h\xA7a\xA7n\xA7r") && !element.includes("\xA7r\xA7c\xA7t\xA7c\xA7d\xA7m\xA7g\xA7e\xA7r") && !element.includes("\xA7r\xA7b\xA7l\xA7k\xA7c\xA7h\xA7a\xA7n\xA7r") && !element.includes("\xA7r\xA7p\xA7r\xA7c\xA7h\xA7a\xA7n\xA7r") && !element.includes("\xA7r\xA7d\xA7m\xA7g\xA7e\xA7r\xA7e\xA7d\xA7r") && !element.includes("\xA7r\xA7e\xA7v\xA7c\xA7h\xA7a\xA7n\xA7r") && !element.includes("\xA7r\xA7m\xA7i\xA7n\xA7e\xA7f\xA7f\xA7r") && !element.includes("\xA7r\xA7m\xA7o\xA7v\xA7s\xA7p\xA7r") && !element.includes("\xA7r\xA7r\xA7a\xA7r\xA7i\xA7t\xA7y\xA7r"));
					item.setLore(newLore);
					setAttributes(item);
					entityInventory.container.setItem(0, item);
					const itemDurability = playerHoldItem.getComponent('durability');
					if (itemDurability.damage < 100) {
						itemDurability.damage++;
						playerEquippable.setEquipment('Mainhand', playerHoldItem);
					} else {
						playerEquippable.setEquipment('Mainhand', void 0);
						player?.dimension.playSound("random.break", player?.location);
					}
					player?.dimension.playSound("smithing_table.use", newLocation);
					const entityInventoryReforged = entity.getComponent('inventory');
					const itemReforged = entityInventoryReforged.container.getItem(0);
					const loreReforged = itemReforged.getLore();
					const rarity = loreReforged.find((element) => element.includes("\xA7r\xA7r\xA7a\xA7r\xA7i\xA7t\xA7y\xA7r"));
					const reforgingLocation = {
						x: newLocation.x,
						y: newLocation.y + 0.4,
						z: newLocation.z
					};
					if (rarity.includes("\xA7r\xA7c\xA7o\xA7m\xA7m\xA7r")) {
						block.dimension.spawnParticle("reforge:common_reforging", reforgingLocation);
					} else if (rarity.includes("\xA7r\xA7r\xA7a\xA7r\xA7e\xA7r")) {
						block.dimension.spawnParticle("reforge:rare_reforging", reforgingLocation);
					} else if (rarity.includes("\xA7r\xA7e\xA7p\xA7i\xA7c\xA7r")) {
						block.dimension.spawnParticle("reforge:epic_reforging", reforgingLocation);
					} else if (rarity.includes("\xA7r\xA7l\xA7g\xA7d\xA7r\xA7r")) {
						block.dimension.spawnParticle("reforge:legendary_reforging", reforgingLocation);
					}
					return;
				}
			}
		},
		onTick: ({
			block
		}) => {
			const newLocation = {
				x: block.location.x + 0.5,
				y: block.location.y + 0.5,
				z: block.location.z + 0.5
			};
			const entity = block.dimension.getEntities({
				type: "reforge:item_of_reforging_table", location: newLocation, maxDistance: 1, closest: 1
			})[0];
			if (entity !== void 0) {
				const entityInventory = entity.getComponent('inventory');
				const entityHoldItem = entityInventory.container.getItem(0);
				if (entityHoldItem !== void 0) {
					if (entityHoldItem.hasTag("minecraft:is_sword") || entityHoldItem.hasTag("minecraft:is_axe") || entityHoldItem.hasTag("minecraft:is_pickaxe") || entityHoldItem.hasTag("minecraft:is_shovel") || entityHoldItem.hasTag("minecraft:is_hoe")) {
						entity.playAnimation("animation.item_of_reforging_table.sword_axe_pickaxe_shovel_and_hoe", {
							blendOutTime: 200
						});
						return;
					} else if (entityHoldItem.typeId === "minecraft:bow") {
						entity.playAnimation("animation.item_of_reforging_table.bow", {
							blendOutTime: 200
						});
						return;
					} else if (entityHoldItem.typeId === "minecraft:crossbow") {
						entity.playAnimation("animation.item_of_reforging_table.crossbow", {
							blendOutTime: 200
						});
						return;
					} else if (entityHoldItem.hasTag("minecraft:is_trident")) {
						entity.playAnimation("animation.item_of_reforging_table.trident", {
							blendOutTime: 200
						});
						return;
					} else if (entityHoldItem.hasTag("minecraft:is_armor")) {
						entity.playAnimation("animation.item_of_reforging_table.armor", {
							blendOutTime: 200
						});
						return;
					} else if (entityHoldItem.typeId === "minecraft:shield") {
						entity.playAnimation("animation.item_of_reforging_table.shield", {
							blendOutTime: 200
						});
						return;
					}
				}
			}
		}
	});
	blockComponentRegistry.registerCustomComponent('dlcraft:spawnBoss', {
		onTick: data => {
			const {block} = data;
			if (!block) return;
			const {x,y,z} = block.location;
			const blocks = bossBlocks[block.typeId];
			if (!blocks) return;
			if (Array.isArray(blocks)) {
				blocks.forEach((b) => {
					block.dimension.spawnEntity(b.summon, {x: b.x ? x + b.x : x, y: y, z: b.z ? z + b.z : z});
					block.setPermutation(BlockPermutation.resolve('minecraft:air'));
				});
			} else {
				block.dimension.spawnEntity(blocks.summon, {x: blocks.x ? x + blocks.x : x, y: y, z: blocks.z ? z + blocks.z : z});
				block.setPermutation(BlockPermutation.resolve('minecraft:air'));
			}
		}
	});
	blockComponentRegistry.registerCustomComponent('sc:spider_egg', {
		onPlayerDestroy: data => {
			const {block} = data;
			const {x,y,z} = block.location;
			block.dimension.spawnEntity('sc:spider_hatchling', {x: x,y: y,z: z});
			block.dimension.spawnItem(new ItemStack('minecraft:string', 2), block.location);
			block.setPermutation(BlockPermutation.resolve('minecraft:air'));
    	},
		onPlayerInteract: data => {
			const {block,dimension,player} = data;
			if (!player.getComponent('equippable').getEquipment('Mainhand')) return;
			if (player.getComponent('equippable').getEquipment('Mainhand').typeId == 'minecraft:shears') {
				block.dimension.spawnItem(new ItemStack('sc:spider_egg'), block.location);
				block.dimension.playSound('block.sweet_berry_bush.pick', block.location);
				block.setPermutation(BlockPermutation.resolve('minecraft:air'));
			}
		}
    });
    blockComponentRegistry.registerCustomComponent('sc:grape_harvest', {
		onPlayerInteract: data => {
			const {block,dimension,player} = data;
			if (player.getComponent('equippable').getEquipment('Mainhand') && player.getComponent('equippable').getEquipment('Mainhand').typeId == 'minecraft:bone_meal') return;
			if (block.permutation.getState('sc:stage') > 1) {
				block.dimension.spawnItem(new ItemStack('sc:grapes'), block.location);
				block.dimension.playSound('block.sweet_berry_bush.pick', block.location);
				block.setPermutation(block.permutation.withState('sc:stage', 0));
			}
		}
    });
    blockComponentRegistry.registerCustomComponent('sc:destroy', {
		onTick: data => {
			const {block} = data;
			block.setPermutation(BlockPermutation.resolve('minecraft:air'));
		}
    });
    blockComponentRegistry.registerCustomComponent('customlayerblock:layer', {
		onPlayerInteract: (data)=>{
			const { block , dimension , player , face  } = data;
			//return if the face isn't up
			if (face != 'Up') return;
			const blockData = layeredBlocks.find((f)=>f.id == block.typeId);
			//return if there's no specified block data
			if (blockData == undefined) return;
			const layer = block.permutation.getState("customlayerblock:layer");
			//return if it's a full block
			if (layer >= 7) return;
			const mainhand = player.getComponent('equippable').getEquipmentSlot('Mainhand');
			const item = mainhand.getItem();
			//return if the item doesn't match the block data item
			if (item == undefined || item.typeId != blockData.itemID) return;
			//diminish the item if the player isn't in creative
			if (player.getGameMode() != 'creative') {
				let amount = item.amount - 1;
				if (amount < 1) {
					mainhand.setItem(undefined);
				} else {
					item.amount = amount;
					mainhand.setItem(item);
				}
			}
			//if the sound data is defined, play the sound
			if (blockData.placeSound != undefined) {
				const sound = blockData.placeSound;
				block.dimension.playSound(sound.id, block.center(), {volume: sound.volume,pitch: sound.pitch});
			}
			//set the layer state
			block.setPermutation(block.permutation.withState("customlayerblock:layer", layer + 1));
		}
    });
	blockComponentRegistry.registerCustomComponent('customcrop:custom_crop', {
		onPlayerInteract: (data)=>{
    		cropManager.interact(data.block, data.player);
		},
		onRandomTick: (data)=>{
			cropManager.tick(data.block);
		}
	});
	blockComponentRegistry.registerCustomComponent('template:stair_placement', {
        onPlace: e => {
            const { block } = e;
            const northBlock = block.north();
            const southBlock = block.south();
            const eastBlock = block.east();
            const westBlock = block.west();
            const vertical_half = block.permutation.getState('minecraft:vertical_half');
            const shape = block.permutation.getState('template:shape');
            const cardinal_direction = block.permutation.getState('minecraft:cardinal_direction');

            if (vertical_half == 'bottom') {
                block.setPermutation(block.permutation.withState('template:placed_bit', true));
                if(southBlock.hasTag('custom_stairs_up') && southBlock.hasTag('custom_stairs_east') && shape == 'straight' && cardinal_direction == 'north') {
                    block.setPermutation(block.permutation.withState('template:shape', 'inner_right'));
                }
                if(!southBlock.hasTag('custom_stairs_up') && !southBlock.hasTag('custom_stairs_east') && shape == 'inner_right' && cardinal_direction == 'north') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
                if(southBlock.hasTag('custom_stairs_up') && southBlock.hasTag('custom_stairs_west') && shape == 'straight' && cardinal_direction == 'north') {
                    block.setPermutation(block.permutation.withState('template:shape', 'inner_left' ))
                }
                if(!southBlock.hasTag('custom_stairs_up') && !southBlock.hasTag('custom_stairs_west') && shape == 'inner_left' && cardinal_direction == 'north') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
                if(northBlock.hasTag('custom_stairs_up') && northBlock.hasTag('custom_stairs_west') && shape == 'straight' && cardinal_direction == 'south') {
                    block.setPermutation(block.permutation.withState('template:shape', 'inner_left' ))
                }
                if(!northBlock.hasTag('custom_stairs_up') && !northBlock.hasTag('custom_stairs_west') && shape == 'inner_left' && cardinal_direction == 'south') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
                if(northBlock.hasTag('custom_stairs_up') && northBlock.hasTag('custom_stairs_east') && shape == 'straight' && cardinal_direction == 'south') {
                    block.setPermutation(block.permutation.withState('template:shape', 'inner_right' ))
                }
                if(!northBlock.hasTag('custom_stairs_up') && !northBlock.hasTag('custom_stairs_east') && shape == 'inner_right' && cardinal_direction == 'south') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
                if(eastBlock.hasTag('custom_stairs_up') && eastBlock.hasTag('custom_stairs_south') && shape == 'straight' && cardinal_direction == 'west') {
                    block.setPermutation(block.permutation.withState('template:shape', 'inner_left' ))
                }
                if(!eastBlock.hasTag('custom_stairs_up') && !eastBlock.hasTag('custom_stairs_south') && shape == 'inner_left' && cardinal_direction == 'west') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
                if(eastBlock.hasTag('custom_stairs_up') && eastBlock.hasTag('custom_stairs_north') && shape == 'straight' && cardinal_direction == 'west') {
                    block.setPermutation(block.permutation.withState('template:shape', 'inner_right' ))
                }
                if(!eastBlock.hasTag('custom_stairs_up') && !eastBlock.hasTag('custom_stairs_north') && shape == 'inner_right' && cardinal_direction == 'west') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
                if(westBlock.hasTag('custom_stairs_up') && westBlock.hasTag('custom_stairs_north') && shape == 'straight' && cardinal_direction == 'east') {
                    block.setPermutation(block.permutation.withState('template:shape', 'inner_left' ))
                }
                if(!westBlock.hasTag('custom_stairs_up') && !westBlock.hasTag('custom_stairs_north') && shape == 'inner_left' && cardinal_direction == 'east') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
                if(westBlock.hasTag('custom_stairs_up') && westBlock.hasTag('custom_stairs_south') && shape == 'straight' && cardinal_direction == 'east') {
                    block.setPermutation(block.permutation.withState('template:shape', 'inner_right' ))
                }
                if(!westBlock.hasTag('custom_stairs_up') && !westBlock.hasTag('custom_stairs_south') && shape == 'inner_right' && cardinal_direction == 'east') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
                if(northBlock.hasTag('custom_stairs_up') && northBlock.hasTag('custom_stairs_west') && shape == 'straight' && cardinal_direction == 'north') {
                    block.setPermutation(block.permutation.withState('template:shape', 'outer_right' ))
                }
                if(!northBlock.hasTag('custom_stairs_up') && !northBlock.hasTag('custom_stairs_west') && shape == 'outer_right' && cardinal_direction == 'north') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
                if(northBlock.hasTag('custom_stairs_up') && northBlock.hasTag('custom_stairs_east') && shape == 'straight' && cardinal_direction == 'north') {
                    block.setPermutation(block.permutation.withState('template:shape', 'outer_left' ))
                }
                if(!northBlock.hasTag('custom_stairs_up') && !northBlock.hasTag('custom_stairs_east') && shape == 'outer_left' && cardinal_direction == 'north') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
                if(southBlock.hasTag('custom_stairs_up') && southBlock.hasTag('custom_stairs_west') && shape == 'straight' && cardinal_direction == 'south') {
                    block.setPermutation(block.permutation.withState('template:shape', 'outer_right' ))
                }
                if(!southBlock.hasTag('custom_stairs_up') && !southBlock.hasTag('custom_stairs_west') && shape == 'outer_right' && cardinal_direction == 'south') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
                if(southBlock.hasTag('custom_stairs_up') && southBlock.hasTag('custom_stairs_east') && shape == 'straight' && cardinal_direction == 'south') {
                    block.setPermutation(block.permutation.withState('template:shape', 'outer_left' ))
                }
                if(!southBlock.hasTag('custom_stairs_up') && !southBlock.hasTag('custom_stairs_east') && shape == 'outer_left' && cardinal_direction == 'south') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
                if(westBlock.hasTag('custom_stairs_up') && westBlock.hasTag('custom_stairs_north') && shape == 'straight' && cardinal_direction == 'west') {
                    block.setPermutation(block.permutation.withState('template:shape', 'outer_right' ))
                }
                if(!westBlock.hasTag('custom_stairs_up') && !westBlock.hasTag('custom_stairs_north') && shape == 'outer_right' && cardinal_direction == 'west') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
                if(westBlock.hasTag('custom_stairs_up') && westBlock.hasTag('custom_stairs_south') && shape == 'straight' && cardinal_direction == 'west') {
                    block.setPermutation(block.permutation.withState('template:shape', 'outer_left' ))
                }
                if(!westBlock.hasTag('custom_stairs_up') && !westBlock.hasTag('custom_stairs_south') && shape == 'outer_left' && cardinal_direction == 'west') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
                if(eastBlock.hasTag('custom_stairs_up') && eastBlock.hasTag('custom_stairs_south') && shape == 'straight' && cardinal_direction == 'east') {
                    block.setPermutation(block.permutation.withState('template:shape', 'outer_right' ))
                }
                if(!eastBlock.hasTag('custom_stairs_up') && !eastBlock.hasTag('custom_stairs_south') && shape == 'outer_right' && cardinal_direction == 'east') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
                if(eastBlock.hasTag('custom_stairs_up') && eastBlock.hasTag('custom_stairs_north') && shape == 'straight' && cardinal_direction == 'east') {
                    block.setPermutation(block.permutation.withState('template:shape', 'outer_left' ))
                }
                if(!eastBlock.hasTag('custom_stairs_up') && !eastBlock.hasTag('custom_stairs_north') && shape == 'outer_left' && cardinal_direction == 'east') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
            }
            if (vertical_half == 'top') {
                block.setPermutation(block.permutation.withState('template:placed_bit', true));
                if(southBlock.hasTag('custom_stairs_down') && southBlock.hasTag('custom_stairs_east') && shape == 'straight' && cardinal_direction == 'north') {
                    block.setPermutation(block.permutation.withState('template:shape', 'inner_right'));
                }
                if(!southBlock.hasTag('custom_stairs_down') && !southBlock.hasTag('custom_stairs_east') && shape == 'inner_right' && cardinal_direction == 'north') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
                if(southBlock.hasTag('custom_stairs_down') && southBlock.hasTag('custom_stairs_west') && shape == 'straight' && cardinal_direction == 'north') {
                    block.setPermutation(block.permutation.withState('template:shape', 'inner_left' ))
                }
                if(!southBlock.hasTag('custom_stairs_down') && !southBlock.hasTag('custom_stairs_west') && shape == 'inner_left' && cardinal_direction == 'north') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
                if(northBlock.hasTag('custom_stairs_down') && northBlock.hasTag('custom_stairs_west') && shape == 'straight' && cardinal_direction == 'south') {
                    block.setPermutation(block.permutation.withState('template:shape', 'inner_left' ))
                }
                if(!northBlock.hasTag('custom_stairs_down') && !northBlock.hasTag('custom_stairs_west') && shape == 'inner_left' && cardinal_direction == 'south') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
                if(northBlock.hasTag('custom_stairs_down') && northBlock.hasTag('custom_stairs_east') && shape == 'straight' && cardinal_direction == 'south') {
                    block.setPermutation(block.permutation.withState('template:shape', 'inner_right' ))
                }
                if(!northBlock.hasTag('custom_stairs_down') && !northBlock.hasTag('custom_stairs_east') && shape == 'inner_right' && cardinal_direction == 'south') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
                if(eastBlock.hasTag('custom_stairs_down') && eastBlock.hasTag('custom_stairs_south') && shape == 'straight' && cardinal_direction == 'west') {
                    block.setPermutation(block.permutation.withState('template:shape', 'inner_left' ))
                }
                if(!eastBlock.hasTag('custom_stairs_down') && !eastBlock.hasTag('custom_stairs_south') && shape == 'inner_left' && cardinal_direction == 'west') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
                if(eastBlock.hasTag('custom_stairs_down') && eastBlock.hasTag('custom_stairs_north') && shape == 'straight' && cardinal_direction == 'west') {
                    block.setPermutation(block.permutation.withState('template:shape', 'inner_right' ))
                }
                if(!eastBlock.hasTag('custom_stairs_down') && !eastBlock.hasTag('custom_stairs_north') && shape == 'inner_right' && cardinal_direction == 'west') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
                if(westBlock.hasTag('custom_stairs_down') && westBlock.hasTag('custom_stairs_north') && shape == 'straight' && cardinal_direction == 'east') {
                    block.setPermutation(block.permutation.withState('template:shape', 'inner_left' ))
                }
                if(!westBlock.hasTag('custom_stairs_down') && !westBlock.hasTag('custom_stairs_north') && shape == 'inner_left' && cardinal_direction == 'east') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
                if(westBlock.hasTag('custom_stairs_down') && westBlock.hasTag('custom_stairs_south') && shape == 'straight' && cardinal_direction == 'east') {
                    block.setPermutation(block.permutation.withState('template:shape', 'inner_right' ))
                }
                if(!westBlock.hasTag('custom_stairs_down') && !westBlock.hasTag('custom_stairs_south') && shape == 'inner_right' && cardinal_direction == 'east') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
                if(northBlock.hasTag('custom_stairs_down') && northBlock.hasTag('custom_stairs_west') && shape == 'straight' && cardinal_direction == 'north') {
                    block.setPermutation(block.permutation.withState('template:shape', 'outer_right' ))
                }
                if(!northBlock.hasTag('custom_stairs_down') && !northBlock.hasTag('custom_stairs_west') && shape == 'outer_right' && cardinal_direction == 'north') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
                if(northBlock.hasTag('custom_stairs_down') && northBlock.hasTag('custom_stairs_east') && shape == 'straight' && cardinal_direction == 'north') {
                    block.setPermutation(block.permutation.withState('template:shape', 'outer_left' ))
                }
                if(!northBlock.hasTag('custom_stairs_down') && !northBlock.hasTag('custom_stairs_east') && shape == 'outer_left' && cardinal_direction == 'north') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
                if(southBlock.hasTag('custom_stairs_down') && southBlock.hasTag('custom_stairs_west') && shape == 'straight' && cardinal_direction == 'south') {
                    block.setPermutation(block.permutation.withState('template:shape', 'outer_right' ))
                }
                if(!southBlock.hasTag('custom_stairs_down') && !southBlock.hasTag('custom_stairs_west') && shape == 'outer_right' && cardinal_direction == 'south') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
                if(southBlock.hasTag('custom_stairs_down') && southBlock.hasTag('custom_stairs_east') && shape == 'straight' && cardinal_direction == 'south') {
                    block.setPermutation(block.permutation.withState('template:shape', 'outer_left' ))
                }
                if(!southBlock.hasTag('custom_stairs_down') && !southBlock.hasTag('custom_stairs_east') && shape == 'outer_left' && cardinal_direction == 'south') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
                if(westBlock.hasTag('custom_stairs_down') && westBlock.hasTag('custom_stairs_north') && shape == 'straight' && cardinal_direction == 'west') {
                    block.setPermutation(block.permutation.withState('template:shape', 'outer_right' ))
                }
                if(!westBlock.hasTag('custom_stairs_down') && !westBlock.hasTag('custom_stairs_north') && shape == 'outer_right' && cardinal_direction == 'west') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
                if(westBlock.hasTag('custom_stairs_down') && westBlock.hasTag('custom_stairs_south') && shape == 'straight' && cardinal_direction == 'west') {
                    block.setPermutation(block.permutation.withState('template:shape', 'outer_left' ))
                }
                if(!westBlock.hasTag('custom_stairs_down') && !westBlock.hasTag('custom_stairs_south') && shape == 'outer_left' && cardinal_direction == 'west') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
                if(eastBlock.hasTag('custom_stairs_down') && eastBlock.hasTag('custom_stairs_south') && shape == 'straight' && cardinal_direction == 'east') {
                    block.setPermutation(block.permutation.withState('template:shape', 'outer_right' ))
                }
                if(!eastBlock.hasTag('custom_stairs_down') && !eastBlock.hasTag('custom_stairs_south') && shape == 'outer_right' && cardinal_direction == 'east') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
                if(eastBlock.hasTag('custom_stairs_down') && eastBlock.hasTag('custom_stairs_north') && shape == 'straight' && cardinal_direction == 'east') {
                    block.setPermutation(block.permutation.withState('template:shape', 'outer_left' ))
                }
                if(!eastBlock.hasTag('custom_stairs_down') && !eastBlock.hasTag('custom_stairs_north') && shape == 'outer_left' && cardinal_direction == 'east') {
                    block.setPermutation(block.permutation.withState('template:shape', 'straight' ))
                }
            }
        }
    });
	blockComponentRegistry.registerCustomComponent('cake_template:cake', {
		onPlayerInteract: (data)=>{
			CakeCustomComponent.onInteract(data);
		}
	});
	blockComponentRegistry.registerCustomComponent('chr:dissolve', {
		onTick: data => {
			const {block} = data;
			if (block.above().typeId == 'minecraft:water' || block.below().typeId == 'minecraft:water' || block.north().typeId == 'minecraft:water' || block.south().typeId == 'minecraft:water' || block.east().typeId == 'minecraft:water' || block.west().typeId == 'minecraft:water') {
				block.dimension.playSound('random.fizz', block.location);
				block.setPermutation(BlockPermutation.resolve('minecraft:air'));
			}
		}
	});
	blockComponentRegistry.registerCustomComponent('chr:rotten_flesh', {
		onTick: data => {
			const {block} = data;
			if (block.north().typeId == 'minecraft:water' || block.south().typeId == 'minecraft:water' || block.east().typeId == 'minecraft:water' || block.west().typeId == 'minecraft:water') {
				block.dimension.playSound('use.gravel', block.location);
				block.setPermutation(BlockPermutation.resolve('minecraft:dirt'));
			} else if (block.above().typeId == 'minecraft:dirt' || block.above().typeId == 'minecraft:grass_block' || block.above().typeId == 'minecraft:coarse_dirt' || block.above().typeId == 'minecraft:mycelium') {
				block.dimension.playSound('use.grass', block.location);
				block.setPermutation(BlockPermutation.resolve('minecraft:podzol'));
			}
		}
	});
    blockComponentRegistry.registerCustomComponent('chr:glow', {
		onTick: data => {
			const {block} = data;
			block.setPermutation(BlockPermutation.resolve('minecraft:air'));
		}
    });
	blockComponentRegistry.registerCustomComponent('twr:tower_golem_summon', {
		onPlayerInteract: data => {
			const {block} = data;
			if (block.typeId == 'twr:summon_tower_golem_over') {
				block.dimension.spawnEntity('twr:tower_golem_over', block.location);
			} else if (block.typeId == 'twr:summon_tower_golem_nether') {
				block.dimension.spawnEntity('twr:tower_golem_nether', block.location);
			} else if (block.typeId == 'twr:summon_tower_golem_end') {
				block.dimension.spawnEntity('twr:tower_golem_end', block.location);
			}
			block.setPermutation(BlockPermutation.resolve('minecraft:air'));
		}
	});
	blockComponentRegistry.registerCustomComponent('twr:tower_chest', {
		onPlayerInteract: data => {
			const {block,player,dimension} = data;
			const {x,y,z} = block.location;
			if (!player.getComponent('equippable').getEquipment('Mainhand')) return;
			const mainHand = player.getComponent('equippable').getEquipment('Mainhand');
			if (block.typeId == 'twr:top_chest_over' && mainHand.typeId == 'twr:overworld_golems_key') {
				const loottable = 'chests/tower/floor_ten';
				dimension.runCommandAsync(`loot spawn ${x} ${y} ${z} loot "${loottable}"`);
				mainHand.amountDecrease(player, 'Mainhand', 1, false);
				block.setPermutation(BlockPermutation.resolve('minecraft:air'));
			} else if (block.typeId == 'twr:top_chest_nether' && mainHand.typeId == 'twr:nether_golems_key') {
				const loottable = 'chests/tower/nether_ten';
				dimension.runCommandAsync(`loot spawn ${x} ${y} ${z} loot "${loottable}"`);
				mainHand.amountDecrease(player, 'Mainhand', 1, false);
				block.setPermutation(BlockPermutation.resolve('minecraft:air'));
			} else if (block.typeId == 'twr:top_chest_end' && mainHand.typeId == 'twr:end_golems_key') {
				const loottable = 'chests/tower/end_ten';
				dimension.runCommandAsync(`loot spawn ${x} ${y} ${z} loot "${loottable}"`);
				mainHand.amountDecrease(player, 'Mainhand', 1, false);
				block.setPermutation(BlockPermutation.resolve('minecraft:air'));
			}
		}
	});
	blockComponentRegistry.registerCustomComponent('flg:pickUpItems', {
		onPlayerInteract: data => {
			const {block,player} = data;
			const blocks = pickUpItems[block.typeId];
			if (blocks) {
				player.dimension.spawnItem(new ItemStack(blocks.item), player.location);
				block.setPermutation(BlockPermutation.resolve('minecraft:air'));
				player.dimension.playSound(blocks.sound, block.location);
			}
		}
	});
	blockComponentRegistry.registerCustomComponent('flg:grassTypes', {
		onPlayerInteract: data => {
			const {block,player} = data;
			const mainhand = player.getComponent('equippable'). getEquipment('Mainhand');
			const grass = grassTypes[block.typeId]
			if (mainhand && mainhand.typeId == 'minecraft:shears' && grass) {
				player.dimension.spawnItem(new ItemStack(grass), player.location);
				block.setPermutation(BlockPermutation.resolve('minecraft:air'));
				player.dimension.playSound('block.sweet_berry_bush.pick', block.location);
			}
		}
	});
	blockComponentRegistry.registerCustomComponent('trr:extractinator', {
		onPlayerInteract: data => {
			const {block,player} = data;
			const {x,y,z} = block.center();
			const itemStack = player.getComponent('equippable').getEquipment('Mainhand');
			if (!itemStack) return;
			if (itemStack.typeId == 'trr:sparkling_dust') {
				const lootTable = 'blocks/extract';
				block.dimension.playSound('block.blastfurnace.fire_crackle', {x:x, y:y, z:z});
				block.dimension.playSound('random.fizz', {x:x, y:y, z:z});
				block.dimension.playSound('block.stonecutter.use', {x:x, y:y, z:z});
				itemStack.amountDecrease(player, 'Mainhand');
				block.dimension.spawnParticle('minecraft:campfire_smoke_particle', {x: x, y: y+1, z:z});
				block.dimension.runCommandAsync(`loot spawn ${x} ${y+1} ${z} loot "${lootTable}"`);
			}
		}
	});
	blockComponentRegistry.registerCustomComponent('str:choppingBlock', {
		onPlayerInteract: data => {
			const {block,player} = data;
			if (!player.getComponent('equippable').getEquipment('Mainhand')) return;
			const choppingChance = Math.random()*100;
			const mainHand = player.getComponent('equippable').getEquipment('Mainhand');
			const choppingBlock = logTypes[mainHand.typeId];
			const choppingState = logTypes[block.permutation.getState('str:type')][block.permutation.getState('str:log')];
			if (mainHand && choppingBlock && block.permutation.getState('str:log') == 1) {
				block.setPermutation(block.permutation.withState('str:log', choppingBlock.stateValue).withState('str:type', choppingBlock.logType));
				mainHand.amountDecrease(player, 'Mainhand');
				block.dimension.playSound("dig.wood", block.location);
			} else if (choppingChance <= 50 && mainHand && mainHand.hasTag('minecraft:is_axe') && choppingState) {
				block.setPermutation(block.permutation.withState('str:log', 1));
				mainHand.durabilityModifier(player, 'Mainhand');
				lootTable(block, player, choppingState);
				block.dimension.playSound("dig.wood", block.location, {volume: 1.0});
			} else if (choppingChance > 50 && mainHand && mainHand.hasTag('minecraft:is_axe') && choppingState) {
				mainHand.durabilityModifier(player, 'Mainhand');
				block.dimension.playSound("dig.wood", block.location, {volume: 1.0});
			}
		}
	});
	blockComponentRegistry.registerCustomComponent('str:lit_torch', {
		onTick: data => {
			const {block} = data;
			block.dimension.spawnParticle('minecraft:basic_smoke_particle', block.location);
				block.setPermutation(block.permutation.withState('str:light', 0));
				block.dimension.playSound('random.fizz', block.location, {volume: 1.0});
		}
	});
	blockComponentRegistry.registerCustomComponent('str:unlit_torch', {
		onPlayerInteract: data => {
			const {block,player} = data;
			const mainHand = player.getComponent('equippable').getEquipment('Mainhand');
			if (mainHand.typeId == 'minecraft:flint_and_steel' || mainHand.typeId == 'str:matchbox') {
				mainHand.durabilityModifier(player, 'Mainhand');
				block.dimension.spawnParticle('minecraft:basic_flame_particle', block.location);
				block.setPermutation(block.permutation.withState('str:light', 1));
				block.dimension.playSound('fire.ignite', block.location, {volume: 1.0});
			}
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:structure_ancient_castle_on_random_tick", {
		onRandomTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.runCommandAsync(`structure load "ancient_castle_01" ${eventData.block.location.x - 22} ${eventData.block.location.y - 1} ${eventData.block.location.z - 22}`);
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:structure_ancient_castle_on_tick", {
		onTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.runCommandAsync(`structure load "ancient_castle_01" ${eventData.block.location.x - 22} ${eventData.block.location.y - 1} ${eventData.block.location.z - 22}`);
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_allay_on_random_tick", {
		onRandomTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:allay", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_allay_on_tick", {
		onTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:allay", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_blaze_on_random_tick", {
		onRandomTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:blaze", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_blaze_on_tick", {
		onTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:blaze", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_cat_on_random_tick", {
		onRandomTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:cat", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_cat_on_tick", {
		onTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:cat", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_hoglin_on_random_tick", {
		onRandomTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:hoglin", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_hoglin_on_tick", {
		onTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:hoglin", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_pig_on_random_tick", {
		onRandomTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:pig", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_pig_on_tick", {
		onTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:pig", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_piglin_on_random_tick", {
		onRandomTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:piglin", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_piglin_on_tick", {
		onTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:piglin", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_piglin_brute_on_random_tick", {
		onRandomTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:piglin_brute", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_piglin_brute_on_tick", {
		onTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:piglin_brute", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_pillager_on_random_tick", {
		onRandomTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:pillager", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_pillager_on_tick", {
		onTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:pillager", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_rabbit_on_random_tick", {
		onRandomTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:rabbit", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_rabbit_on_tick", {
		onTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:rabbit", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_skeleton_on_random_tick", {
		onRandomTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:skeleton", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_skeleton_on_tick", {
		onTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:skeleton", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_skeleton_horse_on_random_tick", {
		onRandomTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:skeleton_horse", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_skeleton_horse_on_tick", {
		onTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:skeleton_horse", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_villager_on_random_tick", {
		onRandomTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:villager", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_villager_on_tick", {
		onTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:villager", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_witch_on_random_tick", {
		onRandomTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:witch", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_witch_on_tick", {
		onTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:witch", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_wither_skeleton_on_random_tick", {
		onRandomTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:wither_skeleton", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_wither_skeleton_on_tick", {
		onTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:wither_skeleton", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_zoglin_on_random_tick", {
		onRandomTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:zoglin", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_zoglin_on_tick", {
		onTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:zoglin", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_zombie_horse_on_random_tick", {
		onRandomTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:zombie_horse", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_zombie_horse_on_tick", {
		onTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:zombie_horse", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_zombie_villager_on_random_tick", {
		onRandomTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:zombie_villager", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_zombie_villager_on_tick", {
		onTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:zombie_villager", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_zombified_piglin_on_random_tick", {
		onRandomTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:zombie_pigman", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_zombified_piglin_on_tick", {
		onTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("minecraft:zombie_pigman", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	const mineshaftStructureSpawner = [
		"nicothekid:structure_mineshaft_ancient",
		"nicothekid:structure_mineshaft_oak",
		"nicothekid:structure_mineshaft_spruce",
		"nicothekid:structure_msa_arch_way_east",
		"nicothekid:structure_msa_arch_way_north",
		"nicothekid:structure_msa_arch_way_south",
		"nicothekid:structure_msa_arch_way_west",
		"nicothekid:structure_msa_way_east",
		"nicothekid:structure_msa_way_north",
		"nicothekid:structure_msa_way_south",
		"nicothekid:structure_msa_way_west",
		"nicothekid:structure_mso_ground_way_east",
		"nicothekid:structure_mso_ground_way_north",
		"nicothekid:structure_mso_ground_way_south",
		"nicothekid:structure_mso_ground_way_west",
		"nicothekid:structure_mso_way_east",
		"nicothekid:structure_mso_way_north",
		"nicothekid:structure_mso_way_south",
		"nicothekid:structure_mso_way_west",
		"nicothekid:structure_mss_way_east",
		"nicothekid:structure_mss_way_north",
		"nicothekid:structure_mss_way_south",
		"nicothekid:structure_mss_way_west"
	];
	blockComponentRegistry.registerCustomComponent("nicothekid:structure_mineshaft_on_random_tick", {
		onRandomTick: eventData => {
			const block = eventData.block;
			const blockLocation = block.location;
			if (mineshaftStructureSpawner.includes(block.typeId)) {
				let randomChance = Math.random() * (100.0 - 0.0) + 0.0;
				if (block.permutation.matches("nicothekid:structure_mineshaft_ancient")) {
					block.setPermutation(BlockPermutation.resolve("minecraft:air"));
					block.dimension.runCommandAsync(`structure load mineshaft_ancient_01 ${blockLocation.x - 18} ${blockLocation.y - 3} ${blockLocation.z - 18}`);
				}
				if (block.permutation.matches("nicothekid:structure_mineshaft_oak")) {
					block.setPermutation(BlockPermutation.resolve("minecraft:air"));
					block.dimension.runCommandAsync(`structure load mineshaft_oak_01 ${blockLocation.x - 11} ${blockLocation.y - 1} ${blockLocation.z - 11}`);
				}
				if (block.permutation.matches("nicothekid:structure_mineshaft_spruce")) {
					block.setPermutation(BlockPermutation.resolve("minecraft:air"));
					block.dimension.runCommandAsync(`structure load mineshaft_spruce_01 ${blockLocation.x - 14} ${blockLocation.y - 1} ${blockLocation.z - 14}`);
				}
				if (block.permutation.matches("nicothekid:structure_msa_arch_way_east")) {
					system.run(() => {
						block.setPermutation(BlockPermutation.resolve("minecraft:air"));
						if (randomChance <= 12.7) {
							block.dimension.runCommandAsync(`structure load msa_arch_way_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 25.4) {
							block.dimension.runCommandAsync(`structure load msa_arch_way_east_02 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 38.1) {
							block.dimension.runCommandAsync(`structure load msa_arch_way_east_03 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 50.8) {
							block.dimension.runCommandAsync(`structure load msa_arch_way_east_04 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 63.5) {
							block.dimension.runCommandAsync(`structure load msa_arch_way_east_05 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 76.2) {
							block.dimension.runCommandAsync(`structure load msa_arch_way_east_06 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 78.8) {
							block.dimension.runCommandAsync(`structure load msa_room_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else if (randomChance <= 81.4) {
							block.dimension.runCommandAsync(`structure load msa_room_east_02 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else if (randomChance <= 84) {
							block.dimension.runCommandAsync(`structure load msa_room_east_03 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else if (randomChance <= 86.6) {
							block.dimension.runCommandAsync(`structure load msa_room_east_04 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else if (randomChance <= 89.2) {
							block.dimension.runCommandAsync(`structure load msa_room_east_05 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else if (randomChance <= 91.8) {
							block.dimension.runCommandAsync(`structure load msa_spider_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else if (randomChance <= 94.4) {
							block.dimension.runCommandAsync(`structure load msa_zombie_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else return;
					});
				}
				if (block.permutation.matches("nicothekid:structure_msa_arch_way_north")) {
					system.run(() => {
						block.setPermutation(BlockPermutation.resolve("minecraft:air"));
						if (randomChance <= 12.7) {
							block.dimension.runCommandAsync(`structure load msa_arch_way_north_01 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 25.4) {
							block.dimension.runCommandAsync(`structure load msa_arch_way_north_02 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 38.1) {
							block.dimension.runCommandAsync(`structure load msa_arch_way_north_03 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 50.8) {
							block.dimension.runCommandAsync(`structure load msa_arch_way_north_04 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 63.5) {
							block.dimension.runCommandAsync(`structure load msa_arch_way_north_05 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 76.2) {
							block.dimension.runCommandAsync(`structure load msa_arch_way_north_06 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 78.8) {
							block.dimension.runCommandAsync(`structure load msa_room_north_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 10}`);
						} else if (randomChance <= 81.4) {
							block.dimension.runCommandAsync(`structure load msa_room_north_02 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 10}`);
						} else if (randomChance <= 84) {
							block.dimension.runCommandAsync(`structure load msa_room_north_03 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 10}`);
						} else if (randomChance <= 86.6) {
							block.dimension.runCommandAsync(`structure load msa_room_north_04 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 10}`);
						} else if (randomChance <= 89.2) {
							block.dimension.runCommandAsync(`structure load msa_room_north_05 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 10}`);
						} else if (randomChance <= 91.8) {
							block.dimension.runCommandAsync(`structure load msa_spider_north_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 10}`);
						} else if (randomChance <= 94.4) {
							block.dimension.runCommandAsync(`structure load msa_zombie_north_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 10}`);
						} else return;
					});
				}
				if (block.permutation.matches("nicothekid:structure_msa_arch_way_south")) {
					system.run(() => {
						block.setPermutation(BlockPermutation.resolve("minecraft:air"));
						if (randomChance <= 12.7) {
							block.dimension.runCommandAsync(`structure load msa_arch_way_south_01 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 25.4) {
							block.dimension.runCommandAsync(`structure load msa_arch_way_south_02 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 38.1) {
							block.dimension.runCommandAsync(`structure load msa_arch_way_south_03 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 50.8) {
							block.dimension.runCommandAsync(`structure load msa_arch_way_south_04 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 63.5) {
							block.dimension.runCommandAsync(`structure load msa_arch_way_south_05 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 76.2) {
							block.dimension.runCommandAsync(`structure load msa_arch_way_south_06 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 78.8) {
							block.dimension.runCommandAsync(`structure load msa_room_south_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 81.4) {
							block.dimension.runCommandAsync(`structure load msa_room_south_02 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 84) {
							block.dimension.runCommandAsync(`structure load msa_room_south_03 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 86.6) {
							block.dimension.runCommandAsync(`structure load msa_room_south_04 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 89.2) {
							block.dimension.runCommandAsync(`structure load msa_room_south_05 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 91.8) {
							block.dimension.runCommandAsync(`structure load msa_spider_south_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 94.4) {
							block.dimension.runCommandAsync(`structure load msa_zombie_south_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else return;
					});
				}
				if (block.permutation.matches("nicothekid:structure_msa_arch_way_west")) {
					system.run(() => {
						block.setPermutation(BlockPermutation.resolve("minecraft:air"));
						if (randomChance <= 12.7) {
							block.dimension.runCommandAsync(`structure load msa_arch_way_west_01 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 25.4) {
							block.dimension.runCommandAsync(`structure load msa_arch_way_west_02 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 38.1) {
							block.dimension.runCommandAsync(`structure load msa_arch_way_west_03 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 50.8) {
							block.dimension.runCommandAsync(`structure load msa_arch_way_west_04 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 63.5) {
							block.dimension.runCommandAsync(`structure load msa_arch_way_west_05 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 76.2) {
							block.dimension.runCommandAsync(`structure load msa_arch_way_west_06 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 78.8) {
							block.dimension.runCommandAsync(`structure load msa_room_west_01 ${blockLocation.x - 10} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else if (randomChance <= 81.4) {
							block.dimension.runCommandAsync(`structure load msa_room_west_02 ${blockLocation.x - 10} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else if (randomChance <= 84) {
							block.dimension.runCommandAsync(`structure load msa_room_west_03 ${blockLocation.x - 10} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else if (randomChance <= 86.6) {
							block.dimension.runCommandAsync(`structure load msa_room_west_04 ${blockLocation.x - 10} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else if (randomChance <= 89.2) {
							block.dimension.runCommandAsync(`structure load msa_room_west_05 ${blockLocation.x - 10} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else if (randomChance <= 91.8) {
							block.dimension.runCommandAsync(`structure load msa_spider_west_01 ${blockLocation.x - 10} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else if (randomChance <= 94.4) {
							block.dimension.runCommandAsync(`structure load msa_zombie_west_01 ${blockLocation.x - 10} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else return;
					});
				}
				if (block.permutation.matches("nicothekid:structure_msa_way_east")) {
					system.run(() => {
						block.setPermutation(BlockPermutation.resolve("minecraft:air"));
						if (randomChance <= 5.1) {
							block.dimension.runCommandAsync(`structure load msa_way_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 10.2) {
							block.dimension.runCommandAsync(`structure load msa_way_east_02 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 15.3) {
							block.dimension.runCommandAsync(`structure load msa_way_east_03 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 20.4) {
							block.dimension.runCommandAsync(`structure load msa_way_east_04 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 25) {
							block.dimension.runCommandAsync(`structure load msa_way_east_05 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 30.6) {
							block.dimension.runCommandAsync(`structure load msa_way_east_06 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 35.7) {
							block.dimension.runCommandAsync(`structure load msa_way_east_07 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 40.8) {
							block.dimension.runCommandAsync(`structure load msa_way_east_08 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 45.9) {
							block.dimension.runCommandAsync(`structure load msa_way_east_09 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 51) {
							block.dimension.runCommandAsync(`structure load msa_way_east_10 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 56.1) {
							block.dimension.runCommandAsync(`structure load msa_way_east_11 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 61.2) {
							block.dimension.runCommandAsync(`structure load msa_way_east_12 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 63.8) {
							block.dimension.runCommandAsync(`structure load msa_room_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else if (randomChance <= 66.4) {
							block.dimension.runCommandAsync(`structure load msa_room_east_02 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else if (randomChance <= 69) {
							block.dimension.runCommandAsync(`structure load msa_room_east_03 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else if (randomChance <= 71.6) {
							block.dimension.runCommandAsync(`structure load msa_room_east_04 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else if (randomChance <= 74.2) {
							block.dimension.runCommandAsync(`structure load msa_room_east_05 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else if (randomChance <= 76.8) {
							block.dimension.runCommandAsync(`structure load msa_spider_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else if (randomChance <= 79.4) {
							block.dimension.runCommandAsync(`structure load msa_zombie_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else return;
					});
				}
				if (block.permutation.matches("nicothekid:structure_msa_way_north")) {
					system.run(() => {
						block.setPermutation(BlockPermutation.resolve("minecraft:air"));
						if (randomChance <= 5.1) {
							block.dimension.runCommandAsync(`structure load msa_way_north_01 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 10.2) {
							block.dimension.runCommandAsync(`structure load msa_way_north_02 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 15.3) {
							block.dimension.runCommandAsync(`structure load msa_way_north_03 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 20.4) {
							block.dimension.runCommandAsync(`structure load msa_way_north_04 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 25) {
							block.dimension.runCommandAsync(`structure load msa_way_north_05 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 30.6) {
							block.dimension.runCommandAsync(`structure load msa_way_north_06 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 35.7) {
							block.dimension.runCommandAsync(`structure load msa_way_north_07 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 40.8) {
							block.dimension.runCommandAsync(`structure load msa_way_north_08 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 45.9) {
							block.dimension.runCommandAsync(`structure load msa_way_north_09 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 51) {
							block.dimension.runCommandAsync(`structure load msa_way_north_10 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 56.1) {
							block.dimension.runCommandAsync(`structure load msa_way_north_11 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 61.2) {
							block.dimension.runCommandAsync(`structure load msa_way_north_12 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 63.8) {
							block.dimension.runCommandAsync(`structure load msa_room_north_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 10}`);
						} else if (randomChance <= 66.4) {
							block.dimension.runCommandAsync(`structure load msa_room_north_02 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 10}`);
						} else if (randomChance <= 69) {
							block.dimension.runCommandAsync(`structure load msa_room_north_03 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 10}`);
						} else if (randomChance <= 71.6) {
							block.dimension.runCommandAsync(`structure load msa_room_north_04 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 10}`);
						} else if (randomChance <= 74.2) {
							block.dimension.runCommandAsync(`structure load msa_room_north_05 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 10}`);
						} else if (randomChance <= 76.8) {
							block.dimension.runCommandAsync(`structure load msa_spider_north_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 10}`);
						} else if (randomChance <= 79.4) {
							block.dimension.runCommandAsync(`structure load msa_zombie_north_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 10}`);
						} else return;
					});
				}
				if (block.permutation.matches("nicothekid:structure_msa_way_south")) {
					system.run(() => {
						block.setPermutation(BlockPermutation.resolve("minecraft:air"));
						if (randomChance <= 5.1) {
							block.dimension.runCommandAsync(`structure load msa_way_south_01 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 10.2) {
							block.dimension.runCommandAsync(`structure load msa_way_south_02 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 15.3) {
							block.dimension.runCommandAsync(`structure load msa_way_south_03 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 20.4) {
							block.dimension.runCommandAsync(`structure load msa_way_south_04 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 25) {
							block.dimension.runCommandAsync(`structure load msa_way_south_05 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 30.6) {
							block.dimension.runCommandAsync(`structure load msa_way_south_06 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 35.7) {
							block.dimension.runCommandAsync(`structure load msa_way_south_07 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 40.8) {
							block.dimension.runCommandAsync(`structure load msa_way_south_08 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 45.9) {
							block.dimension.runCommandAsync(`structure load msa_way_south_09 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 51) {
							block.dimension.runCommandAsync(`structure load msa_way_south_10 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 56.1) {
							block.dimension.runCommandAsync(`structure load msa_way_south_11 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 61.2) {
							block.dimension.runCommandAsync(`structure load msa_way_south_12 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 63.8) {
							block.dimension.runCommandAsync(`structure load msa_room_south_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 66.4) {
							block.dimension.runCommandAsync(`structure load msa_room_south_02 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 69) {
							block.dimension.runCommandAsync(`structure load msa_room_south_03 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 71.6) {
							block.dimension.runCommandAsync(`structure load msa_room_south_04 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 74.2) {
							block.dimension.runCommandAsync(`structure load msa_room_south_05 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 76.8) {
							block.dimension.runCommandAsync(`structure load msa_spider_south_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 79.4) {
							block.dimension.runCommandAsync(`structure load msa_zombie_south_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else return;
					});
				}
				if (block.permutation.matches("nicothekid:structure_msa_way_west")) {
					system.run(() => {
						block.setPermutation(BlockPermutation.resolve("minecraft:air"));
						if (randomChance <= 5.1) {
							block.dimension.runCommandAsync(`structure load msa_way_west_01 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 10.2) {
							block.dimension.runCommandAsync(`structure load msa_way_west_02 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 15.3) {
							block.dimension.runCommandAsync(`structure load msa_way_west_03 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 20.4) {
							block.dimension.runCommandAsync(`structure load msa_way_west_04 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 25) {
							block.dimension.runCommandAsync(`structure load msa_way_west_05 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 30.6) {
							block.dimension.runCommandAsync(`structure load msa_way_west_06 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 35.7) {
							block.dimension.runCommandAsync(`structure load msa_way_west_07 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 40.8) {
							block.dimension.runCommandAsync(`structure load msa_way_west_08 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 45.9) {
							block.dimension.runCommandAsync(`structure load msa_way_west_09 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 51) {
							block.dimension.runCommandAsync(`structure load msa_way_west_10 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 56.1) {
							block.dimension.runCommandAsync(`structure load msa_way_west_11 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 61.2) {
							block.dimension.runCommandAsync(`structure load msa_way_west_12 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 63.8) {
							block.dimension.runCommandAsync(`structure load msa_room_west_01 ${blockLocation.x - 10} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else if (randomChance <= 66.4) {
							block.dimension.runCommandAsync(`structure load msa_room_west_02 ${blockLocation.x - 10} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else if (randomChance <= 69) {
							block.dimension.runCommandAsync(`structure load msa_room_west_03 ${blockLocation.x - 10} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else if (randomChance <= 71.6) {
							block.dimension.runCommandAsync(`structure load msa_room_west_04 ${blockLocation.x - 10} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else if (randomChance <= 74.2) {
							block.dimension.runCommandAsync(`structure load msa_room_west_05 ${blockLocation.x - 10} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else if (randomChance <= 76.8) {
							block.dimension.runCommandAsync(`structure load msa_spider_west_01 ${blockLocation.x - 10} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else if (randomChance <= 79.4) {
							block.dimension.runCommandAsync(`structure load msa_zombie_west_01 ${blockLocation.x - 10} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else return;
					});
				}
				if (block.permutation.matches("nicothekid:structure_mso_ground_way_east")) {
					system.run(() => {
						block.setPermutation(BlockPermutation.resolve("minecraft:air"));
						if (randomChance <= 20.0) {
							block.dimension.runCommandAsync(`structure load mso_ground_way_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 40.0) {
							block.dimension.runCommandAsync(`structure load mso_ground_way_east_02 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 60.0) {
							block.dimension.runCommandAsync(`structure load mso_ground_way_east_03 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 80.0) {
							block.dimension.runCommandAsync(`structure load mso_ground_way_east_04 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 86.7) {
							block.dimension.runCommandAsync(`structure load mso_ground_room_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else if (randomChance <= 93.4) {
							block.dimension.runCommandAsync(`structure load mso_ground_room_east_02 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else if (randomChance <= 97.7) {
							block.dimension.runCommandAsync(`structure load mso_ground_spider_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else if (randomChance <= 100.0) {
							block.dimension.runCommandAsync(`structure load mso_ground_zombie_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else return;
					});
				}
				if (block.permutation.matches("nicothekid:structure_mso_ground_way_north")) {
					system.run(() => {
						block.setPermutation(BlockPermutation.resolve("minecraft:air"));
						if (randomChance <= 20.0) {
							block.dimension.runCommandAsync(`structure load mso_ground_way_north_01 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 7}`);
						} else if (randomChance <= 40.0) {
							block.dimension.runCommandAsync(`structure load mso_ground_way_north_02 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 7}`);
						} else if (randomChance <= 60.0) {
							block.dimension.runCommandAsync(`structure load mso_ground_way_north_03 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 7}`);
						} else if (randomChance <= 80.0) {
							block.dimension.runCommandAsync(`structure load mso_ground_way_north_04 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 7}`);
						} else if (randomChance <= 86.7) {
							block.dimension.runCommandAsync(`structure load mso_ground_room_north_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 11}`);
						} else if (randomChance <= 93.4) {
							block.dimension.runCommandAsync(`structure load mso_ground_room_north_02 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 11}`);
						} else if (randomChance <= 97.7) {
							block.dimension.runCommandAsync(`structure load mso_ground_spider_north_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 11}`);
						} else if (randomChance <= 100.0) {
							block.dimension.runCommandAsync(`structure load mso_ground_zombie_north_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 11}`);
						} else return;
					});
				}
				if (block.permutation.matches("nicothekid:structure_mso_ground_way_south")) {
					system.run(() => {
						block.setPermutation(BlockPermutation.resolve("minecraft:air"));
						if (randomChance <= 20.0) {
							block.dimension.runCommandAsync(`structure load mso_ground_way_south_01 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 40.0) {
							block.dimension.runCommandAsync(`structure load mso_ground_way_south_02 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 60.0) {
							block.dimension.runCommandAsync(`structure load mso_ground_way_south_03 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 80) {
							block.dimension.runCommandAsync(`structure load mso_ground_way_south_04 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 86.7) {
							block.dimension.runCommandAsync(`structure load mso_ground_room_south_01 ${blockLocation.x - 6} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 93.4) {
							block.dimension.runCommandAsync(`structure load mso_ground_room_south_02 ${blockLocation.x - 6} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 97.7) {
							block.dimension.runCommandAsync(`structure load mso_ground_spider_south_01 ${blockLocation.x - 6} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 100.0) {
							block.dimension.runCommandAsync(`structure load mso_ground_zombie_south_01 ${blockLocation.x - 6} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else return;
					});
				}
				if (block.permutation.matches("nicothekid:structure_mso_ground_way_west")) {
					system.run(() => {
						block.setPermutation(BlockPermutation.resolve("minecraft:air"));
						if (randomChance <= 20.0) {
							block.dimension.runCommandAsync(`structure load mso_ground_way_west_01 ${blockLocation.x - 7} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 40.0) {
							block.dimension.runCommandAsync(`structure load mso_ground_way_west_02 ${blockLocation.x - 7} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 60.0) {
							block.dimension.runCommandAsync(`structure load mso_ground_way_west_03 ${blockLocation.x - 7} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 80.0) {
							block.dimension.runCommandAsync(`structure load mso_ground_way_west_04 ${blockLocation.x - 7} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 86.7) {
							block.dimension.runCommandAsync(`structure load mso_ground_room_west_01 ${blockLocation.x - 11} ${blockLocation.y - 1} ${blockLocation.z - 6}`);
						} else if (randomChance <= 93.4) {
							block.dimension.runCommandAsync(`structure load mso_ground_room_west_02 ${blockLocation.x - 11} ${blockLocation.y - 1} ${blockLocation.z - 6}`);
						} else if (randomChance <= 97.7) {
							block.dimension.runCommandAsync(`structure load mso_ground_spider_west_01 ${blockLocation.x - 11} ${blockLocation.y - 1} ${blockLocation.z - 6}`);
						} else if (randomChance <= 100.0) {
							block.dimension.runCommandAsync(`structure load mso_ground_zombie_west_01 ${blockLocation.x - 11} ${blockLocation.y - 1} ${blockLocation.z - 6}`);
						} else return;
					});
				}
				if (block.permutation.matches("nicothekid:structure_mso_way_east")) {
					system.run(() => {
						block.setPermutation(BlockPermutation.resolve("minecraft:air"));
						if (randomChance <= 6.7) {
							block.dimension.runCommandAsync(`structure load mso_way_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 13.4) {
							block.dimension.runCommandAsync(`structure load mso_way_east_02 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 20.1) {
							block.dimension.runCommandAsync(`structure load mso_way_east_03 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 26.8) {
							block.dimension.runCommandAsync(`structure load mso_way_east_04 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 33.5) {
							block.dimension.runCommandAsync(`structure load mso_way_east_05 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 40.2) {
							block.dimension.runCommandAsync(`structure load mso_way_east_06 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 46.9) {
							block.dimension.runCommandAsync(`structure load mso_way_east_07 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 53.6) {
							block.dimension.runCommandAsync(`structure load mso_way_east_08 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 60.3) {
							block.dimension.runCommandAsync(`structure load mso_way_east_09 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 67) {
							block.dimension.runCommandAsync(`structure load mso_way_east_10 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 70.3) {
							block.dimension.runCommandAsync(`structure load mso_room_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else if (randomChance <= 73.6) {
							block.dimension.runCommandAsync(`structure load mso_room_east_02 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else if (randomChance <= 76.9) {
							block.dimension.runCommandAsync(`structure load mso_spider_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else if (randomChance <= 80.2) {
							block.dimension.runCommandAsync(`structure load mso_zombie_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
						} else return;
					});
				}
				if (block.permutation.matches("nicothekid:structure_mso_way_north")) {
					system.run(() => {
						block.setPermutation(BlockPermutation.resolve("minecraft:air"));
						if (randomChance <= 6.7) {
							block.dimension.runCommandAsync(`structure load mso_way_north_01 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 7}`);
						} else if (randomChance <= 13.4) {
							block.dimension.runCommandAsync(`structure load mso_way_north_02 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 7}`);
						} else if (randomChance <= 20.1) {
							block.dimension.runCommandAsync(`structure load mso_way_north_03 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 7}`);
						} else if (randomChance <= 26.8) {
							block.dimension.runCommandAsync(`structure load mso_way_north_04 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 7}`);
						} else if (randomChance <= 33.5) {
							block.dimension.runCommandAsync(`structure load mso_way_north_05 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 7}`);
						} else if (randomChance <= 40.2) {
							block.dimension.runCommandAsync(`structure load mso_way_north_06 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 7}`);
						} else if (randomChance <= 46.9) {
							block.dimension.runCommandAsync(`structure load mso_way_north_07 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 7}`);
						} else if (randomChance <= 53.6) {
							block.dimension.runCommandAsync(`structure load mso_way_north_08 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 7}`);
						} else if (randomChance <= 60.3) {
							block.dimension.runCommandAsync(`structure load mso_way_north_09 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 7}`);
						} else if (randomChance <= 67) {
							block.dimension.runCommandAsync(`structure load mso_way_north_10 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 7}`);
						} else if (randomChance <= 70.3) {
							block.dimension.runCommandAsync(`structure load mso_room_north_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 11}`);
						} else if (randomChance <= 73.6) {
							block.dimension.runCommandAsync(`structure load mso_room_north_02 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 11}`);
						} else if (randomChance <= 76.9) {
							block.dimension.runCommandAsync(`structure load mso_spider_north_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 11}`);
						} else if (randomChance <= 80.2) {
							block.dimension.runCommandAsync(`structure load mso_zombie_north_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 11}`);
						} else return;
					});
				}
				if (block.permutation.matches("nicothekid:structure_mso_way_south")) {
					system.run(() => {
						block.setPermutation(BlockPermutation.resolve("minecraft:air"));
						if (randomChance <= 6.7) {
							block.dimension.runCommandAsync(`structure load mso_way_south_01 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 13.4) {
							block.dimension.runCommandAsync(`structure load mso_way_south_02 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 20.1) {
							block.dimension.runCommandAsync(`structure load mso_way_south_03 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 26.8) {
							block.dimension.runCommandAsync(`structure load mso_way_south_04 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 33.5) {
							block.dimension.runCommandAsync(`structure load mso_way_south_05 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 40.2) {
							block.dimension.runCommandAsync(`structure load mso_way_south_06 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 46.9) {
							block.dimension.runCommandAsync(`structure load mso_way_south_07 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 53.6) {
							block.dimension.runCommandAsync(`structure load mso_way_south_08 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 60.3) {
							block.dimension.runCommandAsync(`structure load mso_way_south_09 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 67) {
							block.dimension.runCommandAsync(`structure load mso_way_south_10 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 70.3) {
							block.dimension.runCommandAsync(`structure load mso_room_south_01 ${blockLocation.x - 6} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 73.6) {
							block.dimension.runCommandAsync(`structure load mso_room_south_02 ${blockLocation.x - 6} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 76.9) {
							block.dimension.runCommandAsync(`structure load mso_spider_south_01 ${blockLocation.x - 6} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 80.2) {
							block.dimension.runCommandAsync(`structure load mso_zombie_south_01 ${blockLocation.x - 6} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else return;
					});
				}
				if (block.permutation.matches("nicothekid:structure_mso_way_west")) {
					system.run(() => {
						block.setPermutation(BlockPermutation.resolve("minecraft:air"));
						if (randomChance <= 6.7) {
							block.dimension.runCommandAsync(`structure load mso_way_west_01 ${blockLocation.x - 7} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 13.4) {
							block.dimension.runCommandAsync(`structure load mso_way_west_02 ${blockLocation.x - 7} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 20.1) {
							block.dimension.runCommandAsync(`structure load mso_way_west_03 ${blockLocation.x - 7} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 26.8) {
							block.dimension.runCommandAsync(`structure load mso_way_west_04 ${blockLocation.x - 7} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 33.5) {
							block.dimension.runCommandAsync(`structure load mso_way_west_05 ${blockLocation.x - 7} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 40.2) {
							block.dimension.runCommandAsync(`structure load mso_way_west_06 ${blockLocation.x - 7} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 46.9) {
							block.dimension.runCommandAsync(`structure load mso_way_west_07 ${blockLocation.x - 7} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 53.6) {
							block.dimension.runCommandAsync(`structure load mso_way_west_08 ${blockLocation.x - 7} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 60.3) {
							block.dimension.runCommandAsync(`structure load mso_way_west_09 ${blockLocation.x - 7} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 67) {
							block.dimension.runCommandAsync(`structure load mso_way_west_10 ${blockLocation.x - 7} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
						} else if (randomChance <= 70.3) {
							block.dimension.runCommandAsync(`structure load mso_room_west_01 ${blockLocation.x - 11} ${blockLocation.y - 1} ${blockLocation.z - 6}`);
						} else if (randomChance <= 73.6) {
							block.dimension.runCommandAsync(`structure load mso_room_west_02 ${blockLocation.x - 11} ${blockLocation.y - 1} ${blockLocation.z - 6}`);
						} else if (randomChance <= 76.9) {
							block.dimension.runCommandAsync(`structure load mso_spider_west_01 ${blockLocation.x - 11} ${blockLocation.y - 1} ${blockLocation.z - 6}`);
						} else if (randomChance <= 80.2) {
							block.dimension.runCommandAsync(`structure load mso_zombie_west_01 ${blockLocation.x - 11} ${blockLocation.y - 1} ${blockLocation.z - 6}`);
						} else return;
					});
				}
				if (block.permutation.matches("nicothekid:structure_mss_way_east")) {
					system.run(() => {
						block.setPermutation(BlockPermutation.resolve("minecraft:air"));
						if (randomChance <= 5.4) {
							block.dimension.runCommandAsync(`structure load mss_way_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 10.8) {
							block.dimension.runCommandAsync(`structure load mss_way_east_02 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 16.2) {
							block.dimension.runCommandAsync(`structure load mss_way_east_03 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 21.6) {
							block.dimension.runCommandAsync(`structure load mss_way_east_04 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 27) {
							block.dimension.runCommandAsync(`structure load mss_way_east_05 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 32.4) {
							block.dimension.runCommandAsync(`structure load mss_way_east_06 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 37.8) {
							block.dimension.runCommandAsync(`structure load mss_way_east_07 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 43.2) {
							block.dimension.runCommandAsync(`structure load mss_way_east_08 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 48.6) {
							block.dimension.runCommandAsync(`structure load mss_way_east_09 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 54) {
							block.dimension.runCommandAsync(`structure load mss_way_east_10 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 59.3) {
							block.dimension.runCommandAsync(`structure load mss_way_east_11 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 64.8) {
							block.dimension.runCommandAsync(`structure load mss_way_east_12 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 67.5) {
							block.dimension.runCommandAsync(`structure load mss_room_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 4}`);
						} else if (randomChance <= 70.2) {
							block.dimension.runCommandAsync(`structure load mss_room_east_02 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 4}`);
						} else if (randomChance <= 72.9) {
							block.dimension.runCommandAsync(`structure load mss_room_east_03 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 4}`);
						} else if (randomChance <= 75.6) {
							block.dimension.runCommandAsync(`structure load mss_room_east_04 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 4}`);
						} else if (randomChance <= 78.3) {
							block.dimension.runCommandAsync(`structure load mss_spider_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 4}`);
						} else if (randomChance <= 81) {
							block.dimension.runCommandAsync(`structure load mss_zombie_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 4}`);
						} else return;
					});
				}
				if (block.permutation.matches("nicothekid:structure_mss_way_north")) {
					system.run(() => {
						block.setPermutation(BlockPermutation.resolve("minecraft:air"));
						if (randomChance <= 5.4) {
							block.dimension.runCommandAsync(`structure load mss_way_north_01 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 10.8) {
							block.dimension.runCommandAsync(`structure load mss_way_north_02 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 16.2) {
							block.dimension.runCommandAsync(`structure load mss_way_north_03 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 21.6) {
							block.dimension.runCommandAsync(`structure load mss_way_north_04 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 27) {
							block.dimension.runCommandAsync(`structure load mss_way_north_05 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 32.4) {
							block.dimension.runCommandAsync(`structure load mss_way_north_06 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 37.8) {
							block.dimension.runCommandAsync(`structure load mss_way_north_07 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 43.2) {
							block.dimension.runCommandAsync(`structure load mss_way_north_08 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 48.6) {
							block.dimension.runCommandAsync(`structure load mss_way_north_09 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 54) {
							block.dimension.runCommandAsync(`structure load mss_way_north_10 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 59.3) {
							block.dimension.runCommandAsync(`structure load mss_way_north_11 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 64.8) {
							block.dimension.runCommandAsync(`structure load mss_way_north_12 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 67.5) {
							block.dimension.runCommandAsync(`structure load mss_room_north_01 ${blockLocation.x - 4} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 70.2) {
							block.dimension.runCommandAsync(`structure load mss_room_north_02 ${blockLocation.x - 4} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 72.9) {
							block.dimension.runCommandAsync(`structure load mss_room_north_03 ${blockLocation.x - 4} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 75.6) {
							block.dimension.runCommandAsync(`structure load mss_room_north_04 ${blockLocation.x - 4} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 78.3) {
							block.dimension.runCommandAsync(`structure load mss_spider_north_01 ${blockLocation.x - 4} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else if (randomChance <= 81) {
							block.dimension.runCommandAsync(`structure load mss_zombie_north_01 ${blockLocation.x - 4} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
						} else return;
					});
				}
				if (block.permutation.matches("nicothekid:structure_mss_way_south")) {
					system.run(() => {
						block.setPermutation(BlockPermutation.resolve("minecraft:air"));
						if (randomChance <= 5.4) {
							block.dimension.runCommandAsync(`structure load mss_way_south_01 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 10.8) {
							block.dimension.runCommandAsync(`structure load mss_way_south_02 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 16.2) {
							block.dimension.runCommandAsync(`structure load mss_way_south_03 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 21.6) {
							block.dimension.runCommandAsync(`structure load mss_way_south_04 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 27) {
							block.dimension.runCommandAsync(`structure load mss_way_south_05 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 32.4) {
							block.dimension.runCommandAsync(`structure load mss_way_south_06 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 37.8) {
							block.dimension.runCommandAsync(`structure load mss_way_south_07 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 43.2) {
							block.dimension.runCommandAsync(`structure load mss_way_south_08 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 48.6) {
							block.dimension.runCommandAsync(`structure load mss_way_south_09 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 54) {
							block.dimension.runCommandAsync(`structure load mss_way_south_10 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 59.3) {
							block.dimension.runCommandAsync(`structure load mss_way_south_11 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 64.8) {
							block.dimension.runCommandAsync(`structure load mss_way_south_12 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 67.5) {
							block.dimension.runCommandAsync(`structure load mss_room_south_01 ${blockLocation.x - 4} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 70.2) {
							block.dimension.runCommandAsync(`structure load mss_room_south_02 ${blockLocation.x - 4} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 72.9) {
							block.dimension.runCommandAsync(`structure load mss_room_south_03 ${blockLocation.x - 4} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 75.6) {
							block.dimension.runCommandAsync(`structure load mss_room_south_04 ${blockLocation.x - 4} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 78.3) {
							block.dimension.runCommandAsync(`structure load mss_spider_south_01 ${blockLocation.x - 4} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else if (randomChance <= 81) {
							block.dimension.runCommandAsync(`structure load mss_zombie_south_01 ${blockLocation.x - 4} ${blockLocation.y - 1} ${blockLocation.z}`);
						} else return;
					});
				}
				if (block.permutation.matches("nicothekid:structure_mss_way_west")) {
					system.run(() => {
						block.setPermutation(BlockPermutation.resolve("minecraft:air"));
						if (randomChance <= 5.4) {
							block.dimension.runCommandAsync(`structure load mss_way_west_01 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 10.8) {
							block.dimension.runCommandAsync(`structure load mss_way_west_02 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 16.2) {
							block.dimension.runCommandAsync(`structure load mss_way_west_03 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 21.6) {
							block.dimension.runCommandAsync(`structure load mss_way_west_04 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 27) {
							block.dimension.runCommandAsync(`structure load mss_way_west_05 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 32.4) {
							block.dimension.runCommandAsync(`structure load mss_way_west_06 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 37.8) {
							block.dimension.runCommandAsync(`structure load mss_way_west_07 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 43.2) {
							block.dimension.runCommandAsync(`structure load mss_way_west_08 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 48.6) {
							block.dimension.runCommandAsync(`structure load mss_way_west_09 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 54) {
							block.dimension.runCommandAsync(`structure load mss_way_west_10 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 59.3) {
							block.dimension.runCommandAsync(`structure load mss_way_west_11 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 64.8) {
							block.dimension.runCommandAsync(`structure load mss_way_west_12 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
						} else if (randomChance <= 67.5) {
							block.dimension.runCommandAsync(`structure load mss_room_west_01 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 4}`);
						} else if (randomChance <= 70.2) {
							block.dimension.runCommandAsync(`structure load mss_room_west_02 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 4}`);
						} else if (randomChance <= 72.9) {
							block.dimension.runCommandAsync(`structure load mss_room_west_03 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 4}`);
						} else if (randomChance <= 75.6) {
							block.dimension.runCommandAsync(`structure load mss_room_west_04 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 4}`);
						} else if (randomChance <= 78.3) {
							block.dimension.runCommandAsync(`structure load mss_spider_west_01 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 4}`);
						} else if (randomChance <= 81) {
							block.dimension.runCommandAsync(`structure load mss_zombie_west_01 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 4}`);
						} else return;
					});
				}
			} else return;
		}
	});
	blockComponentRegistry.registerCustomComponent("nicothekid:structure_mineshaft_on_tick",
		{
			onTick: eventData => {
				const block = eventData.block;
				const blockLocation = block.location;
				if (mineshaftStructureSpawner.includes(block.typeId)) {
					let randomChance = Math.random() * (100.0 - 0.0) + 0.0;
					if (block.permutation.matches("nicothekid:structure_mineshaft_ancient")) {
						block.setPermutation(BlockPermutation.resolve("minecraft:air"));
						block.dimension.runCommandAsync(`structure load mineshaft_ancient_01 ${blockLocation.x - 18} ${blockLocation.y - 3} ${blockLocation.z - 18}`);
					}
					if (block.permutation.matches("nicothekid:structure_mineshaft_oak")) {
						block.setPermutation(BlockPermutation.resolve("minecraft:air"));
						block.dimension.runCommandAsync(`structure load mineshaft_oak_01 ${blockLocation.x - 11} ${blockLocation.y - 1} ${blockLocation.z - 11}`);
					}
					if (block.permutation.matches("nicothekid:structure_mineshaft_spruce")) {
						block.setPermutation(BlockPermutation.resolve("minecraft:air"));
						block.dimension.runCommandAsync(`structure load mineshaft_spruce_01 ${blockLocation.x - 14} ${blockLocation.y - 1} ${blockLocation.z - 14}`);
					}
					if (block.permutation.matches("nicothekid:structure_msa_arch_way_east")) {
						system.run(() => {
							block.setPermutation(BlockPermutation.resolve("minecraft:air"));
							if (randomChance <= 12.7) {
								block.dimension.runCommandAsync(`structure load msa_arch_way_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 25.4) {
								block.dimension.runCommandAsync(`structure load msa_arch_way_east_02 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 38.1) {
								block.dimension.runCommandAsync(`structure load msa_arch_way_east_03 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 50.8) {
								block.dimension.runCommandAsync(`structure load msa_arch_way_east_04 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 63.5) {
								block.dimension.runCommandAsync(`structure load msa_arch_way_east_05 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 76.2) {
								block.dimension.runCommandAsync(`structure load msa_arch_way_east_06 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 78.8) {
								block.dimension.runCommandAsync(`structure load msa_room_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else if (randomChance <= 81.4) {
								block.dimension.runCommandAsync(`structure load msa_room_east_02 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else if (randomChance <= 84) {
								block.dimension.runCommandAsync(`structure load msa_room_east_03 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else if (randomChance <= 86.6) {
								block.dimension.runCommandAsync(`structure load msa_room_east_04 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else if (randomChance <= 89.2) {
								block.dimension.runCommandAsync(`structure load msa_room_east_05 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else if (randomChance <= 91.8) {
								block.dimension.runCommandAsync(`structure load msa_spider_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else if (randomChance <= 94.4) {
								block.dimension.runCommandAsync(`structure load msa_zombie_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else return;
						});
					}
					if (block.permutation.matches("nicothekid:structure_msa_arch_way_north")) {
						system.run(() => {
							block.setPermutation(BlockPermutation.resolve("minecraft:air"));
							if (randomChance <= 12.7) {
								block.dimension.runCommandAsync(`structure load msa_arch_way_north_01 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 25.4) {
								block.dimension.runCommandAsync(`structure load msa_arch_way_north_02 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 38.1) {
								block.dimension.runCommandAsync(`structure load msa_arch_way_north_03 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 50.8) {
								block.dimension.runCommandAsync(`structure load msa_arch_way_north_04 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 63.5) {
								block.dimension.runCommandAsync(`structure load msa_arch_way_north_05 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 76.2) {
								block.dimension.runCommandAsync(`structure load msa_arch_way_north_06 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 78.8) {
								block.dimension.runCommandAsync(`structure load msa_room_north_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 10}`);
							} else if (randomChance <= 81.4) {
								block.dimension.runCommandAsync(`structure load msa_room_north_02 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 10}`);
							} else if (randomChance <= 84) {
								block.dimension.runCommandAsync(`structure load msa_room_north_03 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 10}`);
							} else if (randomChance <= 86.6) {
								block.dimension.runCommandAsync(`structure load msa_room_north_04 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 10}`);
							} else if (randomChance <= 89.2) {
								block.dimension.runCommandAsync(`structure load msa_room_north_05 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 10}`);
							} else if (randomChance <= 91.8) {
								block.dimension.runCommandAsync(`structure load msa_spider_north_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 10}`);
							} else if (randomChance <= 94.4) {
								block.dimension.runCommandAsync(`structure load msa_zombie_north_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 10}`);
							} else return;
						});
					}
					if (block.permutation.matches("nicothekid:structure_msa_arch_way_south")) {
						system.run(() => {
							block.setPermutation(BlockPermutation.resolve("minecraft:air"));
							if (randomChance <= 12.7) {
								block.dimension.runCommandAsync(`structure load msa_arch_way_south_01 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 25.4) {
								block.dimension.runCommandAsync(`structure load msa_arch_way_south_02 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 38.1) {
								block.dimension.runCommandAsync(`structure load msa_arch_way_south_03 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 50.8) {
								block.dimension.runCommandAsync(`structure load msa_arch_way_south_04 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 63.5) {
								block.dimension.runCommandAsync(`structure load msa_arch_way_south_05 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 76.2) {
								block.dimension.runCommandAsync(`structure load msa_arch_way_south_06 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 78.8) {
								block.dimension.runCommandAsync(`structure load msa_room_south_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 81.4) {
								block.dimension.runCommandAsync(`structure load msa_room_south_02 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 84) {
								block.dimension.runCommandAsync(`structure load msa_room_south_03 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 86.6) {
								block.dimension.runCommandAsync(`structure load msa_room_south_04 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 89.2) {
								block.dimension.runCommandAsync(`structure load msa_room_south_05 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 91.8) {
								block.dimension.runCommandAsync(`structure load msa_spider_south_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 94.4) {
								block.dimension.runCommandAsync(`structure load msa_zombie_south_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else return;
						});
					}
					if (block.permutation.matches("nicothekid:structure_msa_arch_way_west")) {
						system.run(() => {
							block.setPermutation(BlockPermutation.resolve("minecraft:air"));
							if (randomChance <= 12.7) {
								block.dimension.runCommandAsync(`structure load msa_arch_way_west_01 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 25.4) {
								block.dimension.runCommandAsync(`structure load msa_arch_way_west_02 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 38.1) {
								block.dimension.runCommandAsync(`structure load msa_arch_way_west_03 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 50.8) {
								block.dimension.runCommandAsync(`structure load msa_arch_way_west_04 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 63.5) {
								block.dimension.runCommandAsync(`structure load msa_arch_way_west_05 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 76.2) {
								block.dimension.runCommandAsync(`structure load msa_arch_way_west_06 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 78.8) {
								block.dimension.runCommandAsync(`structure load msa_room_west_01 ${blockLocation.x - 10} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else if (randomChance <= 81.4) {
								block.dimension.runCommandAsync(`structure load msa_room_west_02 ${blockLocation.x - 10} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else if (randomChance <= 84) {
								block.dimension.runCommandAsync(`structure load msa_room_west_03 ${blockLocation.x - 10} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else if (randomChance <= 86.6) {
								block.dimension.runCommandAsync(`structure load msa_room_west_04 ${blockLocation.x - 10} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else if (randomChance <= 89.2) {
								block.dimension.runCommandAsync(`structure load msa_room_west_05 ${blockLocation.x - 10} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else if (randomChance <= 91.8) {
								block.dimension.runCommandAsync(`structure load msa_spider_west_01 ${blockLocation.x - 10} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else if (randomChance <= 94.4) {
								block.dimension.runCommandAsync(`structure load msa_zombie_west_01 ${blockLocation.x - 10} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else return;
						});
					}
					if (block.permutation.matches("nicothekid:structure_msa_way_east")) {
						system.run(() => {
							block.setPermutation(BlockPermutation.resolve("minecraft:air"));
							if (randomChance <= 5.1) {
								block.dimension.runCommandAsync(`structure load msa_way_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 10.2) {
								block.dimension.runCommandAsync(`structure load msa_way_east_02 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 15.3) {
								block.dimension.runCommandAsync(`structure load msa_way_east_03 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 20.4) {
								block.dimension.runCommandAsync(`structure load msa_way_east_04 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 25) {
								block.dimension.runCommandAsync(`structure load msa_way_east_05 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 30.6) {
								block.dimension.runCommandAsync(`structure load msa_way_east_06 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 35.7) {
								block.dimension.runCommandAsync(`structure load msa_way_east_07 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 40.8) {
								block.dimension.runCommandAsync(`structure load msa_way_east_08 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 45.9) {
								block.dimension.runCommandAsync(`structure load msa_way_east_09 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 51) {
								block.dimension.runCommandAsync(`structure load msa_way_east_10 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 56.1) {
								block.dimension.runCommandAsync(`structure load msa_way_east_11 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 61.2) {
								block.dimension.runCommandAsync(`structure load msa_way_east_12 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 63.8) {
								block.dimension.runCommandAsync(`structure load msa_room_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else if (randomChance <= 66.4) {
								block.dimension.runCommandAsync(`structure load msa_room_east_02 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else if (randomChance <= 69) {
								block.dimension.runCommandAsync(`structure load msa_room_east_03 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else if (randomChance <= 71.6) {
								block.dimension.runCommandAsync(`structure load msa_room_east_04 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else if (randomChance <= 74.2) {
								block.dimension.runCommandAsync(`structure load msa_room_east_05 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else if (randomChance <= 76.8) {
								block.dimension.runCommandAsync(`structure load msa_spider_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else if (randomChance <= 79.4) {
								block.dimension.runCommandAsync(`structure load msa_zombie_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else return;
						});
					}
					if (block.permutation.matches("nicothekid:structure_msa_way_north")) {
						system.run(() => {
							block.setPermutation(BlockPermutation.resolve("minecraft:air"));
							if (randomChance <= 5.1) {
								block.dimension.runCommandAsync(`structure load msa_way_north_01 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 10.2) {
								block.dimension.runCommandAsync(`structure load msa_way_north_02 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 15.3) {
								block.dimension.runCommandAsync(`structure load msa_way_north_03 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 20.4) {
								block.dimension.runCommandAsync(`structure load msa_way_north_04 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 25) {
								block.dimension.runCommandAsync(`structure load msa_way_north_05 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 30.6) {
								block.dimension.runCommandAsync(`structure load msa_way_north_06 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 35.7) {
								block.dimension.runCommandAsync(`structure load msa_way_north_07 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 40.8) {
								block.dimension.runCommandAsync(`structure load msa_way_north_08 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 45.9) {
								block.dimension.runCommandAsync(`structure load msa_way_north_09 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 51) {
								block.dimension.runCommandAsync(`structure load msa_way_north_10 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 56.1) {
								block.dimension.runCommandAsync(`structure load msa_way_north_11 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 61.2) {
								block.dimension.runCommandAsync(`structure load msa_way_north_12 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 63.8) {
								block.dimension.runCommandAsync(`structure load msa_room_north_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 10}`);
							} else if (randomChance <= 66.4) {
								block.dimension.runCommandAsync(`structure load msa_room_north_02 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 10}`);
							} else if (randomChance <= 69) {
								block.dimension.runCommandAsync(`structure load msa_room_north_03 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 10}`);
							} else if (randomChance <= 71.6) {
								block.dimension.runCommandAsync(`structure load msa_room_north_04 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 10}`);
							} else if (randomChance <= 74.2) {
								block.dimension.runCommandAsync(`structure load msa_room_north_05 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 10}`);
							} else if (randomChance <= 76.8) {
								block.dimension.runCommandAsync(`structure load msa_spider_north_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 10}`);
							} else if (randomChance <= 79.4) {
								block.dimension.runCommandAsync(`structure load msa_zombie_north_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 10}`);
							} else return;
						});
					}
					if (block.permutation.matches("nicothekid:structure_msa_way_south")) {
						system.run(() => {
							block.setPermutation(BlockPermutation.resolve("minecraft:air"));
							if (randomChance <= 5.1) {
								block.dimension.runCommandAsync(`structure load msa_way_south_01 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 10.2) {
								block.dimension.runCommandAsync(`structure load msa_way_south_02 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 15.3) {
								block.dimension.runCommandAsync(`structure load msa_way_south_03 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 20.4) {
								block.dimension.runCommandAsync(`structure load msa_way_south_04 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 25) {
								block.dimension.runCommandAsync(`structure load msa_way_south_05 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 30.6) {
								block.dimension.runCommandAsync(`structure load msa_way_south_06 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 35.7) {
								block.dimension.runCommandAsync(`structure load msa_way_south_07 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 40.8) {
								block.dimension.runCommandAsync(`structure load msa_way_south_08 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 45.9) {
								block.dimension.runCommandAsync(`structure load msa_way_south_09 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 51) {
								block.dimension.runCommandAsync(`structure load msa_way_south_10 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 56.1) {
								block.dimension.runCommandAsync(`structure load msa_way_south_11 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 61.2) {
								block.dimension.runCommandAsync(`structure load msa_way_south_12 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 63.8) {
								block.dimension.runCommandAsync(`structure load msa_room_south_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 66.4) {
								block.dimension.runCommandAsync(`structure load msa_room_south_02 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 69) {
								block.dimension.runCommandAsync(`structure load msa_room_south_03 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 71.6) {
								block.dimension.runCommandAsync(`structure load msa_room_south_04 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 74.2) {
								block.dimension.runCommandAsync(`structure load msa_room_south_05 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 76.8) {
								block.dimension.runCommandAsync(`structure load msa_spider_south_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 79.4) {
								block.dimension.runCommandAsync(`structure load msa_zombie_south_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else return;
						});
					}
					if (block.permutation.matches("nicothekid:structure_msa_way_west")) {
						system.run(() => {
							block.setPermutation(BlockPermutation.resolve("minecraft:air"));
							if (randomChance <= 5.1) {
								block.dimension.runCommandAsync(`structure load msa_way_west_01 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 10.2) {
								block.dimension.runCommandAsync(`structure load msa_way_west_02 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 15.3) {
								block.dimension.runCommandAsync(`structure load msa_way_west_03 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 20.4) {
								block.dimension.runCommandAsync(`structure load msa_way_west_04 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 25) {
								block.dimension.runCommandAsync(`structure load msa_way_west_05 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 30.6) {
								block.dimension.runCommandAsync(`structure load msa_way_west_06 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 35.7) {
								block.dimension.runCommandAsync(`structure load msa_way_west_07 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 40.8) {
								block.dimension.runCommandAsync(`structure load msa_way_west_08 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 45.9) {
								block.dimension.runCommandAsync(`structure load msa_way_west_09 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 51) {
								block.dimension.runCommandAsync(`structure load msa_way_west_10 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 56.1) {
								block.dimension.runCommandAsync(`structure load msa_way_west_11 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 61.2) {
								block.dimension.runCommandAsync(`structure load msa_way_west_12 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 63.8) {
								block.dimension.runCommandAsync(`structure load msa_room_west_01 ${blockLocation.x - 10} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else if (randomChance <= 66.4) {
								block.dimension.runCommandAsync(`structure load msa_room_west_02 ${blockLocation.x - 10} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else if (randomChance <= 69) {
								block.dimension.runCommandAsync(`structure load msa_room_west_03 ${blockLocation.x - 10} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else if (randomChance <= 71.6) {
								block.dimension.runCommandAsync(`structure load msa_room_west_04 ${blockLocation.x - 10} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else if (randomChance <= 74.2) {
								block.dimension.runCommandAsync(`structure load msa_room_west_05 ${blockLocation.x - 10} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else if (randomChance <= 76.8) {
								block.dimension.runCommandAsync(`structure load msa_spider_west_01 ${blockLocation.x - 10} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else if (randomChance <= 79.4) {
								block.dimension.runCommandAsync(`structure load msa_zombie_west_01 ${blockLocation.x - 10} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else return;
						});
					}
					if (block.permutation.matches("nicothekid:structure_mso_ground_way_east")) {
						system.run(() => {
							block.setPermutation(BlockPermutation.resolve("minecraft:air"));
							if (randomChance <= 20.0) {
								block.dimension.runCommandAsync(`structure load mso_ground_way_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 40.0) {
								block.dimension.runCommandAsync(`structure load mso_ground_way_east_02 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 60.0) {
								block.dimension.runCommandAsync(`structure load mso_ground_way_east_03 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 80.0) {
								block.dimension.runCommandAsync(`structure load mso_ground_way_east_04 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 86.7) {
								block.dimension.runCommandAsync(`structure load mso_ground_room_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else if (randomChance <= 93.4) {
								block.dimension.runCommandAsync(`structure load mso_ground_room_east_02 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else if (randomChance <= 97.7) {
								block.dimension.runCommandAsync(`structure load mso_ground_spider_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else if (randomChance <= 100.0) {
								block.dimension.runCommandAsync(`structure load mso_ground_zombie_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else return;
						});
					}
					if (block.permutation.matches("nicothekid:structure_mso_ground_way_north")) {
						system.run(() => {
							block.setPermutation(BlockPermutation.resolve("minecraft:air"));
							if (randomChance <= 20.0) {
								block.dimension.runCommandAsync(`structure load mso_ground_way_north_01 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 7}`);
							} else if (randomChance <= 40.0) {
								block.dimension.runCommandAsync(`structure load mso_ground_way_north_02 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 7}`);
							} else if (randomChance <= 60.0) {
								block.dimension.runCommandAsync(`structure load mso_ground_way_north_03 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 7}`);
							} else if (randomChance <= 80.0) {
								block.dimension.runCommandAsync(`structure load mso_ground_way_north_04 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 7}`);
							} else if (randomChance <= 86.7) {
								block.dimension.runCommandAsync(`structure load mso_ground_room_north_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 11}`);
							} else if (randomChance <= 93.4) {
								block.dimension.runCommandAsync(`structure load mso_ground_room_north_02 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 11}`);
							} else if (randomChance <= 97.7) {
								block.dimension.runCommandAsync(`structure load mso_ground_spider_north_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 11}`);
							} else if (randomChance <= 100.0) {
								block.dimension.runCommandAsync(`structure load mso_ground_zombie_north_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 11}`);
							} else return;
						});
					}
					if (block.permutation.matches("nicothekid:structure_mso_ground_way_south")) {
						system.run(() => {
							block.setPermutation(BlockPermutation.resolve("minecraft:air"));
							if (randomChance <= 20.0) {
								block.dimension.runCommandAsync(`structure load mso_ground_way_south_01 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 40.0) {
								block.dimension.runCommandAsync(`structure load mso_ground_way_south_02 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 60.0) {
								block.dimension.runCommandAsync(`structure load mso_ground_way_south_03 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 80) {
								block.dimension.runCommandAsync(`structure load mso_ground_way_south_04 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 86.7) {
								block.dimension.runCommandAsync(`structure load mso_ground_room_south_01 ${blockLocation.x - 6} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 93.4) {
								block.dimension.runCommandAsync(`structure load mso_ground_room_south_02 ${blockLocation.x - 6} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 97.7) {
								block.dimension.runCommandAsync(`structure load mso_ground_spider_south_01 ${blockLocation.x - 6} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 100.0) {
								block.dimension.runCommandAsync(`structure load mso_ground_zombie_south_01 ${blockLocation.x - 6} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else return;
						});
					}
					if (block.permutation.matches("nicothekid:structure_mso_ground_way_west")) {
						system.run(() => {
							block.setPermutation(BlockPermutation.resolve("minecraft:air"));
							if (randomChance <= 20.0) {
								block.dimension.runCommandAsync(`structure load mso_ground_way_west_01 ${blockLocation.x - 7} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 40.0) {
								block.dimension.runCommandAsync(`structure load mso_ground_way_west_02 ${blockLocation.x - 7} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 60.0) {
								block.dimension.runCommandAsync(`structure load mso_ground_way_west_03 ${blockLocation.x - 7} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 80.0) {
								block.dimension.runCommandAsync(`structure load mso_ground_way_west_04 ${blockLocation.x - 7} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 86.7) {
								block.dimension.runCommandAsync(`structure load mso_ground_room_west_01 ${blockLocation.x - 11} ${blockLocation.y - 1} ${blockLocation.z - 6}`);
							} else if (randomChance <= 93.4) {
								block.dimension.runCommandAsync(`structure load mso_ground_room_west_02 ${blockLocation.x - 11} ${blockLocation.y - 1} ${blockLocation.z - 6}`);
							} else if (randomChance <= 97.7) {
								block.dimension.runCommandAsync(`structure load mso_ground_spider_west_01 ${blockLocation.x - 11} ${blockLocation.y - 1} ${blockLocation.z - 6}`);
							} else if (randomChance <= 100.0) {
								block.dimension.runCommandAsync(`structure load mso_ground_zombie_west_01 ${blockLocation.x - 11} ${blockLocation.y - 1} ${blockLocation.z - 6}`);
							} else return;
						});
					}
					if (block.permutation.matches("nicothekid:structure_mso_way_east")) {
						system.run(() => {
							block.setPermutation(BlockPermutation.resolve("minecraft:air"));
							if (randomChance <= 6.7) {
								block.dimension.runCommandAsync(`structure load mso_way_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 13.4) {
								block.dimension.runCommandAsync(`structure load mso_way_east_02 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 20.1) {
								block.dimension.runCommandAsync(`structure load mso_way_east_03 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 26.8) {
								block.dimension.runCommandAsync(`structure load mso_way_east_04 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 33.5) {
								block.dimension.runCommandAsync(`structure load mso_way_east_05 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 40.2) {
								block.dimension.runCommandAsync(`structure load mso_way_east_06 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 46.9) {
								block.dimension.runCommandAsync(`structure load mso_way_east_07 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 53.6) {
								block.dimension.runCommandAsync(`structure load mso_way_east_08 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 60.3) {
								block.dimension.runCommandAsync(`structure load mso_way_east_09 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 67) {
								block.dimension.runCommandAsync(`structure load mso_way_east_10 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 70.3) {
								block.dimension.runCommandAsync(`structure load mso_room_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else if (randomChance <= 73.6) {
								block.dimension.runCommandAsync(`structure load mso_room_east_02 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else if (randomChance <= 76.9) {
								block.dimension.runCommandAsync(`structure load mso_spider_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else if (randomChance <= 80.2) {
								block.dimension.runCommandAsync(`structure load mso_zombie_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 5}`);
							} else return;
						});
					}
					if (block.permutation.matches("nicothekid:structure_mso_way_north")) {
						system.run(() => {
							block.setPermutation(BlockPermutation.resolve("minecraft:air"));
							if (randomChance <= 6.7) {
								block.dimension.runCommandAsync(`structure load mso_way_north_01 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 7}`);
							} else if (randomChance <= 13.4) {
								block.dimension.runCommandAsync(`structure load mso_way_north_02 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 7}`);
							} else if (randomChance <= 20.1) {
								block.dimension.runCommandAsync(`structure load mso_way_north_03 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 7}`);
							} else if (randomChance <= 26.8) {
								block.dimension.runCommandAsync(`structure load mso_way_north_04 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 7}`);
							} else if (randomChance <= 33.5) {
								block.dimension.runCommandAsync(`structure load mso_way_north_05 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 7}`);
							} else if (randomChance <= 40.2) {
								block.dimension.runCommandAsync(`structure load mso_way_north_06 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 7}`);
							} else if (randomChance <= 46.9) {
								block.dimension.runCommandAsync(`structure load mso_way_north_07 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 7}`);
							} else if (randomChance <= 53.6) {
								block.dimension.runCommandAsync(`structure load mso_way_north_08 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 7}`);
							} else if (randomChance <= 60.3) {
								block.dimension.runCommandAsync(`structure load mso_way_north_09 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 7}`);
							} else if (randomChance <= 67) {
								block.dimension.runCommandAsync(`structure load mso_way_north_10 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 7}`);
							} else if (randomChance <= 70.3) {
								block.dimension.runCommandAsync(`structure load mso_room_north_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 11}`);
							} else if (randomChance <= 73.6) {
								block.dimension.runCommandAsync(`structure load mso_room_north_02 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 11}`);
							} else if (randomChance <= 76.9) {
								block.dimension.runCommandAsync(`structure load mso_spider_north_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 11}`);
							} else if (randomChance <= 80.2) {
								block.dimension.runCommandAsync(`structure load mso_zombie_north_01 ${blockLocation.x - 5} ${blockLocation.y - 1} ${blockLocation.z - 11}`);
							} else return;
						});
					}
					if (block.permutation.matches("nicothekid:structure_mso_way_south")) {
						system.run(() => {
							block.setPermutation(BlockPermutation.resolve("minecraft:air"));
							if (randomChance <= 6.7) {
								block.dimension.runCommandAsync(`structure load mso_way_south_01 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 13.4) {
								block.dimension.runCommandAsync(`structure load mso_way_south_02 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 20.1) {
								block.dimension.runCommandAsync(`structure load mso_way_south_03 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 26.8) {
								block.dimension.runCommandAsync(`structure load mso_way_south_04 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 33.5) {
								block.dimension.runCommandAsync(`structure load mso_way_south_05 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 40.2) {
								block.dimension.runCommandAsync(`structure load mso_way_south_06 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 46.9) {
								block.dimension.runCommandAsync(`structure load mso_way_south_07 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 53.6) {
								block.dimension.runCommandAsync(`structure load mso_way_south_08 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 60.3) {
								block.dimension.runCommandAsync(`structure load mso_way_south_09 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 67) {
								block.dimension.runCommandAsync(`structure load mso_way_south_10 ${blockLocation.x - 2} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 70.3) {
								block.dimension.runCommandAsync(`structure load mso_room_south_01 ${blockLocation.x - 6} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 73.6) {
								block.dimension.runCommandAsync(`structure load mso_room_south_02 ${blockLocation.x - 6} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 76.9) {
								block.dimension.runCommandAsync(`structure load mso_spider_south_01 ${blockLocation.x - 6} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 80.2) {
								block.dimension.runCommandAsync(`structure load mso_zombie_south_01 ${blockLocation.x - 6} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else return;
						});
					}
					if (block.permutation.matches("nicothekid:structure_mso_way_west")) {
						system.run(() => {
							block.setPermutation(BlockPermutation.resolve("minecraft:air"));
							if (randomChance <= 6.7) {
								block.dimension.runCommandAsync(`structure load mso_way_west_01 ${blockLocation.x - 7} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 13.4) {
								block.dimension.runCommandAsync(`structure load mso_way_west_02 ${blockLocation.x - 7} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 20.1) {
								block.dimension.runCommandAsync(`structure load mso_way_west_03 ${blockLocation.x - 7} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 26.8) {
								block.dimension.runCommandAsync(`structure load mso_way_west_04 ${blockLocation.x - 7} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 33.5) {
								block.dimension.runCommandAsync(`structure load mso_way_west_05 ${blockLocation.x - 7} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 40.2) {
								block.dimension.runCommandAsync(`structure load mso_way_west_06 ${blockLocation.x - 7} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 46.9) {
								block.dimension.runCommandAsync(`structure load mso_way_west_07 ${blockLocation.x - 7} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 53.6) {
								block.dimension.runCommandAsync(`structure load mso_way_west_08 ${blockLocation.x - 7} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 60.3) {
								block.dimension.runCommandAsync(`structure load mso_way_west_09 ${blockLocation.x - 7} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 67) {
								block.dimension.runCommandAsync(`structure load mso_way_west_10 ${blockLocation.x - 7} ${blockLocation.y - 1} ${blockLocation.z - 2}`);
							} else if (randomChance <= 70.3) {
								block.dimension.runCommandAsync(`structure load mso_room_west_01 ${blockLocation.x - 11} ${blockLocation.y - 1} ${blockLocation.z - 6}`);
							} else if (randomChance <= 73.6) {
								block.dimension.runCommandAsync(`structure load mso_room_west_02 ${blockLocation.x - 11} ${blockLocation.y - 1} ${blockLocation.z - 6}`);
							} else if (randomChance <= 76.9) {
								block.dimension.runCommandAsync(`structure load mso_spider_west_01 ${blockLocation.x - 11} ${blockLocation.y - 1} ${blockLocation.z - 6}`);
							} else if (randomChance <= 80.2) {
								block.dimension.runCommandAsync(`structure load mso_zombie_west_01 ${blockLocation.x - 11} ${blockLocation.y - 1} ${blockLocation.z - 6}`);
							} else return;
						});
					}
					if (block.permutation.matches("nicothekid:structure_mss_way_east")) {
						system.run(() => {
							block.setPermutation(BlockPermutation.resolve("minecraft:air"));
							if (randomChance <= 5.4) {
								block.dimension.runCommandAsync(`structure load mss_way_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 10.8) {
								block.dimension.runCommandAsync(`structure load mss_way_east_02 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 16.2) {
								block.dimension.runCommandAsync(`structure load mss_way_east_03 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 21.6) {
								block.dimension.runCommandAsync(`structure load mss_way_east_04 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 27) {
								block.dimension.runCommandAsync(`structure load mss_way_east_05 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 32.4) {
								block.dimension.runCommandAsync(`structure load mss_way_east_06 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 37.8) {
								block.dimension.runCommandAsync(`structure load mss_way_east_07 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 43.2) {
								block.dimension.runCommandAsync(`structure load mss_way_east_08 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 48.6) {
								block.dimension.runCommandAsync(`structure load mss_way_east_09 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 54) {
								block.dimension.runCommandAsync(`structure load mss_way_east_10 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 59.3) {
								block.dimension.runCommandAsync(`structure load mss_way_east_11 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 64.8) {
								block.dimension.runCommandAsync(`structure load mss_way_east_12 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 67.5) {
								block.dimension.runCommandAsync(`structure load mss_room_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 4}`);
							} else if (randomChance <= 70.2) {
								block.dimension.runCommandAsync(`structure load mss_room_east_02 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 4}`);
							} else if (randomChance <= 72.9) {
								block.dimension.runCommandAsync(`structure load mss_room_east_03 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 4}`);
							} else if (randomChance <= 75.6) {
								block.dimension.runCommandAsync(`structure load mss_room_east_04 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 4}`);
							} else if (randomChance <= 78.3) {
								block.dimension.runCommandAsync(`structure load mss_spider_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 4}`);
							} else if (randomChance <= 81) {
								block.dimension.runCommandAsync(`structure load mss_zombie_east_01 ${blockLocation.x} ${blockLocation.y - 1} ${blockLocation.z - 4}`);
							} else return;
						});
					}
					if (block.permutation.matches("nicothekid:structure_mss_way_north")) {
						system.run(() => {
							block.setPermutation(BlockPermutation.resolve("minecraft:air"));
							if (randomChance <= 5.4) {
								block.dimension.runCommandAsync(`structure load mss_way_north_01 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 10.8) {
								block.dimension.runCommandAsync(`structure load mss_way_north_02 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 16.2) {
								block.dimension.runCommandAsync(`structure load mss_way_north_03 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 21.6) {
								block.dimension.runCommandAsync(`structure load mss_way_north_04 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 27) {
								block.dimension.runCommandAsync(`structure load mss_way_north_05 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 32.4) {
								block.dimension.runCommandAsync(`structure load mss_way_north_06 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 37.8) {
								block.dimension.runCommandAsync(`structure load mss_way_north_07 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 43.2) {
								block.dimension.runCommandAsync(`structure load mss_way_north_08 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 48.6) {
								block.dimension.runCommandAsync(`structure load mss_way_north_09 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 54) {
								block.dimension.runCommandAsync(`structure load mss_way_north_10 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 59.3) {
								block.dimension.runCommandAsync(`structure load mss_way_north_11 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 64.8) {
								block.dimension.runCommandAsync(`structure load mss_way_north_12 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 67.5) {
								block.dimension.runCommandAsync(`structure load mss_room_north_01 ${blockLocation.x - 4} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 70.2) {
								block.dimension.runCommandAsync(`structure load mss_room_north_02 ${blockLocation.x - 4} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 72.9) {
								block.dimension.runCommandAsync(`structure load mss_room_north_03 ${blockLocation.x - 4} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 75.6) {
								block.dimension.runCommandAsync(`structure load mss_room_north_04 ${blockLocation.x - 4} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 78.3) {
								block.dimension.runCommandAsync(`structure load mss_spider_north_01 ${blockLocation.x - 4} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else if (randomChance <= 81) {
								block.dimension.runCommandAsync(`structure load mss_zombie_north_01 ${blockLocation.x - 4} ${blockLocation.y - 1} ${blockLocation.z - 8}`);
							} else return;
						});
					}
					if (block.permutation.matches("nicothekid:structure_mss_way_south")) {
						system.run(() => {
							block.setPermutation(BlockPermutation.resolve("minecraft:air"));
							if (randomChance <= 5.4) {
								block.dimension.runCommandAsync(`structure load mss_way_south_01 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 10.8) {
								block.dimension.runCommandAsync(`structure load mss_way_south_02 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 16.2) {
								block.dimension.runCommandAsync(`structure load mss_way_south_03 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 21.6) {
								block.dimension.runCommandAsync(`structure load mss_way_south_04 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 27) {
								block.dimension.runCommandAsync(`structure load mss_way_south_05 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 32.4) {
								block.dimension.runCommandAsync(`structure load mss_way_south_06 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 37.8) {
								block.dimension.runCommandAsync(`structure load mss_way_south_07 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 43.2) {
								block.dimension.runCommandAsync(`structure load mss_way_south_08 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 48.6) {
								block.dimension.runCommandAsync(`structure load mss_way_south_09 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 54) {
								block.dimension.runCommandAsync(`structure load mss_way_south_10 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 59.3) {
								block.dimension.runCommandAsync(`structure load mss_way_south_11 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 64.8) {
								block.dimension.runCommandAsync(`structure load mss_way_south_12 ${blockLocation.x - 1} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 67.5) {
								block.dimension.runCommandAsync(`structure load mss_room_south_01 ${blockLocation.x - 4} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 70.2) {
								block.dimension.runCommandAsync(`structure load mss_room_south_02 ${blockLocation.x - 4} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 72.9) {
								block.dimension.runCommandAsync(`structure load mss_room_south_03 ${blockLocation.x - 4} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 75.6) {
								block.dimension.runCommandAsync(`structure load mss_room_south_04 ${blockLocation.x - 4} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 78.3) {
								block.dimension.runCommandAsync(`structure load mss_spider_south_01 ${blockLocation.x - 4} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else if (randomChance <= 81) {
								block.dimension.runCommandAsync(`structure load mss_zombie_south_01 ${blockLocation.x - 4} ${blockLocation.y - 1} ${blockLocation.z}`);
							} else return;
						});
					}
					if (block.permutation.matches("nicothekid:structure_mss_way_west")) {
						system.run(() => {
							block.setPermutation(BlockPermutation.resolve("minecraft:air"));
							if (randomChance <= 5.4) {
								block.dimension.runCommandAsync(`structure load mss_way_west_01 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 10.8) {
								block.dimension.runCommandAsync(`structure load mss_way_west_02 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 16.2) {
								block.dimension.runCommandAsync(`structure load mss_way_west_03 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 21.6) {
								block.dimension.runCommandAsync(`structure load mss_way_west_04 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 27) {
								block.dimension.runCommandAsync(`structure load mss_way_west_05 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 32.4) {
								block.dimension.runCommandAsync(`structure load mss_way_west_06 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 37.8) {
								block.dimension.runCommandAsync(`structure load mss_way_west_07 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 43.2) {
								block.dimension.runCommandAsync(`structure load mss_way_west_08 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 48.6) {
								block.dimension.runCommandAsync(`structure load mss_way_west_09 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 54) {
								block.dimension.runCommandAsync(`structure load mss_way_west_10 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 59.3) {
								block.dimension.runCommandAsync(`structure load mss_way_west_11 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 64.8) {
								block.dimension.runCommandAsync(`structure load mss_way_west_12 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 1}`);
							} else if (randomChance <= 67.5) {
								block.dimension.runCommandAsync(`structure load mss_room_west_01 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 4}`);
							} else if (randomChance <= 70.2) {
								block.dimension.runCommandAsync(`structure load mss_room_west_02 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 4}`);
							} else if (randomChance <= 72.9) {
								block.dimension.runCommandAsync(`structure load mss_room_west_03 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 4}`);
							} else if (randomChance <= 75.6) {
								block.dimension.runCommandAsync(`structure load mss_room_west_04 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 4}`);
							} else if (randomChance <= 78.3) {
								block.dimension.runCommandAsync(`structure load mss_spider_west_01 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 4}`);
							} else if (randomChance <= 81) {
								block.dimension.runCommandAsync(`structure load mss_zombie_west_01 ${blockLocation.x - 8} ${blockLocation.y - 1} ${blockLocation.z - 4}`);
							} else return;
						});
					}
				} else return;
			}
		});
	blockComponentRegistry.registerCustomComponent("nicothekid:spawner_skeleton_miner_on_random_tick", {
		onRandomTick: eventData => {
			eventData.block.setPermutation(BlockPermutation.resolve("minecraft:air"));
			eventData.block.dimension.spawnEntity("nicothekid:miner_skeleton", {
				x: eventData.block.location.x + 0.5, y: eventData.block.location.y, z: eventData.block.location.z + 0.5
			});
		}
	});
	blockComponentRegistry.registerCustomComponent('cloud:door', {
		onTick: (data)=>{
			if (!data.block.isValid()) {
				//this cleans up any entries to the dynamic properties if the block is destroyed
				redstoneManager.deletePowerState(data.block);
				return;
			}
			redstoneManager.redstonePowerAfterEvent(data.block, {
				code: (block)=>{
					const sound = block.hasTag("cloud:wooden");
					if (block.permutation.getState("pa:open") == true) {
						if (block.hasTag("cloud:toggle")) {
							block.setPermutation(block.permutation.withState("pa:open", false));
							playOpenSound(sound, block.dimension, block.center())
						}
						return;
					}
					block.setPermutation(block.permutation.withState("pa:open", true));
					playOpenSound(sound, block.dimension, block.center())
				},
				unpowered: (block)=>{
					if (block.permutation.getState("pa:open") == false) return;
					if (block && block.hasTag("cloud:is_door") && block.permutation.getState('cloud:powered') == true) return;
					block.setPermutation(block.permutation.withState("pa:open", false));
					const sound = block.hasTag("cloud:wooden");
					playCloseSound(sound, block.dimension, block.center())
				},
				toggle: (block) => {
					const state = block.permutation.getState("pa:open")
					block.setPermutation(block.permutation.withState("pa:open", !state));
					if (state) {
						playOpenSound(false, block.dimension, block.center())
					} else {
						playCloseSound(false, block.dimension, block.center())
					}
				}
			});
		},
		onPlayerInteract: e => { 
			if (e.block.hasTag("cloud:metal")) {
				e.cancel = true;
				return;
			}
			const isOpen = e.block.permutation.getState("pa:open");		  
			e.block.setPermutation(e.block.permutation.withState("pa:open", !isOpen));
			const sound = e.block.hasTag("cloud:wooden");
			if (isOpen) {
				playCloseSound(sound, e.block.dimension, e.block.center())
			} else {
				playOpenSound(sound, e.block.dimension, e.block.center())
			}
		}
	});
	blockComponentRegistry.registerCustomComponent('azc:wormFarm', {
		onPlayerInteract: data => {
			const {block,player} = data;
			const randomChance = Math.floor(Math.random()*100);
			if (!player.getComponent('equippable').getEquipment('Mainhand')) return;
			const mainHandItem = player.getComponent('equippable').getEquipment('Mainhand');
			if (!(mainHandItem.typeId == 'minecraft:cod' || mainHandItem.typeId == 'minecraft:salmon' || mainHandItem.typeId == 'minecraft:pufferfish' || mainHandItem.typeId == 'minecraft:tropical_fish' || mainHandItem.hasTag('azc:fish_first') || mainHandItem.hasTag('azc:fish_second') || mainHandItem.hasTag('azc:fish_third') || mainHandItem.hasTag('azc:fish_forth'))) return;
			const wormState = block.permutation.getState('azc:farm');
			if (wormState < 9 && (mainHandItem.typeId == 'minecraft:cod' || mainHandItem.typeId == 'minecraft:salmon' || mainHandItem.typeId == 'minecraft:pufferfish' || mainHandItem.typeId == 'minecraft:tropical_fish' || mainHandItem.hasTag('azc:fish_first')) && randomChance <= 25) {
				block.setPermutation(block.permutation.withState('azc:farm', wormState + 1));
			} else if (wormState < 9 && mainHandItem.hasTag('azc:fish_second') && randomChance <= 50) {
				block.setPermutation(block.permutation.withState('azc:farm', wormState + 1));
			} else if (wormState < 9 && mainHandItem.hasTag('azc:fish_third') && randomChance <= 75) {
				block.setPermutation(block.permutation.withState('azc:farm', wormState + 1));
			} else if (wormState < 9 && mainHandItem.hasTag('azc:fish_forth')) {
				block.setPermutation(block.permutation.withState('azc:farm', wormState + 1));
			}
			mainHandItem.amountDecrease(player, 'Mainhand');
		}
	});
	blockComponentRegistry.registerCustomComponent('azc:wormFarmCanReady', {
		onTick: data => {
			const {block} = data;
			block.setPermutation(block.permutation.withState('azc:farm', 9));
		}
	});
	blockComponentRegistry.registerCustomComponent('azc:wormFarmReady', {
		onPlayerInteract: data => {
			const {block,dimension} = data;
			const worm = new ItemStack('azc:worm');
			block.setPermutation(block.permutation.withState('azc:farm', 1));
			dimension.spawnItem(worm, block.location);
		}
	});
	blockComponentRegistry.registerCustomComponent('azc:cuttingBoard', {
		onPlace: data => {
			const {block} = data;
			const {x,y,z} = block.center();
			block.dimension.spawnEntity('azc:cutting_board_entity', {x:x,y:y-0.5,z:z});
		}
	});
	blockComponentRegistry.registerCustomComponent('azc:emptyFishTrap', {
		onPlayerInteract: data => {
			const {block,player} = data;
			const {x,y,z} = block.location;
			const mainHandItem = player.getComponent('equippable').getEquipment('Mainhand');
			const baitItems = ['azc:minnow','azc:leech','azc:worm'];
			if (baitItems.includes(mainHandItem.typeId)) {
				block.dimension.playSound('block.itemframe.add_item', {x:x,y:y+1,z:z});
				mainHandItem.amountDecrease(player, 'Mainhand');
				block.setPermutation(block.permutation.withState('azc:trap', 2));
			}
		},
		onTick: data => {
			const {block} = data;
			if (!block) return;
			const {x,y,z} = block.center();
			if (block.below().typeId == 'minecraft:water' && block.north().typeId == 'minecraft:water' && block.south().typeId == 'minecraft:water' && block.east().typeId == 'minecraft:water' && block.west().typeId == 'minecraft:water') {
				block.dimension.spawnParticle('minecraft:basic_smoke_particle', {x:x,y:y+1,z:z});
			}
		}
	});
	blockComponentRegistry.registerCustomComponent('azc:fishTrap', {
		onTick: data => {
			const {block} = data;
			if (!block) return;
			const {x,y,z} = block.center();
			const trapLoot = fishTrapLoot[block.typeId];
			const loot = block.dimension.getEntities({type: trapLoot.loot, location: {x:x,y:y+1,z:z}});
			const randomWeight = Math.floor(Math.random()*100);
			if (block.below().typeId == 'minecraft:water' && block.north().typeId == 'minecraft:water' && block.south().typeId == 'minecraft:water' && block.east().typeId == 'minecraft:water' && block.west().typeId == 'minecraft:water' && randomWeight <= trapLoot.weight) {
				block.dimension.spawnParticle('minecraft:water_wake_particle', {x:x,y:y+1,z:z});
				block.dimension.playSound('random.splash', {x:x,y:y+1,z:z});
				block.dimension.spawnEntity(trapLoot.loot, {x:x,y:y+1,z:z});
				if (loot) loot[0].kill();
			} else if (block.below().typeId == 'minecraft:water' && block.north().typeId == 'minecraft:water' && block.south().typeId == 'minecraft:water' && block.east().typeId == 'minecraft:water' && block.west().typeId == 'minecraft:water' && randomWeight > trapLoot.weight) {
				block.dimension.playSound('random.break', {x:x,y:y+1,z:z});
				block.setPermutation(block.permutation.withState('azc:trap', 1));
			}
		}
	});
	blockComponentRegistry.registerCustomComponent('dlcraft:unbucket', {
		beforeOnPlayerPlace: data => {
			const {block,permutationToPlace,player} = data;
			const bucket = buckets[permutationToPlace.type.id];
			if (bucket) {
				block.dimension.playSound(bucket.playSound, block.location);
				system.run(() => {
					block.dimension.spawnEntity(bucket.spawnEntity, block.center());
				});
				if (player.getGameMode() != 'creative') {
					block.dimension.spawnItem(new ItemStack(bucket.transform), player.location);
				}
			}
		},
		onPlace: data => {
			const {block} = data;
			const bucket = buckets[block.typeId];
			if (bucket) {
				block.setPermutation(BlockPermutation.resolve(bucket.setBlock));
			}
		}
	});
	// Initialize power states from world dynamic property to ensure the blocks do not trigger on reload
	redstoneManager.loadPowerStates();
});
