ItemEvents.rightClicked(event => {
	const item = event.item.id
	switch (item) {
		case 'minecraft:lava_bucket':
			if (event.item.count > 1) event.cancel()
			break
		case 'botania:crafting_halo':
		case 'botania:auto_crafting_halo':
			event.cancel()
			break
	}
})

BlockEvents.broken(event => {
	const block = event.block.id
	const dim = event.block.level.dimension
	const x = event.block.x
	const y = event.block.y
	const z = event.block.z

	if (block === 'cfm_circuit_breaker:circuit_breaker') {
		event.server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} if entity @e[tag=circuit_breaker,distance=..1] run function backrooms:powerhouse_depower`)
		return
	}
	if (block === 'mekanism:radioactive_waste_barrel') {
		event.server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} if entity @e[tag=radioactive_waste_barrel,distance=..1] run function backrooms:radiation_barrel`)
		return
	}
})

BlockEvents.rightClicked(event => {
	const block = event.block.id
	const item = event.item.id
	const stack = event.item
	const dim = event.block.level.dimension
	const x = event.block.x
	const y = event.block.y
	const z = event.block.z
	const server = event.server
	const creative = event.player.isCreative()
	const axes = Ingredient.of('#minecraft:axes')
	const pickaxes = Ingredient.of('#minecraft:pickaxes')
	const knives = Ingredient.of('#forge:tools/knives')

	if (event.item.id == 'tconstruct:magma_bucket') {
		event.item.count--
		event.player.give('minecraft:bucket')

		event.server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} run summon magma_cube ~ ~1 ~ {Health:1f,Size:0}`)
		event.server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} run playsound minecraft:item.bucket.empty_lava master @a ~ ~ ~ 1 0`)
		event.server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} run particle lava ~ ~ ~ 0 0 0 0.5 10 force`)
	}

	if (event.item.id == 'miners_delight:copper_cup') {
		event.cancel()
	}

	function sendActionbar(message) {
		event.server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} run title @a[distance=..7] actionbar {"text":"${message}","color":"white"}`);
	}

	if (item.startsWith('tconstruct:') && stack.nbt?.tic_broken) {
	event.cancel()}

	if (block === 'kubejs:oil_carpet' && item === 'minecraft:sponge') {
		server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} run function backrooms:oil_bubble`)
		event.cancel()
		return
	}

	if (block === 'kubejs:drain' && item === 'kubejs:crowbar') {
		if (!creative) event.player.damageHeldItem(event.hand, 1)
		server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} if dimension minecraft:overworld run function backrooms:poolrooms_entrance`)
		server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} if dimension minecraft:overworld run setblock ~ ~ ~ minecraft:cave_air`)
		return
	}

	//Wallpaper Stuff
	let stripWallpaper = (map) => {
		let entry = map[block]
		if (entry) {
			if (axes.test(event.item) || item === 'kubejs:putty_knife') {
				if (axes.test(event.item)) {
					if (!creative) event.player.damageHeldItem(event.hand, 1)
				}
				server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} run playsound minecraft:item.axe.strip master @a ~ ~ ~ 1 0.6`)
				server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} run setblock ~ ~ ~ ${entry.to}`)
				if (entry.give) event.player.giveInHand(entry.give)
				return
			}
		}
	}
	stripWallpaper({
	'kubejs:wallpaper1': { to: 'kubejs:stripped_wallpaper',  give: 'kubejs:wallpaper' },
	'kubejs:wallpaper2': { to: 'kubejs:stripped_wallpaper2', give: 'kubejs:wallpaper' },
	'kubejs:wallpaper3': { to: 'kubejs:stripped_wallpaper3', give: 'kubejs:wallpaper' },
	'kubejs:wallpaper5': { to: 'kubejs:stripped_wallpaper5', give: 'kubejs:wallpaper_white' },
	'kubejs:wallpaper6': { to: 'kubejs:stripped_wallpaper6', give: 'kubejs:wallpaper' },
	'kubejs:wallpaper7': { to: 'kubejs:stripped_wallpaper7', give: 'kubejs:wallpaper_pink' },
	'kubejs:wallpaper8': { to: 'kubejs:stripped_wallpaper8', give: 'kubejs:wallpaper' },
	'kubejs:wallpaper_fake': { to: 'supplementaries:timber_frame', give: 'kubejs:wallpaper' },
	'kubejs:wallpaper_white_fake': { to: 'supplementaries:timber_frame', give: 'kubejs:wallpaper_white' },
	'kubejs:wallpaper_pink_fake': { to: 'supplementaries:timber_frame', give: 'kubejs:wallpaper_pink' },
	'kubejs:wallpaper_soft': { to: 'minecraft:cave_air', give: 'kubejs:wallpaper' },
	'kubejs:wallpaper2_soft': { to: 'minecraft:cave_air', give: 'kubejs:wallpaper' },
	'kubejs:wallpaper3_soft': { to: 'minecraft:cave_air', give: 'kubejs:wallpaper' },
	'kubejs:wallpaper4_soft': { to: 'minecraft:cave_air', give: 'minecraft:air' },
	'kubejs:wallpaper5_soft': { to: 'minecraft:cave_air', give: 'kubejs:wallpaper_white' },
	'kubejs:wallpaper6_soft': { to: 'minecraft:cave_air', give: 'kubejs:wallpaper' },
	'kubejs:wallpaper7_soft': { to: 'minecraft:cave_air', give: 'kubejs:wallpaper_pink' },
	'kubejs:wallpaper8_soft': { to: 'minecraft:cave_air', give: 'kubejs:wallpaper' }
	})

	let applyWallpaper = (map) => {
		let entry = map[block]
		if (entry) {
			if (item == entry.item) {
				if (!creative) event.item.count--
				server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} run playsound minecraft:block.wool.place master @a ~ ~ ~ 1 0`)
				server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} run setblock ~ ~ ~ ${entry.to}`)
				return
			}
		}
	}
	applyWallpaper({
	'kubejs:stripped_wallpaper':  { item: 'kubejs:wallpaper',        to: 'kubejs:wallpaper1' },
	'kubejs:stripped_wallpaper2': { item: 'kubejs:wallpaper',        to: 'kubejs:wallpaper2' },
	'kubejs:stripped_wallpaper3': { item: 'kubejs:wallpaper',        to: 'kubejs:wallpaper3' },
	'kubejs:stripped_wallpaper5': { item: 'kubejs:wallpaper_white',  to: 'kubejs:wallpaper5' },
	'kubejs:stripped_wallpaper6': { item: 'kubejs:wallpaper',        to: 'kubejs:wallpaper6' },
	'kubejs:stripped_wallpaper7': { item: 'kubejs:wallpaper_pink',   to: 'kubejs:wallpaper7' },
	'kubejs:stripped_wallpaper8': { item: 'kubejs:wallpaper',        to: 'kubejs:wallpaper8' }
	})
	
	//Carpet Stuff
	let SpongeDrying = (before, after) => {
		if (block === before && item === 'minecraft:sponge') {
			server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} run particle minecraft:cloud ~ ~1.7 ~ 0.5 0.1 0.5 0.001 5 force`)
			server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} run playsound minecraft:block.coral_block.place master @a ~ ~ ~ 1 0`)
			server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} run setblock ~ ~ ~ ${after}`)
			if (event.item.count > 1) {
				event.item.count--
				event.player.give(Item.of('minecraft:wet_sponge'))
			} else {
				let realhand = event.hand == "MAIN_HAND" ? "mainhand" : "offhand"
				server.runCommandSilent(`item replace entity ${event.player.uuid} weapon.${realhand} with minecraft:wet_sponge`)
			}
			event.cancel()
			return
		}
	}
	let SpongeWetting = (interact) => {
		if (block === interact && item === 'minecraft:wet_sponge') {
			server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} run particle minecraft:falling_water ~ ~1.1 ~ 1 0 1 0 100 force`)
			server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} run playsound minecraft:block.coral_block.place master @a ~ ~ ~ 1 0`)
			server.runCommandSilent(`execute in ${dim} run fill ${x + 1} ${y} ${z} ${x - 1} ${y} ${z} kubejs:soggy_carpet replace kubejs:carpet`)
			server.runCommandSilent(`execute in ${dim} run fill ${x} ${y} ${z + 1} ${x} ${y} ${z - 1} kubejs:soggy_carpet replace kubejs:carpet`)
			server.runCommandSilent(`execute in ${dim} run fill ${x + 1} ${y} ${z} ${x - 1} ${y} ${z} kubejs:carpeted_drain_soggy replace kubejs:carpeted_drain_dry`)
			server.runCommandSilent(`execute in ${dim} run fill ${x} ${y} ${z + 1} ${x} ${y} ${z - 1} kubejs:carpeted_drain_soggy replace kubejs:carpeted_drain_dry`)
			server.runCommandSilent(`execute in ${dim} run fill ${x + 1} ${y} ${z} ${x - 1} ${y} ${z} kubejs:pool_tiles_wet replace kubejs:pool_tiles`)
			server.runCommandSilent(`execute in ${dim} run fill ${x} ${y} ${z + 1} ${x} ${y} ${z - 1} kubejs:pool_tiles_wet replace kubejs:pool_tiles`)
			server.runCommandSilent(`execute in ${dim} run fill ${x + 1} ${y} ${z} ${x - 1} ${y} ${z} kubejs:missing_tiles_half_wet replace kubejs:missing_tiles_half`)
			server.runCommandSilent(`execute in ${dim} run fill ${x} ${y} ${z + 1} ${x} ${y} ${z - 1} kubejs:missing_tiles_half_wet replace kubejs:missing_tiles_half`)
			server.runCommandSilent(`execute in ${dim} run fill ${x + 1} ${y} ${z} ${x - 1} ${y} ${z} kubejs:pool_tiles_cracked_wet replace kubejs:pool_tiles_cracked`)
			server.runCommandSilent(`execute in ${dim} run fill ${x} ${y} ${z + 1} ${x} ${y} ${z - 1} kubejs:pool_tiles_cracked_wet replace kubejs:pool_tiles_cracked`)
			server.runCommandSilent(`execute in ${dim} run fill ${x + 1} ${y} ${z} ${x - 1} ${y} ${z} kubejs:missing_tiles_half_cracked_wet replace kubejs:missing_tiles_half_cracked`)
			server.runCommandSilent(`execute in ${dim} run fill ${x} ${y} ${z + 1} ${x} ${y} ${z - 1} kubejs:missing_tiles_half_cracked_wet replace kubejs:missing_tiles_half_cracked`)
			if (event.item.count > 1) {
				event.item.count--
				event.player.give(Item.of('minecraft:sponge'))
			} else {
				let realhand = event.hand == "MAIN_HAND" ? "mainhand" : "offhand"
				server.runCommandSilent(`item replace entity ${event.player.uuid} weapon.${realhand} with minecraft:sponge`)
			}
			event.cancel()
			return
		}
	}
	SpongeDrying('kubejs:soggy_carpet','kubejs:carpet')
	SpongeDrying('kubejs:carpeted_drain_soggy','kubejs:carpeted_drain_dry')
	SpongeDrying('kubejs:pool_tiles_wet','kubejs:pool_tiles')
	SpongeDrying('kubejs:missing_tiles_half_wet','kubejs:missing_tiles_half')
	SpongeDrying('kubejs:pool_tiles_cracked_wet','kubejs:pool_tiles_cracked')
	SpongeDrying('kubejs:missing_tiles_half_cracked_wet','kubejs:missing_tiles_half_cracked')
	SpongeWetting('kubejs:carpet')
	SpongeWetting('kubejs:carpeted_drain_dry')
	SpongeWetting('kubejs:pool_tiles')
	SpongeWetting('kubejs:missing_tiles_half')
	SpongeWetting('kubejs:pool_tiles_cracked')
	SpongeWetting('kubejs:missing_tiles_half_cracked')
	
	let stripCarpet = (map) => {
		let entry = map[block]
		if (entry) {
			if (knives.test(event.item)) {
				if (!creative) event.player.damageHeldItem(event.hand, 1)
				server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} run playsound minecraft:block.wool.break master @a ~ ~ ~ 1 1.5`)
				server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} run setblock ~ ~ ~ ${entry.to}`)
				if (entry.give) event.player.giveInHand(entry.give)
				return
		}
	}
	}
	stripCarpet({
	'kubejs:carpet_fake': { to: 'supplementaries:timber_frame', give: 'kubejs:cut_carpet' },
	'kubejs:red_carpet_fake': { to: 'supplementaries:timber_frame', give: 'kubejs:cut_carpet_red' },
	'kubejs:green_carpet_fake': { to: 'supplementaries:timber_frame', give: 'kubejs:cut_carpet_green' }
	})

	//Lamps
	if (block === 'kubejs:ceilling_lamp_off' && item === 'kubejs:fluorescent_tube') {
		if (!creative) event.item.count--
		server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} if dimension minecraft:overworld run function backrooms:lamp_restoration`)
		server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} if dimension backrooms:poolrooms run function backrooms:lamp_restoration_poolrooms`)
		return
	}
	
	//Concrete Applying
	let FloorTileApply = (before, after) => {
		if (block === before && item === 'kubejs:concrete_piece') {
		if (!creative) event.item.count--
		server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} run playsound minecraft:block.deepslate.place master @a ~ ~ ~ 1 0`)
		server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} run execute as @a[distance=..1] at @s run tp @s ~ ~0.1 ~`)
		server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} run setblock ~ ~ ~ ${after}`)
		return
		}
	}
	FloorTileApply('kubejs:floor_tiles', 'kubejs:floor_tiles_full')
	FloorTileApply('kubejs:floor_tiles_red', 'kubejs:floor_tiles_red_full')
	FloorTileApply('kubejs:floor_tiles_green', 'kubejs:floor_tiles_green_full')

	//Pool Tile Stuff
	let ChipPooltile = (map) => {
		let entry = map[block]
		if (entry) {
			if (pickaxes.test(event.item) || item === 'kubejs:putty_knife') {
				if (pickaxes.test(event.item)) {
					if (!creative) event.player.damageHeldItem(event.hand, 1)
				}
				server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} run playsound minecraft:block.deepslate_bricks.break master @a ~ ~ ~ 1 0`)
				server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} run setblock ~ ~ ~ ${entry.to}`)
				if (entry.give) event.player.giveInHand(entry.give)
				if (entry.double !== false) {event.player.giveInHand(entry.give)}
				return
		}
	}
	}
	ChipPooltile({
	'kubejs:pool_tiles': { to: 'kubejs:missing_tiles_half',  give: 'kubejs:pool_tile' },
	'kubejs:missing_tiles_half': { to: 'kubejs:missing_tiles_empty', give: 'kubejs:pool_tile' },
	'kubejs:pool_tiles_wet': { to: 'kubejs:missing_tiles_half_wet', give: 'kubejs:pool_tile' },
	'kubejs:missing_tiles_half_wet': { to: 'kubejs:missing_tiles_empty', give: 'kubejs:pool_tile' },
	'kubejs:pool_tiles_golden': { to: 'kubejs:missing_tiles_golden_half', give: 'kubejs:pool_tile_golden' },
	'kubejs:pool_tiles_golden_half': { to: 'kubejs:missing_tiles_half_golden', give: 'kubejs:pool_tile_golden' },
	'kubejs:missing_tiles_golden_half': { to: 'kubejs:missing_tiles_empty', give: 'kubejs:pool_tile_golden' },
	'kubejs:missing_tiles_half_golden': { to: 'kubejs:missing_tiles_empty', give: 'kubejs:pool_tile' },
	'kubejs:pool_tiles_cracked': { to: 'kubejs:missing_tiles_half_cracked', give: 'minecraft:air' },
	'kubejs:pool_tiles_cracked_wet': { to: 'kubejs:missing_tiles_half_cracked_wet', give: 'minecraft:air' },
	'kubejs:missing_tiles_half_cracked': { to: 'kubejs:missing_tiles_empty', give: 'minecraft:air' },
	'kubejs:missing_tiles_half_cracked_wet': { to: 'kubejs:missing_tiles_empty', give: 'minecraft:air' },
	'kubejs:pool_tiles_soft': { to: 'minecraft:cave_air', give: 'kubejs:pool_tile' },
	'kubejs:long_pool_tiles_soft': { to: 'minecraft:cave_air', give: 'kubejs:pool_tile' },
	'kubejs:pool_tiles_fake': { to: 'supplementaries:timber_frame', give: 'kubejs:pool_tile', double: false },
	'kubejs:pool_tiles_golden_fake': { to: 'supplementaries:timber_frame', give: 'kubejs:pool_tile_golden', double: false }
	})

	//Infesting
	if (item === 'kubejs:sculk_clump' && event.block.hasTag('minecraft:sculk_replaceable')) {
		if (!creative) event.item.count--
		server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} run playsound minecraft:block.sculk.place master @a ~ ~ ~ 1 1`)
		server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} run setblock ~ ~ ~ minecraft:sculk`)
		return
	}


	//Reality Frame
	/*
chip0 (0000): blank
chip1 (1000): dripstone cave: 10 coal ore, 12 iron ore, 3 gold ore, 3 emerald ore, 3 lapis ore, 58 dripstone blocks+spikes
chip2 (0100): crimson nether: 11 nether quartz ore, 2 nether gold, 38 crimson nylium, 115 netherrack
chip3 (1100): osmium cave: 6 osmium ore, 86 deepslate, 26 dripstone blocks+spikes
chip4 (0010): plains: COW, 3 dandelion, 27 grass, 49 grass block, 113 dirt
chip5 (1010): deep ores: 319 deepslate, 9 DS diamond ore, 10 DS gold ore, 5 DS uranium ore
chip6 (0110): blaze fortress: 3 blaze, 1 netherite upgrade, 2 debris, 29 netherrack, 108 nether bricks, 27 nether brick fence
chip7 (1110): desert temple: 9 tnt, 192 sandstone, 11 chiseled, 27 cut, 43 stone, 3 gold ore, 5 iron ore CHESTS: 3 enderio wooden gear, 2 dia, 12 gold, 8 emerald, 2 dune trim, 2 drill core, 1 aa bat wing, 1 botania black lotus, 2 saddle, 2 iron horse, 2 gold horse, 2 spider eye, 5 string, 29 bone, 18 gunpowder
chip8 (0001): end island: 189 endstone, 35 obsidian
chip9 (1001): living room: 1 tv, 1 mint sprout, 1 fern, 3 oak table, 4 light gray sofa, 2 light gray stools, 49 spruce planks
chip10 (0101): ruin portal: 1 gold block, 4 cobalt ore, 6 obsidian, 3 crying obsidian, 5 magma block, 65 netherrack CHEST: rib trim, 6 gold ingot, 8 gold nugget, 1 gold horse armor, 1 saddle
chip11 (0011): skyblock: dirt, one bucket
chip12 (1011): ocean: 4 trop fish, 1 salmon, 1 squid
chip13 (1101): sculk
chip14 (0111): library: 5% chance of eye, 1 moyai, brazier and weather vane
chip15 (1111): elven: two mana pools, black and pink magical flowers
chip infinity: black hole
chip error: corrupted: 1 ancient debris, 1 sand, 1 crying obsidian, 1 diamond ore, 1 iron ore, grass blocks, error blocks
available: 0011, 0111, 1011, 1101, 1111
	 */
	const chipFunctions = {
		'kubejs:data_chip1': 'reality_cave',
		'kubejs:data_chip2': 'reality_furniture',
		'kubejs:data_chip3': 'reality_osmium',
		'kubejs:data_chip4': 'reality_grass',
		'kubejs:data_chip5': 'reality_diamonds',
		'kubejs:data_chip6': 'reality_blaze',
		'kubejs:data_chip7': 'reality_pyramid',
		'kubejs:data_chip8': 'reality_end',
		'kubejs:data_chip9': 'reality_room',
		'kubejs:data_chip10': 'reality_portal',
		'kubejs:data_chip11': 'reality_poolrooms',
		'kubejs:data_chip12': 'reality_ocean',
		'kubejs:data_chip13': 'reality_sculk',
		'kubejs:data_chip14': 'reality_library',
		'kubejs:data_chip15': 'reality_elven',
		'kubejs:data_chip_error': 'reality_error',
		'kubejs:data_chip_infinity': 'reality_black_hole',
		'kubejs:data_chip_infinity_error': 'reality_error_modified'
	}
	if (block === 'kubejs:reality_controller' && chipFunctions[item]) {
			server.runCommandSilent(
				`execute in ${dim} positioned ${x} ${y} ${z} if block ~ ~1 ~ kubejs:reality_charge run function backrooms:${chipFunctions[item]}`
			)
			return
	}

	//Sculk
	const sculkBlocks = [
		'minecraft:sculk',
		'minecraft:sculk_catalyst',
		'minecraft:sculk_vein',
		'minecraft:sculk_sensor',
		'minecraft:sculk_shrieker',
		'kubejs:sculk_tendrils',
		'kubejs:sculk_shroom',
		'kubejs:sculk_slab',
		'kubejs:sculk_stairs',
		'minecraft:spawner'
	];

	if (block === 'minecraft:spawner' && item === 'tiab:time_in_a_bottle') {
		return;
	}
	if (sculkBlocks.includes(block) && item === 'kubejs:sculk_scrubber') {
		if (!creative) {
			sendActionbar("Try to place the Sculk Scrubber on the side of a non-sculk block to get it in the right position.");
			event.cancel();
		}
		return;
	}

	if (sculkBlocks.includes(block) && item !== 'tiab:time_in_a_bottle') {
		if (!creative) {
			sendActionbar("You can't place blocks on sculk!");
			event.cancel();
		}
		return;
	}

	if (block === 'kubejs:sculk_scrubber') {
		server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} if block ~ ~-1 ~ minecraft:sculk run summon marker ~ ~ ~ {Tags:["scrubber"]}`)
		server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} unless block ~ ~-1 ~ minecraft:sculk run title @a[distance=..5] actionbar {"text":"You need to place the scrubber on sculk!","color":"white"}`)
		return
	}

	//Misc
	if (block === 'eidolon:shadow_gem_block' && item === 'create:chromatic_compound') {
		server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} run function backrooms:shadow_conversion`)
		if (!creative) event.item.count--
		event.player.give('create:shadow_steel')
		return
	}

	if (block === 'kubejs:hyper_experience_block' && item === 'minecraft:enchanted_book') {
		server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} run function backrooms:cryptic_levelup`)
		if (!creative) {
			event.item.count--
			event.player.give('minecraft:book')
		} else {
			event.cancel()
		}
		return
	}

	if (block === 'supplementaries:cannon') {
		event.cancel()
		return
	} //disabled due to wall xray exploit

	if (block === 'kubejs:wall_destroyer') {
		// north/south
		server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} if block ~ ~ ~ kubejs:wall_destroyer[facing=north] unless block ~ ~ ~1 minecraft:air if block ~ ~ ~2 kubejs:wall_destroyer[facing=south] positioned ~ ~ ~1 run function backrooms:wall_break`)
		server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} if block ~ ~ ~ kubejs:wall_destroyer[facing=south] unless block ~ ~ ~-1 minecraft:air if block ~ ~ ~-2 kubejs:wall_destroyer[facing=north] positioned ~ ~ ~-1 run function backrooms:wall_break`)
		// west/east
		server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} if block ~ ~ ~ kubejs:wall_destroyer[facing=west] unless block ~1 ~ ~ minecraft:air if block ~2 ~ ~ kubejs:wall_destroyer[facing=east] positioned ~1 ~ ~ run function backrooms:wall_break`)
		server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} if block ~ ~ ~ kubejs:wall_destroyer[facing=east] unless block ~-1 ~ ~ minecraft:air if block ~-2 ~ ~ kubejs:wall_destroyer[facing=west] positioned ~-1 ~ ~ run function backrooms:wall_break`)
		// up/down
		server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} if block ~ ~ ~ kubejs:wall_destroyer[facing=down] unless block ~ ~1 ~ minecraft:air if block ~ ~2 ~ kubejs:wall_destroyer[facing=up] positioned ~ ~1 ~ run function backrooms:wall_break`)
		server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} if block ~ ~ ~ kubejs:wall_destroyer[facing=up] unless block ~ ~-1 ~ minecraft:air if block ~ ~-2 ~ kubejs:wall_destroyer[facing=down] positioned ~ ~-1 ~ run function backrooms:wall_break`)
		return
	}

	if (block === 'kubejs:carpet_grass' && item === 'minecraft:bone_meal') {
		if (!creative) event.item.count--
		server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} run summon item ~ ~ ~ {Item:{id:"kubejs:carpet_grass",Count:1b}, Motion:[0.0,0.3,0.0]}`)
		return
	}

	const coolers = Ingredient.of('#refurbished_furniture:coolers');
	if (coolers.test(block) && item === 'supplementaries:soap') {
		event.cancel();
		return;
	} //Fix cooler dupe (issue #182)

	const insulators = [
		'immersiveengineering:connector_hv',
		'immersiveengineering:connector_lv',
		'immersiveengineering:connector_mv'
	];
	if (insulators.includes(block) && item === 'immersiveengineering:hammer') {
		event.cancel();
	} //Feedthrough insulator intentionally disabled due to exploit

})