ServerEvents.recipes(event => {

//Carpet Brushing
	event.custom({
		"type": "lychee:block_interacting",
		"item_in": {
			"item": "minecraft:brush"
		},
		"block_in": "kubejs:carpet",
		"post": [
			{
				"type": "damage_item"
			},
			{
				"type": "add_item_cooldown",
				"s": 0.3
			},
			{
				"type": "execute",
				"command": "particle minecraft:campfire_signal_smoke ~ ~0.3 ~ 1 0.1 1 0.001 2 force",
				"hide": "true"
			},
			{
				"type": "execute",
				"command": "playsound minecraft:item.brush.brushing.generic master @a ~ ~ ~ 1 1",
				"hide": "true"
			},
			{
				"type": "execute",
				"command": "summon item ~ ~ ~ {Motion:[0.2,0.3,0.1],Item:{id:'kubejs:carpet_dust',Count:1b}}",
				"hide": "true",
					"contextual": {
					"type": "chance",
					"chance": 0.10
				}
			},
			{
				"type": "execute",
				"command": "summon item ~ ~ ~ {Motion:[-0.3,0.4,0.1],Item:{id:'kubejs:carpet_dust',Count:1b}}",
				"hide": "true",
					"contextual": {
					"type": "chance",
					"chance": 0.10
				}
			},
			{
				"type": "execute",
				"command": "summon item ~ ~ ~ {Motion:[0.0,0.2,-0.3],Item:{id:'kubejs:carpet_dust',Count:1b}}",
				"hide": "true",
					"contextual": {
					"type": "chance",
					"chance": 0.10
				}
			},
			{
				"type": "execute",
				"command": "summon item ~ ~ ~ {Motion:[0.4,0.2,0.1],Item:{id:'kubejs:carpet_dust',Count:1b}}",
				"hide": "true",
					"contextual": {
					"type": "chance",
					"chance": 0.10
				}
			},
			{
				"type": "execute",
				"command": "summon item ~ ~ ~ {Motion:[-0.3,0.3,-0.1],Item:{id:'kubejs:carpet_dust',Count:1b}}",
				"hide": "true",
					"contextual": {
					"type": "chance",
					"chance": 0.10
				}
			},
			{
				"type": "execute",
				"command": "summon item ~ ~ ~ {Motion:[0.0,0.4,0.0],Item:{id:'minecraft:pitcher_pod',Count:1b}}",
				"hide": "true",
				"contextual": {
					"type": "chance",
					"chance": 0.005
				}
			},
			{
				"type": "execute",
				"command": "summon item ~ ~ ~ {Motion:[0.0,0.4,0.0],Item:{id:'minecraft:torchflower_seeds',Count:1b}}",
				"hide": "true",
				"contextual": {
					"type": "chance",
					"chance": 0.002
				}
			},
			{
				"type": "execute",
				"command": "summon area_effect_cloud ~ ~.1 ~ {Particle:ash,Radius:1,Duration:100,Effects:[{Duration:80,Id:20b,Amplifier:0b}]}",
				"hide": "true",
				"contextual": {
					"type": "chance",
					"chance": 0.2
				}
			},
			{
				"type": "execute",
				"command": "summon silverfish ~ ~ ~ {Motion:[0.0,0.4,0.0]}",
				"hide": "true",
					"contextual": {
					"type": "chance",
					"chance": 0.05
				}
			}
		]
})
event.custom({
	"type": "lychee:block_interacting",
	"item_in": {
		"item": "kubejs:diamond_brush"
	},
	"block_in": "kubejs:carpet",
	"post": [
		{
			"type": "prevent_default"
		},
		{
			"type": "add_item_cooldown",
			"s": 0.2
		},
		{
			"type": "execute",
			"command": "particle minecraft:campfire_signal_smoke ~ ~0.3 ~ 1 0.1 1 0.001 2 force",
			"hide": "true"
		},
		{
			"type": "execute",
			"command": "playsound minecraft:item.brush.brushing.generic master @a ~ ~ ~ 1 1",
			"hide": "true"
		},
		{
			"type": "execute",
			"command": "summon item ~ ~ ~ {Motion:[0.2,0.3,0.1],Item:{id:'kubejs:carpet_dust',Count:1b}}",
			"hide": "true",
				"contextual": {
				"type": "chance",
				"chance": 0.10
			}
		},
		{
			"type": "execute",
			"command": "summon item ~ ~ ~ {Motion:[-0.3,0.4,0.1],Item:{id:'kubejs:carpet_dust',Count:1b}}",
			"hide": "true",
				"contextual": {
				"type": "chance",
				"chance": 0.10
			}
		},
		{
			"type": "execute",
			"command": "summon item ~ ~ ~ {Motion:[0.0,0.2,-0.3],Item:{id:'kubejs:carpet_dust',Count:1b}}",
			"hide": "true",
				"contextual": {
				"type": "chance",
				"chance": 0.10
			}
		},
		{
			"type": "execute",
			"command": "summon item ~ ~ ~ {Motion:[0.4,0.2,0.1],Item:{id:'kubejs:carpet_dust',Count:1b}}",
			"hide": "true",
				"contextual": {
				"type": "chance",
				"chance": 0.10
			}
		},
		{
			"type": "execute",
			"command": "summon item ~ ~ ~ {Motion:[-0.3,0.3,-0.1],Item:{id:'kubejs:carpet_dust',Count:1b}}",
			"hide": "true",
				"contextual": {
				"type": "chance",
				"chance": 0.10
			}
		},
		{
			"type": "execute",
			"command": "summon item ~ ~ ~ {Motion:[0.0,0.4,0.0],Item:{id:'minecraft:pitcher_pod',Count:1b}}",
			"hide": "true",
			"contextual": {
				"type": "chance",
				"chance": 0.01
			}
		},
		{
			"type": "execute",
			"command": "summon item ~ ~ ~ {Motion:[0.0,0.4,0.0],Item:{id:'minecraft:torchflower_seeds',Count:1b}}",
			"hide": "true",
			"contextual": {
				"type": "chance",
				"chance": 0.004
			}
		},
		{
			"type": "execute",
			"command": "summon area_effect_cloud ~ ~.1 ~ {Particle:ash,Radius:1,Duration:100,Effects:[{Duration:80,Id:20b,Amplifier:0b}]}",
			"hide": "true",
			"contextual": {
				"type": "chance",
				"chance": 0.2
			}
		},
		{
			"type": "execute",
			"command": "summon silverfish ~ ~ ~ {Motion:[0.0,0.4,0.0]}",
			"hide": "true",
			"contextual": {
				"type": "chance",
				"chance": 0.05
			}
		}
	]
})

//Steel Cauldron
	/*
	event.custom({ //fixed issue #171
		"type": "lychee:block_interacting",
		"item_in": {
			"item": "kubejs:hot_steel"
		},
		"block_in": "minecraft:water_cauldron",
		"post": [
			{
				"type": "execute",
				"command": "function backrooms:cauldron_empty",
				"hide": "true"
			},
			{
				"type": "execute",
				"command": "particle minecraft:cloud ~ ~0.5 ~ 0.3 0.3 0.3 0.001 10 force",
				"hide": "true"
			},
			{
				"type": "execute",
				"command": "playsound minecraft:block.fire.extinguish master @a ~ ~ ~ 0.15 2",
				"hide": "true"
			},
			{
				"type": "execute",
				"command": "playsound minecraft:block.bubble_column.upwards_inside master @a ~ ~ ~ 1 2",
				"hide": "true"
			},
			{
				"type": "if",
				"contextual": [
					{
						"type": "chance",
						"chance": 0.80
					}
				],
				"then": [
					{
						"type": "execute",
						"command": "summon item ~ ~ ~ {Motion:[-0.3,0.3,-0.1],Item:{id:'immersiveengineering:ingot_steel',Count:1b}}",
						"hide": "true"
					}
				],
				"else": [
					{
						"type": "execute",
						"command": "summon item ~ ~ ~ {Motion:[-0.3,0.3,-0.1],Item:{id:'kubejs:cracked_steel',Count:1b}}",
						"hide": "true"
					}
				]
			}
		]
})
*/

	/*
	event.custom({
		"type": "lychee:block_interacting",
		"item_in": {
			"item": "minecraft:sponge"
		},
		"block_in": "kubejs:soggy_carpet",
		"post": [
			{
				"type": "execute",
				"command": "particle minecraft:cloud ~ ~0.2 ~ 0.5 0.1 0.5 0.001 5 force",
				"hide": "true"
			},
			{
				"type": "execute",
				"command": "playsound minecraft:block.coral_block.place master @a ~ ~ ~ 1 0",
				"hide": "true"
			},
			{
				"type": "place",
				"block": "kubejs:carpet"
			},
			{
				"type": "execute",
				"command": "give @a[limit=1,sort=nearest] wet_sponge",
				"hide": "true"
			}
		]
})
event.custom({
	"type": "lychee:block_interacting",
	"item_in": {
		"item": "minecraft:wet_sponge"
	},
	"block_in": "kubejs:carpet",
	"post": [
		{
			"type": "execute",
			"command": "playsound minecraft:block.coral_block.place master @a ~ ~ ~ 1 0",
			"hide": "true"
		},
		{
			"type": "execute",
			"command": "fill ~1 ~ ~ ~-1 ~ ~ kubejs:soggy_carpet replace kubejs:carpet",
			"hide": "true"
		},
		{
			"type": "execute",
			"command": "fill ~ ~ ~1 ~ ~ ~-1 kubejs:soggy_carpet replace kubejs:carpet",
			"hide": "true"
		},
		{
			"type": "execute",
			"command": "particle minecraft:falling_water ~ ~0.1 ~ 1 0 1 0 100 force",
			"hide": "true"
		},
		{
			"type": "execute",
			"command": "give @a[limit=1,sort=nearest] sponge",
			"hide": "true"
		}
	]
})
*/
/*
	event.custom({
		"type": "lychee:block_interacting",
		"item_in": {
			"item": "kubejs:carpet_dust"
		},
		"block_in": "kubejs:soggy_carpet",
		"post": [
			{
				"type": "execute",
				"command": "particle minecraft:cloud ~ ~0.2 ~ 0.5 0.1 0.5 0.001 5 force"
			},
			{
				"type": "execute",
				"command": "playsound minecraft:block.coral_block.place master @a ~ ~ ~ 1 0"
			},
			{
				"type": "execute",
				"command": "give @a[limit=1,sort=nearest] clay_ball"
			}
		]
})
*/
	event.custom({
		"type": "lychee:block_interacting",
		"item_in": {
			"item": "kubejs:cut_carpet"
		},
		"block_in": "kubejs:floor_tiles",
		"post": [
			{
				"type": "add_item_cooldown",
				"s": 0.2
			},
			{
				"type": "execute",
				"command": "playsound minecraft:block.wool.place master @a ~ ~ ~ 1 1",
				"hide": "true"
			},
			{
				"type": "execute",
				"command": "execute as @a[distance=..0.7] at @s run tp @s ~ ~0.1 ~",
				"hide": "true"
			},
			{
				"type": "place",
				"block": "kubejs:carpet"
			}
		]
	})
	event.custom({
		"type": "lychee:block_interacting",
		"item_in": {
			"item": "kubejs:cut_carpet_red"
		},
		"block_in": "kubejs:floor_tiles_red",
		"post": [
			{
				"type": "add_item_cooldown",
				"s": 0.2
			},
			{
				"type": "execute",
				"command": "playsound minecraft:block.wool.place master @a ~ ~ ~ 1 1",
				"hide": "true"
			},
			{
				"type": "execute",
				"command": "execute as @a[distance=..0.7] at @s run tp @s ~ ~0.1 ~",
				"hide": "true"
			},
			{
				"type": "place",
				"block": "kubejs:red_carpet"
			}
		]
	})
	event.custom({
		"type": "lychee:block_interacting",
		"item_in": {
			"item": "kubejs:cut_carpet_green"
		},
		"block_in": "kubejs:floor_tiles_green",
		"post": [
			{
				"type": "add_item_cooldown",
				"s": 0.2
			},
			{
				"type": "execute",
				"command": "playsound minecraft:block.wool.place master @a ~ ~ ~ 1 1",
				"hide": "true"
			},
			{
				"type": "execute",
				"command": "execute as @a[distance=..0.7] at @s run tp @s ~ ~0.1 ~",
				"hide": "true"
			},
			{
				"type": "place",
				"block": "kubejs:green_carpet"
			}
		]
	})
	
	event.custom({
		"type": "lychee:block_clicking",
		"item_in": {
			"tag": "forge:tools/knives"
		},
		"block_in": "kubejs:carpet",
		"post": [
			{
				"type": "execute",
				"command": "function backrooms:carpet_fix",
				"hide": "true"
			},
			{
				"type": "execute",
				"command": "execute if block ~ ~1 ~ minecraft:air run summon item ~ ~0.5 ~ {Motion:[0.0,0.1,0.0],Item:{id:'kubejs:cut_carpet',Count:1b}}",
				"hide": "true"
			},
			{
				"type": "execute",
				"command": "execute if block ~ ~1 ~ minecraft:air run playsound minecraft:block.wool.break master @a ~ ~ ~ 1 1.5",
				"hide": "true"
			},
			{
				"type": "execute",
				"command": "execute if block ~ ~1 ~ minecraft:air run setblock ~ ~ ~ kubejs:floor_tiles",
				"hide": "true"
			},
			{
				"type": "damage_item"
			},
			{
				"type": "add_item_cooldown",
				"s": 0.8
			}
		]
	})
	event.custom({
		"type": "lychee:block_clicking",
		"item_in": {
			"tag": "forge:tools/knives"
		},
		"block_in": "kubejs:carpet_fake",
		"post": [
			{
				"type": "execute",
				"command": "summon item ~ ~0.2 ~ {Motion:[0.0,0.1,0.0],Item:{id:'kubejs:cut_carpet',Count:1b}}",
				"hide": "true"
			},
			{
				"type": "execute",
				"command": "playsound minecraft:block.wool.break master @a ~ ~ ~ 1 1.5",
				"hide": "true"
			},
			{
				"type": "execute",
				"command": "setblock ~ ~ ~ supplementaries:timber_frame",
				"hide": "true"
			},
			{
				"type": "damage_item"
			},
			{
				"type": "add_item_cooldown",
				"s": 0.8
			}
		]
	})
	event.custom({
		"type": "lychee:block_clicking",
		"item_in": {
			"tag": "forge:tools/knives"
		},
		"block_in": "kubejs:red_carpet_fake",
		"post": [
			{
				"type": "execute",
				"command": "summon item ~ ~0.2 ~ {Motion:[0.0,0.1,0.0],Item:{id:'kubejs:cut_carpet_red',Count:1b}}",
				"hide": "true"
			},
			{
				"type": "execute",
				"command": "playsound minecraft:block.wool.break master @a ~ ~ ~ 1 1.5",
				"hide": "true"
			},
			{
				"type": "execute",
				"command": "setblock ~ ~ ~ supplementaries:timber_frame",
				"hide": "true"
			},
			{
				"type": "damage_item"
			},
			{
				"type": "add_item_cooldown",
				"s": 0.8
			}
		]
	})
	event.custom({
		"type": "lychee:block_clicking",
		"item_in": {
			"tag": "forge:tools/knives"
		},
		"block_in": "kubejs:green_carpet_fake",
		"post": [
			{
				"type": "execute",
				"command": "summon item ~ ~0.2 ~ {Motion:[0.0,0.1,0.0],Item:{id:'kubejs:cut_carpet_green',Count:1b}}",
				"hide": "true"
			},
			{
				"type": "execute",
				"command": "playsound minecraft:block.wool.break master @a ~ ~ ~ 1 1.5",
				"hide": "true"
			},
			{
				"type": "execute",
				"command": "setblock ~ ~ ~ supplementaries:timber_frame",
				"hide": "true"
			},
			{
				"type": "damage_item"
			},
			{
				"type": "add_item_cooldown",
				"s": 0.8
			}
		]
	})
	event.custom({
		"type": "lychee:block_clicking",
		"item_in": {
			"tag": "forge:tools/knives"
		},
		"block_in": "kubejs:soggy_carpet",
		"post": [
			{
				"type": "execute",
				"command": "function backrooms:carpet_fix",
				"hide": "true"
			},
			{
				"type": "execute",
				"command": "execute if block ~ ~1 ~ minecraft:air run summon item ~ ~0.5 ~ {Motion:[0.0,0.1,0.0],Item:{id:'kubejs:cut_carpet',Count:1b}}",
				"hide": "true"
			},
			{
				"type": "execute",
				"command": "execute if block ~ ~1 ~ minecraft:air run playsound minecraft:block.wool.break master @a ~ ~ ~ 1 1.5",
				"hide": "true"
			},
			{
				"type": "execute",
				"command": "execute if block ~ ~1 ~ minecraft:air run setblock ~ ~ ~ kubejs:floor_tiles",
				"hide": "true"
			},
			{
				"type": "damage_item"
			},
			{
				"type": "add_item_cooldown",
				"s": 1.0
			}
		]
	})
	event.custom({
		"type": "lychee:block_clicking",
		"item_in": {
			"tag": "forge:tools/knives"
		},
		"block_in": "kubejs:red_carpet",
		"post": [
			{
				"type": "execute",
				"command": "function backrooms:carpet_fix",
				"hide": "true"
			},
			{
				"type": "execute",
				"command": "execute if block ~ ~1 ~ minecraft:air run summon item ~ ~0.5 ~ {Motion:[0.0,0.1,0.0],Item:{id:'kubejs:cut_carpet_red',Count:1b}}",
				"hide": "true"
			},
			{
				"type": "execute",
				"command": "execute if block ~ ~1 ~ minecraft:air run playsound minecraft:block.wool.break master @a ~ ~ ~ 1 1.5",
				"hide": "true"
			},
			{
				"type": "execute",
				"command": "execute if block ~ ~1 ~ minecraft:air run setblock ~ ~ ~ kubejs:floor_tiles_red",
				"hide": "true"
			},
			{
				"type": "damage_item"
			},
			{
				"type": "add_item_cooldown",
				"s": 0.8
			}
		]
	})
	event.custom({
		"type": "lychee:block_clicking",
		"item_in": {
			"tag": "forge:tools/knives"
		},
		"block_in": "kubejs:green_carpet",
		"post": [
			{
				"type": "execute",
				"command": "function backrooms:carpet_fix",
				"hide": "true"
			},
			{
				"type": "execute",
				"command": "execute if block ~ ~1 ~ minecraft:air run summon item ~ ~0.5 ~ {Motion:[0.0,0.1,0.0],Item:{id:'kubejs:cut_carpet_green',Count:1b}}",
				"hide": "true"
			},
			{
				"type": "execute",
				"command": "execute if block ~ ~1 ~ minecraft:air run playsound minecraft:block.wool.break master @a ~ ~ ~ 1 1.5",
				"hide": "true"
			},
			{
				"type": "execute",
				"command": "execute if block ~ ~1 ~ minecraft:air run setblock ~ ~ ~ kubejs:floor_tiles_green",
				"hide": "true"
			},
			{
				"type": "damage_item"
			},
			{
				"type": "add_item_cooldown",
				"s": 0.8
			}
		]
	})

	event.custom({
		"type": "lychee:block_clicking",
		"item_in": {
			"tag": "minecraft:pickaxes"
		},
		"block_in": "#kubejs:concrete_tiles",
		"post": [
			{
				"type": "damage_item"
			},
			{
				"type": "add_item_cooldown",
				"s": 0.5
			},
			{
				"type": "execute",
				"command": "particle block kubejs:floor_tiles ~ ~0.5 ~ 0 0 0 0.1 10 normal",
				"hide": "true"
			},
			{
				"type": "execute",
				"command": "playsound minecraft:block.deepslate.place master @a ~ ~ ~ 1 0",
				"hide": "true"
			},
			{
				"type": "execute",
				"command": "summon item ~ ~0.5 ~ {Motion:[0.1,0.2,0.0],Item:{id:'kubejs:concrete_piece',Count:1b}}",
				"hide": "true",
				"contextual": {
				"type": "chance",
				"chance": 0.10
				}
			},
			{
				"type": "execute",
				"command": "summon item ~ ~0.5 ~ {Motion:[-0.1,0.2,0.1],Item:{id:'kubejs:concrete_piece',Count:1b}}",
				"hide": "true",
				"contextual": {
				"type": "chance",
				"chance": 0.10
				}
			},
			{
				"type": "execute",
				"command": "summon item ~ ~0.5 ~ {Motion:[0.1,0.2,-0.1],Item:{id:'kubejs:concrete_piece',Count:1b}}",
				"hide": "true",
				"contextual": {
				"type": "chance",
				"chance": 0.10
				}
			}
		]
})

	event.custom({
		"type": "lychee:block_clicking",
		"item_in": {
			"tag": "minecraft:pickaxes"
		},
		"block_in": "kubejs:floor_tiles_full",
		"post": [
			{
				"type": "damage_item"
			},
			{
				"type": "execute",
				"command": "execute if block ~ ~1 ~ minecraft:air run setblock ~ ~ ~ kubejs:floor_tiles",
				"hide": "true"
			}
		]
	})
	event.custom({
		"type": "lychee:block_clicking",
		"item_in": {
			"tag": "minecraft:pickaxes"
		},
		"block_in": "kubejs:floor_tiles_red_full",
		"post": [
			{
				"type": "damage_item"
			},
			{
				"type": "execute",
				"command": "execute if block ~ ~1 ~ minecraft:air run setblock ~ ~ ~ kubejs:floor_tiles_red",
				"hide": "true"
			}
		]
	})
	event.custom({
		"type": "lychee:block_clicking",
		"item_in": {
			"tag": "minecraft:pickaxes"
		},
		"block_in": "kubejs:floor_tiles_green_full",
		"post": [
			{
				"type": "damage_item"
			},
			{
				"type": "execute",
				"command": "execute if block ~ ~1 ~ minecraft:air run setblock ~ ~ ~ kubejs:floor_tiles_green",
				"hide": "true"
			}
		]
	})

})

//Credit to AmberGoop on github for the following

//Steel
BlockEvents.rightClicked('minecraft:water_cauldron', event => {
	if (event.item.id != 'kubejs:hot_steel') { return; }
	let pos = event.block.pos
	event.server.runCommandSilent(`execute positioned ${pos.x} ${pos.y} ${pos.z} run function backrooms:cauldron_empty`)
	event.server.runCommandSilent(`particle minecraft:cloud ${pos.x} ${pos.y + 0.5} ${pos.z} 0.3 0.3 0.3 0.001 10 force`)
	event.server.runCommandSilent(`playsound minecraft:block.fire.extinguish master @a ${pos.x} ${pos.y + 0.5} ${pos.z} 0.15 2`)
	event.server.runCommandSilent(`playsound minecraft:block.bubble_column.upwards_inside master @a ${pos.x} ${pos.y + 0.5} ${pos.z} 1 2`)
	if (Math.random() < 0.1) {
		event.player.give(Item.of('kubejs:cracked_steel'))
	} else {
		event.player.give(Item.of('immersiveengineering:ingot_steel'))
	} //doing it this way ensures the player quenching the steel is actually the one who receives the item
	event.item.count--

})

//Carpet Sponging
BlockEvents.rightClicked('kubejs:soggy_carpet', event => {
	if (event.item.id != 'minecraft:sponge') { return; }
	let pos = event.block.pos
	event.server.runCommandSilent(`particle minecraft:cloud ${pos.x} ${pos.y + 1.7} ${pos.z} 0.5 0.1 0.5 0.001 5 force`)
	event.server.runCommandSilent(`playsound minecraft:block.coral_block.place master @a ${pos.x} ${pos.y} ${pos.z} 1 0`)
	event.block.set("kubejs:carpet")
	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"
		event.server.runCommandSilent(`item replace entity ${event.player.uuid} weapon.${realhand} with minecraft:wet_sponge`)
	}
	event.cancel()
})
BlockEvents.rightClicked('kubejs:carpet', event => {
	if (event.item.id != 'minecraft:wet_sponge') { return; }
	let pos = event.block.pos
	event.server.runCommandSilent(`particle minecraft:falling_water ${pos.x} ${pos.y + 1.1} ${pos.z} 1 0 1 0 100 force`)
	event.server.runCommandSilent(`playsound minecraft:block.coral_block.place master @a ${pos.x} ${pos.y} ${pos.z} 1 0`)
	event.server.runCommandSilent(`fill ${pos.x + 1} ${pos.y} ${pos.z} ${pos.x - 1} ${pos.y} ${pos.z} kubejs:soggy_carpet replace kubejs:carpet`)
	event.server.runCommandSilent(`fill ${pos.x} ${pos.y} ${pos.z + 1} ${pos.x} ${pos.y} ${pos.z - 1} kubejs:soggy_carpet replace kubejs:carpet`)
	if (event.item.count > 1) {
		event.item.count--
		event.player.give(Item.of('minecraft:sponge'))
	} else {
		let realhand = event.hand == "MAIN_HAND" ? "mainhand" : "offhand"
		event.server.runCommandSilent(`item replace entity ${event.player.uuid} weapon.${realhand} with minecraft:sponge`)
	}
	//doing it this way makes it so the sponge actually stays in the players hand! this was annoying me quite a bit
	event.cancel()
})

//Carpet Knifing
/* Will enable when I figure out how to add a cooldown
BlockEvents.leftClicked('kubejs:carpet', event => { //doing it this way ensures that the player who cuts the carpet is the one who receives the carpet
	if (!event.item.hasTag("forge:tools/knives")) { return; }
	let pos = event.block.pos
	event.server.runCommandSilent(`execute positioned ${pos.x} ${pos.y} ${pos.z} run function backrooms:carpet_fix`)
	if (!event.block.up.blockState.isAir()) { return; }
	event.block.set('kubejs:floor_tiles')
	event.player.give(Item.of('kubejs:cut_carpet'))
	event.player.damageHeldItem("MAIN_HAND", 1)
	event.server.runCommandSilent(`playsound minecraft:block.wool.break master @a ${pos.x} ${pos.y} ${pos.z} 1 1.5`)
})
BlockEvents.leftClicked('kubejs:soggy_carpet', event => { //doing it this way ensures that the player who cuts the carpet is the one who receives the carpet
	if (!event.item.hasTag("forge:tools/knives")) { return; }
	let pos = event.block.pos
	event.server.runCommandSilent(`execute positioned ${pos.x} ${pos.y} ${pos.z} run function backrooms:carpet_fix`)
	if (!event.block.up.blockState.isAir()) { return; }
	event.block.set('kubejs:floor_tiles')
	event.player.give(Item.of('kubejs:cut_carpet'))
	event.player.damageHeldItem("MAIN_HAND", 1)
	event.server.runCommandSilent(`playsound minecraft:block.wool.break master @a ${pos.x} ${pos.y} ${pos.z} 1 1.5`)
})
BlockEvents.leftClicked('kubejs:carpet_fake', event => { //doing it this way ensures that the player who cuts the carpet is the one who receives the carpet
	if (!event.item.hasTag("forge:tools/knives")) { return; }
	let pos = event.block.pos
	event.server.runCommandSilent(`execute positioned ${pos.x} ${pos.y} ${pos.z} run function backrooms:carpet_fix`)
	if (!event.block.up.blockState.isAir()) { return; }
	event.block.set('supplementaries:timber_frame')
	event.player.give(Item.of('kubejs:cut_carpet'))
	event.player.damageHeldItem("MAIN_HAND", 1)
	event.server.runCommandSilent(`playsound minecraft:block.wool.break master @a ${pos.x} ${pos.y} ${pos.z} 1 1.5`)
})
BlockEvents.leftClicked('kubejs:red_carpet', event => { //doing it this way ensures that the player who cuts the carpet is the one who receives the carpet
	if (!event.item.hasTag("forge:tools/knives")) { return; }
	let pos = event.block.pos
	//event.server.runCommandSilent(`execute positioned ${pos.x} ${pos.y} ${pos.z} run function backrooms:carpet_fix`)
	if (!event.block.up.blockState.isAir()) { return; }
	event.block.set('kubejs:floor_tiles_red')
	event.player.give(Item.of('kubejs:cut_carpet_red'))
	event.player.damageHeldItem("MAIN_HAND", 1)
	event.server.runCommandSilent(`playsound minecraft:block.wool.break master @a ${pos.x} ${pos.y} ${pos.z} 1 1.5`)
})
BlockEvents.leftClicked('kubejs:green_carpet', event => { //doing it this way ensures that the player who cuts the carpet is the one who receives the carpet
	if (!event.item.hasTag("forge:tools/knives")) { return; }
	let pos = event.block.pos
	//event.server.runCommandSilent(`execute positioned ${pos.x} ${pos.y} ${pos.z} run function backrooms:carpet_fix`)
	if (!event.block.up.blockState.isAir()) { return; }
	event.block.set('kubejs:floor_tiles_green')
	event.player.give(Item.of('kubejs:cut_carpet_green'))
	event.player.damageHeldItem("MAIN_HAND", 1)
	event.server.runCommandSilent(`playsound minecraft:block.wool.break master @a ${pos.x} ${pos.y} ${pos.z} 1 1.5`)
})
*/