"use strict";

function registerTFGSpaceBlocks(event) {

	// Dimension markers

	event.create('tfg:marker/moon')
		.stoneSoundType()
		.item(item => {
			item.modelJson({ parent: 'tfg:block/marker/moon' })
		})
		.tagBlock('c:hidden_from_recipe_viewers')
		.fullBlock(true)
		.opaque(true)

	event.create('tfg:marker/mars')
		.stoneSoundType()
		.item(item => {
			item.modelJson({ parent: 'tfg:block/marker/mars' })
		})
		.tagBlock('c:hidden_from_recipe_viewers')
		.fullBlock(true)
		.opaque(true)

	event.create('tfg:marker/venus')
		.stoneSoundType()
		.item(item => {
			item.modelJson({ parent: 'tfg:block/marker/venus' })
		})
		.tagBlock('c:hidden_from_recipe_viewers')
		.fullBlock(true)
		.opaque(true)

	event.create('tfg:marker/mercury')
		.stoneSoundType()
		.item(item => {
			item.modelJson({ parent: 'tfg:block/marker/mercury' })
		})
		.tagBlock('c:hidden_from_recipe_viewers')
		.fullBlock(true)
		.opaque(true)

	// Hardened stones

	event.create('tfg:rock/hardened_moon_stone')
		.stoneSoundType()
		.requiresTool(true)
		.item(item => {
			item.modelJson({ parent: 'ad_astra:item/moon_stone' })
		})
		.tagBlock('tfc:can_carve')
		.tagBoth('forge:stone')
		.tagBoth('tfc:rock/hardened')
		.tagBlock('minecraft:mineable/pickaxe')
		.mapColor('terracotta_cyan')
		.fullBlock(true)
		.opaque(true)

	event.create('tfg:rock/hardened_moon_deepslate')
		.soundType('deepslate')
		.requiresTool(true)
		.item(item => {
			item.modelJson({ parent: 'ad_astra:item/moon_deepslate' })
		})
		.tagBlock('tfc:can_carve')
		.tagBoth('forge:stone')
		.tagBoth('tfc:rock/hardened')
		.tagBlock('minecraft:mineable/pickaxe')
		.mapColor('terracotta_blue')
		.fullBlock(true)
		.opaque(true)

	event.create('tfg:rock/hardened_mars_stone')
		.stoneSoundType()
		.requiresTool(true)
		.item(item => {
			item.modelJson({ parent: 'ad_astra:item/mars_stone' })
		})
		.tagBlock('tfc:can_carve')
		.tagBoth('forge:stone')
		.tagBoth('tfc:rock/hardened')
		.tagBlock('minecraft:mineable/pickaxe')
		.mapColor('terracotta_orange')
		.fullBlock(true)
		.opaque(true)

	event.create('tfg:rock/hardened_venus_stone')
		.stoneSoundType()
		.requiresTool(true)
		.item(item => {
			item.modelJson({ parent: 'ad_astra:item/venus_stone' })
		})
		.tagBlock('tfc:can_carve')
		.tagBoth('forge:stone')
		.tagBoth('tfc:rock/hardened')
		.tagBlock('minecraft:mineable/pickaxe')
		.mapColor('terracotta_yellow')
		.fullBlock(true)
		.opaque(true)

	event.create('tfg:rock/hardened_mercury_stone')
		.stoneSoundType()
		.requiresTool(true)
		.item(item => {
			item.modelJson({ parent: 'ad_astra:item/mercury_stone' })
		})
		.tagBlock('tfc:can_carve')
		.tagBoth('forge:stone')
		.tagBoth('tfc:rock/hardened')
		.tagBlock('minecraft:mineable/pickaxe')
		.mapColor('terracotta_purple')
		.fullBlock(true)
		.opaque(true)

	event.create('tfg:rock/hardened_glacio_stone')
		.stoneSoundType()
		.requiresTool(true)
		.item(item => {
			item.modelJson({ parent: 'ad_astra:item/glacio_stone' })
		})
		.tagBlock('tfc:can_carve')
		.tagBoth('forge:stone')
		.tagBoth('tfc:rock/hardened')
		.tagBlock('minecraft:mineable/pickaxe')
		.mapColor('terracotta_light_blue')
		.fullBlock(true)
		.opaque(true)

	event.create('tfg:rock/hardened_red_granite')
		.stoneSoundType()
		.requiresTool(true)
		.item(item => {
			item.modelJson({ parent: 'gtceu:item/red_granite' })
		})
		.tagBlock('tfc:can_carve')
		.tagBoth('forge:stone')
		.tagBoth('tfc:rock/hardened')
		.tagBlock('minecraft:mineable/pickaxe')
		.mapColor('terracotta_red')
		.fullBlock(true)
		.opaque(true)

	// Loose stones

	event.create('tfg:loose/moon_stone', 'tfc:loose_rock')
		.stoneSoundType()
		.itemTexture('tfg:item/loose/moon_stone')
		.tagBlock('tfc:loose_rocks')
		.tagItem('tfc:any_knapping')
		.tagItem('tfc:rock_knapping')
		.tagItem('tfc:igneous_intrusive_rock')
		.tagItem("rnr:loose_rock_items")

	event.create('tfg:loose/moon_deepslate', 'tfc:loose_rock')
		.soundType('deepslate')
		.itemTexture('tfg:item/loose/moon_deepslate')
		.tagBlock('tfc:loose_rocks')
		.tagItem('tfc:any_knapping')
		.tagItem('tfc:rock_knapping')
		.tagItem('tfc:igneous_intrusive_rock')
		.tagItem("rnr:loose_rock_items")

	event.create('tfg:loose/mars_stone', 'tfc:loose_rock')
		.stoneSoundType()
		.itemTexture('tfg:item/loose/mars_stone')
		.tagBlock('tfc:loose_rocks')
		.tagItem('tfc:any_knapping')
		.tagItem('tfc:rock_knapping')
		.tagItem('tfc:sedimentary_rock')
		.tagItem("rnr:loose_rock_items")

	event.create('tfg:loose/venus_stone', 'tfc:loose_rock')
		.stoneSoundType()
		.itemTexture('tfg:item/loose/venus_stone')
		.tagBlock('tfc:loose_rocks')
		.tagItem('tfc:any_knapping')
		.tagItem('tfc:rock_knapping')
		.tagItem('tfc:igneous_extrusive_rock')
		.tagItem("rnr:loose_rock_items")

	event.create('tfg:loose/mercury_stone', 'tfc:loose_rock')
		.stoneSoundType()
		.itemTexture('tfg:item/loose/mercury_stone')
		.tagBlock('tfc:loose_rocks')
		.tagItem('tfc:any_knapping')
		.tagItem('tfc:rock_knapping')
		.tagItem('tfc:igneous_intrusive_rock')
		.tagItem("rnr:loose_rock_items")

	event.create('tfg:loose/glacio_stone', 'tfc:loose_rock')
		.stoneSoundType()
		.itemTexture('tfg:item/loose/glacio_stone')
		.tagBlock('tfc:loose_rocks')
		.tagItem('tfc:any_knapping')
		.tagItem('tfc:rock_knapping')
		.tagItem('tfc:igneous_extrusive_rock')
		.tagItem("rnr:loose_rock_items")

	event.create('tfg:loose/permafrost', 'tfc:loose_rock')
		.stoneSoundType()
		.itemTexture('tfg:item/loose/permafrost')
		.tagBlock('tfc:loose_rocks')
		.tagItem('tfc:any_knapping')
		.tagItem('tfc:rock_knapping')
		.tagItem('tfc:metamorphic_rock')
		.tagItem("rnr:loose_rock_items")

	event.create('tfg:loose/red_granite', 'tfc:loose_rock')
		.stoneSoundType()
		.itemTexture('tfg:item/loose/red_granite')
		.tagBlock('tfc:loose_rocks')
		.tagItem('tfc:any_knapping')
		.tagItem('tfc:rock_knapping')
		.tagItem('tfc:igneous_intrusive_rock')
		.tagItem("rnr:loose_rock_items")

	// Spikes

	event.create('tfg:spike/moon_stone_spike', 'tfc:rock_spike')
		.stoneSoundType()
		.noItem()

	event.create('tfg:spike/moon_deepslate_spike', 'tfc:rock_spike')
		.soundType('deepslate')
		.noItem()

	event.create('tfg:spike/mars_stone_spike', 'tfc:rock_spike')
		.stoneSoundType()
		.noItem()

	event.create('tfg:spike/venus_stone_spike', 'tfc:rock_spike')
		.stoneSoundType()
		.noItem()

	event.create('tfg:spike/mercury_stone_spike', 'tfc:rock_spike')
		.stoneSoundType()
		.noItem()

	event.create('tfg:spike/glacio_stone_spike', 'tfc:rock_spike')
		.stoneSoundType()
		.noItem()

	event.create('tfg:spike/permafrost_spike', 'tfc:rock_spike')
		.stoneSoundType()
		.noItem()

	event.create('tfg:spike/red_granite_spike', 'tfc:rock_spike')
		.stoneSoundType()
		.noItem()

	// #region Plants

	/*
	Custom TFG Builder information https://github.com/TerraFirmaGreg-Team/Modpack-Modern/wiki/%5BEN%5D-TFG-Custom-Kubejs-Scripts
	*/

	event.create('tfg:lunar_roots', 'tfg:decorative_plant')
		.soundType('nether_wart')
		.lightLevel(0.4)
		.tagItem('tfg:moon_plants')
		.tagBlock('minecraft:replaceable')

	event.create('tfg:lunar_sprouts', 'tfg:decorative_plant')
		.soundType('nether_wart')
		.tagItem('tfg:moon_plants')
		.tagBlock('minecraft:replaceable')

	event.create('tfg:corallium_arenicolus_0', 'tfg:double_decorative_plant')
		.soundType('nether_wart')
		.tagItem('tfg:venus_plants')
		.lightLevel(0.4)
		.renderType('translucent')

	event.create('tfg:corallium_arenicolus_1', 'tfg:decorative_plant')
		.soundType('nether_wart')
		.tagItem('tfg:venus_plants')
		.box(3, 0, 3, 13, 14, 13)

	event.create('tfg:corallium_arenicolus_2', 'tfg:decorative_plant')
		.soundType('nether_wart')
		.tagItem('tfg:venus_plants')
		.renderType('translucent')
		.box(0, 0, 0, 16, 4, 16)

	event.create('tfg:corallium_arenicolus_3', 'tfg:decorative_plant')
		.soundType('nether_wart')
		.tagItem('tfg:venus_plants')
		.box(3, 0, 3, 13, 14, 13)

	event.create('tfg:corallium_arenicolus_4', 'tfg:decorative_plant')
		.soundType('nether_wart')
		.tagItem('tfg:venus_plants')
		.box(3, 0, 3, 13, 14, 13)

	event.create('tfg:corallium_arenicolus_5', 'tfg:decorative_plant')
		.soundType('nether_wart')
		.tagItem('tfg:venus_plants')
		.box(3, 0, 3, 13, 14, 13)

	event.create('tfg:geyser_source', 'tfg:particle_emitter_decoration')
		.soundType('dripstone_block')
		.mapColor('color_white')
		.resistance(6)
		.hardness(1.5)
		.particleOffset(0.3, 1, 0.3)
		.particleVelocity(0, 0.1, 0)
		.particle('minecraft:campfire_signal_smoke')
		.particleCount(5)
		.particleForced(true)

	event.create('tfg:geyser_source_small', 'tfg:particle_emitter_decoration')
		.soundType('dripstone_block')
		.mapColor('color_white')
		.resistance(6)
		.hardness(1.5)
		.particleOffset(0.3, 1, 0.3)
		.particleVelocity(0, 0.05, 0)
		.particle('minecraft:campfire_cosy_smoke')
		.particleCount(2)
		.particleForced(false)

	event.create('tfg:stromatolite_cluster_small', 'tfg:decorative_plant')
		.soundType('dripstone_block')
		.mapColor('color_brown')
		.box(3, 0, 3, 13, 6, 13)

	event.create('tfg:stromatolite_cluster_medium', 'tfg:decorative_plant')
		.soundType('dripstone_block')
		.mapColor('color_brown')
		.box(3, 0, 3, 13, 14, 13)

	// #endregion

	//#region Venus Blocks
	//Fluorapatite
	const fluorapatite_colors = ['blue', 'green', 'brown', 'orange', 'white', 'yellow'];
	fluorapatite_colors.forEach(color => {
		//Sand
		event.create(`tfg:sand/fluorapatite/${color}`, 'falling')
			.textureAll(`tfg:block/planets/venus/sand_fluorapatite_${color}`)
			.soundType('sand')
			.requiresTool(false)
			.tagBoth('forge:sand')
			.tagItem('forge:sand/fluorapatite')
			.tagBlock('minecraft:mineable/shovel')
			.mapColor(`color_${color}`)
			.fullBlock(true)
			.opaque(true)
		//Raw Sandstone
		event.create(`tfg:sandstone/raw/fluorapatite/${color}`)
			.textureAll(`tfg:block/planets/venus/sandstone_bottom_fluorapatite_${color}`)
			.texture('up', `tfg:block/planets/venus/sandstone_top_fluorapatite_${color}`)
			.hardness(0.8)
			.resistance(0.8)
			.soundType('stone')
			.requiresTool(true)
			.tagBoth('forge:sandstone')
			.tagItem('forge:sandstone/fluorapatite')
			.tagBlock('minecraft:mineable/pickaxe')
			.mapColor(`color_${color}`)
			.fullBlock(true)
			.opaque(true)
		//Smooth Sandstone
		event.create(`tfg:sandstone/smooth/fluorapatite/${color}`)
			.textureAll(`tfg:block/planets/venus/sandstone_top_fluorapatite_${color}`)
			.hardness(0.8)
			.resistance(0.8)
			.soundType('stone')
			.requiresTool(true)
			.tagBoth('forge:sandstone')
			.tagItem('forge:sandstone/fluorapatite')
			.tagBlock('minecraft:mineable/pickaxe')
			.mapColor(`color_${color}`)
			.fullBlock(true)
			.opaque(true)
		//Chiseled Sandstone
		event.create(`tfg:sandstone/smooth/chiseled/fluorapatite/${color}`)
			.textureAll(`tfg:block/planets/venus/sandstone_chiseled_fluorapatite_${color}`)
			.texture('up', `tfg:block/planets/venus/sandstone_top_fluorapatite_${color}`)
			.texture('down', `tfg:block/planets/venus/sandstone_bottom_fluorapatite_${color}`)
			.hardness(0.8)
			.resistance(0.8)
			.soundType('stone')
			.requiresTool(true)
			.tagBoth('forge:sandstone')
			.tagItem('forge:sandstone/fluorapatite')
			.tagBlock('minecraft:mineable/pickaxe')
			.mapColor(`color_${color}`)
			.fullBlock(true)
			.opaque(true)
		//Sandstone
		event.create(`tfg:sandstone/fluorapatite/${color}`)
			.textureAll(`tfg:block/planets/venus/sandstone_fluorapatite_${color}`)
			.texture('down', `tfg:block/planets/venus/sandstone_bottom_fluorapatite_${color}`)
			.texture('up', `tfg:block/planets/venus/sandstone_top_fluorapatite_${color}`)
			.hardness(0.8)
			.resistance(0.8)
			.soundType('stone')
			.requiresTool(true)
			.tagBoth('forge:sandstone')
			.tagItem('forge:sandstone/fluorapatite')
			.tagBlock('minecraft:mineable/pickaxe')
			.mapColor(`color_${color}`)
			.fullBlock(true)
			.opaque(true)
	})

	//#region Venus Stone

	//Stromatolite
	event.create('tfg:rock/raw/stromatolite', 'tfc:raw_rock')
		.textureAll('tfg:block/planets/venus/stromatolite_spike')
		.model('tfg:block/rock/stromatolite_block')
		.rockTypeTooltip(Text.translatable('tooltip.tfg.sedimentary'))
		.naturallySupported(true)
		.sedimentary()
		.renderType('cutout')
		.soundType('dripstone_block')
		.requiresTool(true)
		.hardness(0.8)
		.resistance(0.8)
		.tagBlock('minecraft:mineable/pickaxe')

    event.create('tfg:rock/spike/stromatolite', 'tfc:rock_spike')
		.textureAll('tfg:block/planets/venus/stromatolite_spike')
		.soundType('dripstone_block')
		.hardness(0.8)
		.resistance(0.8)
		.requiresTool(true)
		.tagBlock('minecraft:mineable/pickaxe')

	//Geyserite
	event.create('tfg:rock/raw/geyserite', 'tfc:raw_rock')
		.textureAll('tfg:block/planets/venus/geyserite')
		.rockTypeTooltip(Text.translatable('tooltip.tfg.sedimentary'))
		.naturallySupported(true)
		.sedimentary()
		.soundType('dripstone_block')
		.requiresTool(true)
		.hardness(0.8)
		.resistance(0.8)
		.tagBlock('minecraft:mineable/pickaxe')

    event.create('tfg:rock/spike/geyserite', 'tfc:rock_spike')
		.textureAll('tfg:block/planets/venus/geyserite')
		.soundType('dripstone_block')
		.hardness(0.8)
		.resistance(0.8)
		.requiresTool(true)
		.tagBlock('minecraft:mineable/pickaxe')

}