Lab lamp recipe, hardened glass tags

This commit is contained in:
DBotThePony 2022-09-25 22:36:37 +07:00
parent b1e0fce1fa
commit 2e86f2b599
Signed by: DBot
GPG Key ID: DCC23B5715498507
14 changed files with 180 additions and 14 deletions

View File

@ -31,6 +31,7 @@ import ru.dbotthepony.mc.otm.datagen.lang.MatteryLanguageProvider
import ru.dbotthepony.mc.otm.datagen.loot.addLootModifiers import ru.dbotthepony.mc.otm.datagen.loot.addLootModifiers
import ru.dbotthepony.mc.otm.datagen.loot.addLootTables import ru.dbotthepony.mc.otm.datagen.loot.addLootTables
import ru.dbotthepony.mc.otm.datagen.models.MatteryModelBuilder import ru.dbotthepony.mc.otm.datagen.models.MatteryModelBuilder
import ru.dbotthepony.mc.otm.datagen.recipes.addBlastingRecipes
import ru.dbotthepony.mc.otm.datagen.recipes.addCraftingTableRecipes import ru.dbotthepony.mc.otm.datagen.recipes.addCraftingTableRecipes
import ru.dbotthepony.mc.otm.datagen.recipes.addDecorativesRecipes import ru.dbotthepony.mc.otm.datagen.recipes.addDecorativesRecipes
import ru.dbotthepony.mc.otm.datagen.recipes.addPlatePressRecipes import ru.dbotthepony.mc.otm.datagen.recipes.addPlatePressRecipes
@ -269,6 +270,7 @@ object DataGen {
recipeProvider.exec { _, consumer -> recipeProvider.exec { _, consumer ->
addCraftingTableRecipes(consumer) addCraftingTableRecipes(consumer)
addBlastingRecipes(consumer)
addDecorativesRecipes(recipeProvider, consumer) addDecorativesRecipes(recipeProvider, consumer)
} }

View File

@ -339,6 +339,7 @@ private fun blocks(provider: MatteryLanguageProvider) {
add(MBlocks.PHANTOM_ATTRACTOR, "desc2", "Requires no power to operate") add(MBlocks.PHANTOM_ATTRACTOR, "desc2", "Requires no power to operate")
add(MBlocks.LABORATORY_LAMP, "Laboratory Lamp") add(MBlocks.LABORATORY_LAMP, "Laboratory Lamp")
add(MBlocks.LABORATORY_LAMP, "description", "Provides directional light with redstone switch")
add(MBlocks.LABORATORY_LAMP_INVERTED, "Laboratory Lamp (Inverted Signal)") add(MBlocks.LABORATORY_LAMP_INVERTED, "Laboratory Lamp (Inverted Signal)")
add(MBlocks.DANGER_STRIPE_BLOCK, "Danger Stripes") add(MBlocks.DANGER_STRIPE_BLOCK, "Danger Stripes")
add(MBlocks.METAL_BEAM, "Metal Beam") add(MBlocks.METAL_BEAM, "Metal Beam")
@ -401,6 +402,9 @@ private fun items(provider: MatteryLanguageProvider) {
add(MItems.ADVANCED_CONTROL_CIRCUIT, "Advanced Control Circuit") add(MItems.ADVANCED_CONTROL_CIRCUIT, "Advanced Control Circuit")
add(MItems.QUANTUM_TRANSCEIVER, "Quantum Transceiver") add(MItems.QUANTUM_TRANSCEIVER, "Quantum Transceiver")
add(MItems.ELECTROMAGNET, "Electromagnet") add(MItems.ELECTROMAGNET, "Electromagnet")
add(MItems.MIRROR_COMPOUND, "Mirror Compound")
add(MItems.MIRROR, "Mirror")
add(MItems.MIRROR, "description", "You can clearly see your reflection in this thing")
add(MItems.GRAVITATIONAL_DISRUPTOR, "Gravitational Disruptor") add(MItems.GRAVITATIONAL_DISRUPTOR, "Gravitational Disruptor")

View File

@ -0,0 +1,11 @@
package ru.dbotthepony.mc.otm.datagen.recipes
import net.minecraft.data.recipes.FinishedRecipe
import net.minecraft.data.recipes.SimpleCookingRecipeBuilder
import net.minecraft.world.item.crafting.Ingredient
import ru.dbotthepony.mc.otm.registry.MItems
import java.util.function.Consumer
fun addBlastingRecipes(consumer: Consumer<FinishedRecipe>) {
SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItems.MIRROR_COMPOUND), MItems.MIRROR, 0.1f, 100).unlockedBy(MItems.MIRROR_COMPOUND).save(consumer)
}

View File

@ -155,7 +155,14 @@ fun addCraftingTableRecipes(consumer: Consumer<FinishedRecipe>) {
MatteryRecipe(MItems.ENERGY_SERVO) MatteryRecipe(MItems.ENERGY_SERVO)
.row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES)
.row(MItemTags.TRITANIUM_PLATES, MItems.ENERGY_BUS, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, MItems.ENERGY_BUS, MItemTags.TRITANIUM_PLATES)
.unlockedBy(Tags.Items.ENDER_PEARLS) .unlockedBy(MItems.ENERGY_BUS)
.build(consumer)
MatteryRecipe(MItems.MIRROR_COMPOUND, 3)
.row(Tags.Items.GLASS_PANES_COLORLESS, Tags.Items.GLASS_PANES_COLORLESS, Tags.Items.GLASS_PANES_COLORLESS)
.row(MItemTags.IRON_PLATES, MItemTags.IRON_PLATES, MItemTags.IRON_PLATES)
.unlockedBy(MItemTags.IRON_PLATES)
.unlockedBy(Tags.Items.GLASS_PANES_COLORLESS)
.build(consumer) .build(consumer)
// броня // броня
@ -237,4 +244,10 @@ fun addCraftingTableRecipes(consumer: Consumer<FinishedRecipe>) {
.row(MItems.BATTERY_CAPACITOR, MItems.TRITANIUM_SWORD, MItemTags.ADVANCED_CIRCUIT) .row(MItems.BATTERY_CAPACITOR, MItems.TRITANIUM_SWORD, MItemTags.ADVANCED_CIRCUIT)
.unlockedBy(MItems.BATTERY_CAPACITOR) .unlockedBy(MItems.BATTERY_CAPACITOR)
.buildEnergetic(consumer) .buildEnergetic(consumer)
MatteryRecipe(MItems.LABORATORY_LAMP)
.row(MItemTags.IRON_PLATES, MItemTags.HARDENED_GLASS_PANES_COLORLESS, MItemTags.IRON_PLATES)
.row(MItems.MIRROR, Items.GLOWSTONE, MItems.MIRROR)
.row(MItemTags.TRITANIUM_PLATES, Tags.Items.DUSTS_REDSTONE, MItemTags.TRITANIUM_PLATES)
.build(consumer)
} }

View File

@ -3,6 +3,7 @@ package ru.dbotthepony.mc.otm.datagen.recipes
import net.minecraft.advancements.CriterionTriggerInstance import net.minecraft.advancements.CriterionTriggerInstance
import net.minecraft.data.recipes.FinishedRecipe import net.minecraft.data.recipes.FinishedRecipe
import net.minecraft.data.recipes.RecipeBuilder
import net.minecraft.data.recipes.ShapedRecipeBuilder import net.minecraft.data.recipes.ShapedRecipeBuilder
import net.minecraft.data.recipes.ShapelessRecipeBuilder import net.minecraft.data.recipes.ShapelessRecipeBuilder
import net.minecraft.resources.ResourceLocation import net.minecraft.resources.ResourceLocation
@ -49,15 +50,6 @@ private data class RecipeRow(
val c: RecipeCell?, val c: RecipeCell?,
) )
fun ShapelessRecipeBuilder.unlockedBy(item: ItemLike): ShapelessRecipeBuilder {
val location = item.asItem().registryName!!
return unlockedBy("has_${location.namespace}_${location.path}", has(item))
}
fun ShapelessRecipeBuilder.unlockedBy(item: TagKey<Item>): ShapelessRecipeBuilder {
return unlockedBy("has_${item.location.namespace}_${item.location.path}", has(item))
}
/** /**
* [ShapedRecipeBuilder] that doesn't suck * [ShapedRecipeBuilder] that doesn't suck
*/ */

View File

@ -6,12 +6,14 @@ import net.minecraft.advancements.critereon.ItemPredicate
import net.minecraft.advancements.critereon.MinMaxBounds import net.minecraft.advancements.critereon.MinMaxBounds
import net.minecraft.data.DataGenerator import net.minecraft.data.DataGenerator
import net.minecraft.data.recipes.FinishedRecipe import net.minecraft.data.recipes.FinishedRecipe
import net.minecraft.data.recipes.RecipeBuilder
import net.minecraft.data.recipes.RecipeProvider import net.minecraft.data.recipes.RecipeProvider
import net.minecraft.resources.ResourceLocation import net.minecraft.resources.ResourceLocation
import net.minecraft.tags.TagKey import net.minecraft.tags.TagKey
import net.minecraft.world.item.Item import net.minecraft.world.item.Item
import net.minecraft.world.item.crafting.Ingredient import net.minecraft.world.item.crafting.Ingredient
import net.minecraft.world.level.ItemLike import net.minecraft.world.level.ItemLike
import ru.dbotthepony.mc.otm.core.registryName
import ru.dbotthepony.mc.otm.datagen.DataGen import ru.dbotthepony.mc.otm.datagen.DataGen
import ru.dbotthepony.mc.otm.recipe.PlatePressRecipe import ru.dbotthepony.mc.otm.recipe.PlatePressRecipe
import java.util.LinkedList import java.util.LinkedList
@ -41,6 +43,15 @@ fun inventoryTrigger(vararg p_126012_: ItemPredicate): InventoryChangeTrigger.Tr
) )
} }
fun RecipeBuilder.unlockedBy(item: ItemLike): RecipeBuilder {
val location = item.asItem().registryName!!
return unlockedBy("has_${location.namespace}_${location.path}", has(item))
}
fun RecipeBuilder.unlockedBy(item: TagKey<Item>): RecipeBuilder {
return unlockedBy("has_${item.location.namespace}_${item.location.path}", has(item))
}
class MatteryRecipeProvider(generatorIn: DataGenerator) : RecipeProvider(generatorIn) { class MatteryRecipeProvider(generatorIn: DataGenerator) : RecipeProvider(generatorIn) {
private val callbacks = LinkedList<RecipeBuilderCallback>() private val callbacks = LinkedList<RecipeBuilderCallback>()

View File

@ -1,6 +1,7 @@
package ru.dbotthepony.mc.otm.datagen.tags package ru.dbotthepony.mc.otm.datagen.tags
import net.minecraft.world.effect.MobEffects import net.minecraft.world.effect.MobEffects
import net.minecraft.world.item.DyeColor
import net.minecraft.world.item.Items import net.minecraft.world.item.Items
import net.minecraft.world.item.Tiers import net.minecraft.world.item.Tiers
import ru.dbotthepony.mc.otm.registry.MBlocks import ru.dbotthepony.mc.otm.registry.MBlocks
@ -31,6 +32,28 @@ fun addTags(tagsProvider: TagsProvider) {
MBlocks.STORAGE_CABLE MBlocks.STORAGE_CABLE
) )
tagsProvider.items.forge("hardened_glass").add(MRegistry.INDUSTRIAL_GLASS.allItems.values)
tagsProvider.items.forge("hardened_glass/colorless").add(MRegistry.INDUSTRIAL_GLASS.item)
tagsProvider.items.forge("hardened_glass/tinted").add(MRegistry.INDUSTRIAL_GLASS.items.values)
tagsProvider.items.forge("hardened_glass_panes").add(MRegistry.INDUSTRIAL_GLASS_PANE.allItems.values)
tagsProvider.items.forge("hardened_glass_panes/colorless").add(MRegistry.INDUSTRIAL_GLASS_PANE.item)
tagsProvider.items.forge("hardened_glass_panes/tinted").add(MRegistry.INDUSTRIAL_GLASS_PANE.items.values)
MRegistry.INDUSTRIAL_GLASS.forEachItem { s, _, item -> tagsProvider.items.forge("hardened_glass/$s").add(item) }
MRegistry.INDUSTRIAL_GLASS_PANE.forEachItem { s, _, item -> tagsProvider.items.forge("hardened_glass_panes/$s").add(item) }
tagsProvider.blocks.forge("hardened_glass").add(MRegistry.INDUSTRIAL_GLASS.allBlocks.values)
tagsProvider.blocks.forge("hardened_glass/colorless").add(MRegistry.INDUSTRIAL_GLASS.block)
tagsProvider.blocks.forge("hardened_glass/tinted").add(MRegistry.INDUSTRIAL_GLASS.blocks.values)
tagsProvider.blocks.forge("hardened_glass_panes").add(MRegistry.INDUSTRIAL_GLASS_PANE.allBlocks.values)
tagsProvider.blocks.forge("hardened_glass_panes/colorless").add(MRegistry.INDUSTRIAL_GLASS_PANE.block)
tagsProvider.blocks.forge("hardened_glass_panes/tinted").add(MRegistry.INDUSTRIAL_GLASS_PANE.blocks.values)
MRegistry.INDUSTRIAL_GLASS.forEachBlock { s, _, block -> tagsProvider.blocks.forge("hardened_glass/$s").add(block) }
MRegistry.INDUSTRIAL_GLASS_PANE.forEachBlock { s, _, block -> tagsProvider.blocks.forge("hardened_glass_panes/$s").add(block) }
tagsProvider.requiresPickaxe(listOf( tagsProvider.requiresPickaxe(listOf(
MBlocks.ANDROID_STATION, MBlocks.ANDROID_STATION,
MBlocks.BATTERY_BANK, MBlocks.BATTERY_BANK,

View File

@ -82,7 +82,11 @@ object ServerConfig {
init { init {
specBuilder.comment("Serverside config, holds shared values that are required to be read by both client and server.").push("server") specBuilder.comment("Serverside config, holds shared values that are required to be read by both client and server.").push("server")
}
val LABORATORY_LAMP_LIGHT_LENGTH: Int by specBuilder.comment("In blocks").defineInRange("laboratoryLampLightLength", 3, 1, 128)
init {
specBuilder.comment("Energy batteries balance values").push("energyBatteries") specBuilder.comment("Energy batteries balance values").push("energyBatteries")
} }

View File

@ -1,7 +1,11 @@
package ru.dbotthepony.mc.otm.block package ru.dbotthepony.mc.otm.block
import net.minecraft.ChatFormatting
import net.minecraft.core.BlockPos import net.minecraft.core.BlockPos
import net.minecraft.network.chat.Component
import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.Items import net.minecraft.world.item.Items
import net.minecraft.world.item.TooltipFlag
import net.minecraft.world.item.context.BlockPlaceContext import net.minecraft.world.item.context.BlockPlaceContext
import net.minecraft.world.level.BlockGetter import net.minecraft.world.level.BlockGetter
import net.minecraft.world.level.Level import net.minecraft.world.level.Level
@ -15,6 +19,8 @@ import net.minecraft.world.level.material.Material
import net.minecraft.world.phys.shapes.CollisionContext import net.minecraft.world.phys.shapes.CollisionContext
import net.minecraft.world.phys.shapes.Shapes import net.minecraft.world.phys.shapes.Shapes
import net.minecraft.world.phys.shapes.VoxelShape import net.minecraft.world.phys.shapes.VoxelShape
import ru.dbotthepony.mc.otm.ServerConfig
import ru.dbotthepony.mc.otm.core.TranslatableComponent
import ru.dbotthepony.mc.otm.core.get import ru.dbotthepony.mc.otm.core.get
import ru.dbotthepony.mc.otm.core.plus import ru.dbotthepony.mc.otm.core.plus
import ru.dbotthepony.mc.otm.core.times import ru.dbotthepony.mc.otm.core.times
@ -22,8 +28,6 @@ import ru.dbotthepony.mc.otm.core.unaryMinus
import ru.dbotthepony.mc.otm.once import ru.dbotthepony.mc.otm.once
import ru.dbotthepony.mc.otm.registry.MBlocks import ru.dbotthepony.mc.otm.registry.MBlocks
const val LIGHT_LENGTH = 3
class LaboratoryLampLight : Block(Properties.of(Material.AIR).strength(-1.0F, 3600000.8F).noLootTable().noOcclusion().lightLevel { 15 }) { class LaboratoryLampLight : Block(Properties.of(Material.AIR).strength(-1.0F, 3600000.8F).noLootTable().noOcclusion().lightLevel { 15 }) {
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) { override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
super.createBlockStateDefinition(builder) super.createBlockStateDefinition(builder)
@ -72,7 +76,7 @@ class LaboratoryLampLight : Block(Properties.of(Material.AIR).strength(-1.0F, 36
var hit = false var hit = false
for (i in 1 .. LIGHT_LENGTH) { for (i in 1 .. ServerConfig.LABORATORY_LAMP_LIGHT_LENGTH) {
val target = pos + facing * i val target = pos + facing * i
val targetState = level.getBlockState(target) val targetState = level.getBlockState(target)
@ -107,6 +111,16 @@ class LaboratoryLamp(val invertRedstone: Boolean) : Block(Properties.of(Material
return super.getStateForPlacement(context)!!.setValue(BlockStateProperties.LIT, !invertRedstone).setValue(RotatableMatteryBlock.FACING_FULL, context.nearestLookingDirection) return super.getStateForPlacement(context)!!.setValue(BlockStateProperties.LIT, !invertRedstone).setValue(RotatableMatteryBlock.FACING_FULL, context.nearestLookingDirection)
} }
override fun appendHoverText(
p_49816_: ItemStack,
p_49817_: BlockGetter?,
p_49818_: MutableList<Component>,
p_49819_: TooltipFlag
) {
super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
p_49818_.add(TranslatableComponent("${MBlocks.LABORATORY_LAMP.descriptionId}.description").withStyle(ChatFormatting.GRAY))
}
@Suppress("OVERRIDE_DEPRECATION") @Suppress("OVERRIDE_DEPRECATION")
override fun onPlace( override fun onPlace(
state: BlockState, state: BlockState,
@ -144,7 +158,7 @@ class LaboratoryLamp(val invertRedstone: Boolean) : Block(Properties.of(Material
val facing = state[RotatableMatteryBlock.FACING_FULL] val facing = state[RotatableMatteryBlock.FACING_FULL]
for (i in 1 .. LIGHT_LENGTH) { for (i in 1 .. ServerConfig.LABORATORY_LAMP_LIGHT_LENGTH) {
val target = pos + facing * i val target = pos + facing * i
val targetState = level.getBlockState(target) val targetState = level.getBlockState(target)

View File

@ -244,6 +244,18 @@ object MItems {
val QUANTUM_TRANSCEIVER: Item by registry.register("quantum_transceiver") { Item(DEFAULT_PROPERTIES) } val QUANTUM_TRANSCEIVER: Item by registry.register("quantum_transceiver") { Item(DEFAULT_PROPERTIES) }
val ELECTROMAGNET: Item by registry.register("electromagnet") { Item(DEFAULT_PROPERTIES) } val ELECTROMAGNET: Item by registry.register("electromagnet") { Item(DEFAULT_PROPERTIES) }
val MIRROR_COMPOUND: Item by registry.register("mirror_compound") { Item(DEFAULT_PROPERTIES) }
val MIRROR: Item by registry.register("mirror") { object : Item(DEFAULT_PROPERTIES) {
override fun appendHoverText(
p_41421_: ItemStack,
p_41422_: Level?,
p_41423_: MutableList<Component>,
p_41424_: TooltipFlag
) {
super.appendHoverText(p_41421_, p_41422_, p_41423_, p_41424_)
p_41423_.add(TranslatableComponent("$descriptionId.description").withStyle(ChatFormatting.DARK_GRAY))
}
} }
val DATAGEN_COMPONENTS = LazyList( val DATAGEN_COMPONENTS = LazyList(
{ ENERGY_BUS }, { ENERGY_BUS },
@ -261,6 +273,8 @@ object MItems {
{ MATTER_TRANSFORM_MATRIX }, { MATTER_TRANSFORM_MATRIX },
{ QUANTUM_TRANSCEIVER }, { QUANTUM_TRANSCEIVER },
{ ELECTROMAGNET }, { ELECTROMAGNET },
{ MIRROR_COMPOUND },
{ MIRROR },
) )
val EXOSUIT_PROBE: Item by registry.register(MNames.EXOSUIT_PROBE, ::ExoSuitProbeItem) val EXOSUIT_PROBE: Item by registry.register(MNames.EXOSUIT_PROBE, ::ExoSuitProbeItem)

View File

@ -6,6 +6,7 @@ import net.minecraft.tags.TagKey
import net.minecraft.world.item.Item import net.minecraft.world.item.Item
import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.OverdriveThatMatters
@Suppress("unused")
object MItemTags { object MItemTags {
val TRITANIUM_INGOTS: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "ingots/tritanium")) val TRITANIUM_INGOTS: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "ingots/tritanium"))
val TRITANIUM_PLATES: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "plates/tritanium")) val TRITANIUM_PLATES: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "plates/tritanium"))
@ -21,4 +22,42 @@ object MItemTags {
val GOLD_WIRES: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "wires/gold")) val GOLD_WIRES: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "wires/gold"))
val PISTONS: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "pistons")) val PISTONS: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "pistons"))
val HARDENED_GLASS_PANES: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass_panes"))
val HARDENED_GLASS_PANES_BLACK: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass_panes/black"))
val HARDENED_GLASS_PANES_BLUE: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass_panes/blue"))
val HARDENED_GLASS_PANES_BROWN: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass_panes/brown"))
val HARDENED_GLASS_PANES_COLORLESS: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass_panes/colorless"))
val HARDENED_GLASS_PANES_CYAN: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass_panes/cyan"))
val HARDENED_GLASS_PANES_GRAY: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass_panes/gray"))
val HARDENED_GLASS_PANES_GREEN: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass_panes/green"))
val HARDENED_GLASS_PANES_LIGHT_BLUE: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass_panes/light_blue"))
val HARDENED_GLASS_PANES_LIGHT_GRAY: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass_panes/light_gray"))
val HARDENED_GLASS_PANES_LIME: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass_panes/lime"))
val HARDENED_GLASS_PANES_MAGENTA: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass_panes/magenta"))
val HARDENED_GLASS_PANES_ORANGE: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass_panes/orange"))
val HARDENED_GLASS_PANES_PINK: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass_panes/pink"))
val HARDENED_GLASS_PANES_PURPLE: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass_panes/purple"))
val HARDENED_GLASS_PANES_RED: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass_panes/red"))
val HARDENED_GLASS_PANES_WHITE: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass_panes/white"))
val HARDENED_GLASS_PANES_YELLOW: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass_panes/yellow"))
val HARDENED_GLASS: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass"))
val HARDENED_GLASS_BLACK: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass/black"))
val HARDENED_GLASS_BLUE: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass/blue"))
val HARDENED_GLASS_BROWN: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass/brown"))
val HARDENED_GLASS_COLORLESS: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass/colorless"))
val HARDENED_GLASS_CYAN: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass/cyan"))
val HARDENED_GLASS_GRAY: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass/gray"))
val HARDENED_GLASS_GREEN: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass/green"))
val HARDENED_GLASS_LIGHT_BLUE: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass/light_blue"))
val HARDENED_GLASS_LIGHT_GRAY: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass/light_gray"))
val HARDENED_GLASS_LIME: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass/lime"))
val HARDENED_GLASS_MAGENTA: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass/magenta"))
val HARDENED_GLASS_ORANGE: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass/orange"))
val HARDENED_GLASS_PINK: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass/pink"))
val HARDENED_GLASS_PURPLE: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass/purple"))
val HARDENED_GLASS_RED: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass/red"))
val HARDENED_GLASS_WHITE: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass/white"))
val HARDENED_GLASS_YELLOW: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass/yellow"))
} }

View File

@ -10,6 +10,7 @@ import net.minecraftforge.registries.DeferredRegister
import net.minecraftforge.registries.RegistryObject import net.minecraftforge.registries.RegistryObject
import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.registry.LazyMap import ru.dbotthepony.mc.otm.registry.LazyMap
import ru.dbotthepony.mc.otm.registry.MRegistry
import java.util.EnumMap import java.util.EnumMap
/** /**
@ -30,6 +31,44 @@ open class ColoredDecorativeBlock(
protected val itemMap = EnumMap<DyeColor, RegistryObject<Item>>(DyeColor::class.java) protected val itemMap = EnumMap<DyeColor, RegistryObject<Item>>(DyeColor::class.java)
protected val blockMap = EnumMap<DyeColor, RegistryObject<Block>>(DyeColor::class.java) protected val blockMap = EnumMap<DyeColor, RegistryObject<Block>>(DyeColor::class.java)
fun forEachItem(consumer: (String, DyeColor, Item) -> Unit) {
consumer.invoke("black", DyeColor.BLACK, getItem(DyeColor.BLACK))
consumer.invoke("blue", DyeColor.BLUE, getItem(DyeColor.BLUE))
consumer.invoke("brown", DyeColor.BROWN, getItem(DyeColor.BROWN))
consumer.invoke("cyan", DyeColor.CYAN, getItem(DyeColor.CYAN))
consumer.invoke("gray", DyeColor.GRAY, getItem(DyeColor.GRAY))
consumer.invoke("green", DyeColor.GREEN, getItem(DyeColor.GREEN))
consumer.invoke("light_blue", DyeColor.LIGHT_BLUE, getItem(DyeColor.LIGHT_BLUE))
consumer.invoke("light_gray", DyeColor.LIGHT_GRAY, getItem(DyeColor.LIGHT_GRAY))
consumer.invoke("lime", DyeColor.LIME, getItem(DyeColor.LIME))
consumer.invoke("magenta", DyeColor.MAGENTA, getItem(DyeColor.MAGENTA))
consumer.invoke("orange", DyeColor.ORANGE, getItem(DyeColor.ORANGE))
consumer.invoke("pink", DyeColor.PINK, getItem(DyeColor.PINK))
consumer.invoke("purple", DyeColor.PURPLE, getItem(DyeColor.PURPLE))
consumer.invoke("red", DyeColor.RED, getItem(DyeColor.RED))
consumer.invoke("white", DyeColor.WHITE, getItem(DyeColor.WHITE))
consumer.invoke("yellow", DyeColor.YELLOW, getItem(DyeColor.YELLOW))
}
fun forEachBlock(consumer: (String, DyeColor, Block) -> Unit) {
consumer.invoke("black", DyeColor.BLACK, getBlock(DyeColor.BLACK))
consumer.invoke("blue", DyeColor.BLUE, getBlock(DyeColor.BLUE))
consumer.invoke("brown", DyeColor.BROWN, getBlock(DyeColor.BROWN))
consumer.invoke("cyan", DyeColor.CYAN, getBlock(DyeColor.CYAN))
consumer.invoke("gray", DyeColor.GRAY, getBlock(DyeColor.GRAY))
consumer.invoke("green", DyeColor.GREEN, getBlock(DyeColor.GREEN))
consumer.invoke("light_blue", DyeColor.LIGHT_BLUE, getBlock(DyeColor.LIGHT_BLUE))
consumer.invoke("light_gray", DyeColor.LIGHT_GRAY, getBlock(DyeColor.LIGHT_GRAY))
consumer.invoke("lime", DyeColor.LIME, getBlock(DyeColor.LIME))
consumer.invoke("magenta", DyeColor.MAGENTA, getBlock(DyeColor.MAGENTA))
consumer.invoke("orange", DyeColor.ORANGE, getBlock(DyeColor.ORANGE))
consumer.invoke("pink", DyeColor.PINK, getBlock(DyeColor.PINK))
consumer.invoke("purple", DyeColor.PURPLE, getBlock(DyeColor.PURPLE))
consumer.invoke("red", DyeColor.RED, getBlock(DyeColor.RED))
consumer.invoke("white", DyeColor.WHITE, getBlock(DyeColor.WHITE))
consumer.invoke("yellow", DyeColor.YELLOW, getBlock(DyeColor.YELLOW))
}
fun getItem(dyeColor: DyeColor): Item { fun getItem(dyeColor: DyeColor): Item {
check(registeredItems) { "Didn't register items yet" } check(registeredItems) { "Didn't register items yet" }
return itemMap[dyeColor]!!.get() return itemMap[dyeColor]!!.get()

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB