diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/ResearchData.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/ResearchData.kt index 210bc0ef4..5f9b86865 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/ResearchData.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/ResearchData.kt @@ -1,5 +1,7 @@ package ru.dbotthepony.mc.otm.datagen +import net.minecraft.world.item.Items +import net.minecraftforge.common.Tags import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.android.AndroidResearchType import ru.dbotthepony.mc.otm.android.feature.ItemMagnetFeature @@ -10,6 +12,8 @@ import ru.dbotthepony.mc.otm.core.TextComponent import ru.dbotthepony.mc.otm.core.TranslatableComponent import ru.dbotthepony.mc.otm.datagen.lang.MatteryLanguageProvider import ru.dbotthepony.mc.otm.registry.AndroidFeatures +import ru.dbotthepony.mc.otm.registry.MItemTags +import ru.dbotthepony.mc.otm.registry.MItems import ru.dbotthepony.mc.otm.registry.MNames import java.util.LinkedList import java.util.function.Consumer @@ -21,6 +25,8 @@ fun addResearchData(serializer: Consumer, lang: MatteryLang .addFeatureResult(AndroidFeatures.AIR_BAGS) .withDescription() .withIcon(ResearchIcons.ICON_AIR_BAGS) + .addItem(Tags.Items.GLASS_PANES, 6) + .addItem(MItemTags.PLATE_IRON) .build() serializer.accept(AIR_BAGS) @@ -29,6 +35,9 @@ fun addResearchData(serializer: Consumer, lang: MatteryLang .withExperience(20) .withDescription() .withIcon(ResearchIcons.ICON_EXTENDED_REACH) + .addItem(MItemTags.PLATE_TRITANIUM, 3) + .addItem(MItemTags.PLATE_IRON, 2) + .addItem(MItemTags.GOLD_WIRES, 4) .build() serializer.accept(IMPROVED_LIMBS) @@ -39,6 +48,9 @@ fun addResearchData(serializer: Consumer, lang: MatteryLang .withDescription() .withIcon(ResearchIcons.ICON_STEP_ASSIST) .addPrerequisite(IMPROVED_LIMBS) + .addItem(MItemTags.PISTONS, 2) + .addItem(MItemTags.PLATE_TRITANIUM, 4) + .addItem(MItemTags.COPPER_WIRES, 6) .build() serializer.accept(STEP_ASSIST) @@ -49,6 +61,10 @@ fun addResearchData(serializer: Consumer, lang: MatteryLang .addPrerequisite(IMPROVED_LIMBS) .withDescription() .withIcon(ResearchIcons.ICON_EXTENDED_REACH) + .addItem(MItemTags.PISTONS, 2) + .addItem(MItemTags.PLATE_TRITANIUM, 4) + .addItem(MItemTags.GOLD_WIRES, 6) + .addItem(MItems.QUANTUM_TRANSCEIVER) .build() serializer.accept(EXTENDED_REACH) @@ -58,6 +74,12 @@ fun addResearchData(serializer: Consumer, lang: MatteryLang .withDescription() .withIcon(ResearchIcons.ICON_NIGHT_VISION) .addFeatureResult(AndroidFeatures.NIGHT_VISION) + .addItem(Tags.Items.GLASS_PANES_COLORLESS, 4) + .addItem(Tags.Items.DUSTS_REDSTONE, 4) + .addItem(MItemTags.PLATE_TRITANIUM, 2) + .addItem(MItems.ELECTRIC_PARTS, 3) + .addItem(MItemTags.ADVANCED_CIRCUIT) + .addItem(Items.ENDER_EYE, 2) .build() serializer.accept(NIGHT_VISION) @@ -77,6 +99,8 @@ fun addResearchData(serializer: Consumer, lang: MatteryLang .addFeatureResult(OverdriveThatMatters.loc(MNames.NANOBOTS_ARMOR)) .withIcon(ResearchIcons.ICON_ARMOR) .addBlocker(OverdriveThatMatters.loc(MNames.ATTACK_BOOST_1), rigid = true) + .addItem(MItemTags.PLATE_TRITANIUM, 4) + .addItem(MItemTags.COPPER_WIRES, 8) .build() serializer.accept(NANOBOTS_ARMOR) @@ -102,10 +126,12 @@ fun addResearchData(serializer: Consumer, lang: MatteryLang (i + 1) * 6 ) ) + .addItem(MItemTags.COPPER_WIRES, 4 + i * 2) .addFeatureResult(OverdriveThatMatters.loc(MNames.LIMB_OVERCLOCKING), i) if (i > 0) { research.addPrerequisite(OverdriveThatMatters.loc(MNames.LIMB_OVERCLOCKING_LIST[i - 1]), rigid = true) + research.addItem(MItemTags.GOLD_WIRES, i * 2) } research.build() @@ -145,6 +171,9 @@ fun addResearchData(serializer: Consumer, lang: MatteryLang "android_research.overdrive_that_matters.nanobots_regeneration.description" ) ) + .addItem(MItems.MATTER_CAPACITOR_PARTS, 1) + .addItem(Items.SUGAR, 2 + i * 2) + .addItem(Tags.Items.DUSTS_REDSTONE, 2 + i * 2) .addFeatureResult(AndroidFeatures.NANOBOTS_REGENERATION, i) if (i > 0) { @@ -179,6 +208,8 @@ fun addResearchData(serializer: Consumer, lang: MatteryLang (i + 1) * 6 ) ) + .addItem(MItemTags.PLATE_TRITANIUM, 2 + i * 2) + .addItem(Items.SUGAR, 1 + i) .addFeatureResult(AndroidFeatures.NANOBOTS_ARMOR, 0, transformersUp = listOf(NanobotsArmorFeature.STRENGTH_TRANSFORMER_UP.bind(level)), transformersDown = listOf(NanobotsArmorFeature.STRENGTH_TRANSFORMER_DOWN.bind(level)), @@ -205,6 +236,7 @@ fun addResearchData(serializer: Consumer, lang: MatteryLang (i + 1) * 6 ) ) + .addItem(Tags.Items.DUSTS_REDSTONE, 4 + i * 4) .addFeatureResult(AndroidFeatures.NANOBOTS_ARMOR, 0, transformersUp = listOf(NanobotsArmorFeature.SPEED_TRANSFORMER_UP.bind(level)), transformersDown = listOf(NanobotsArmorFeature.SPEED_TRANSFORMER_DOWN.bind(level)), @@ -227,6 +259,10 @@ fun addResearchData(serializer: Consumer, lang: MatteryLang .withIcon(ResearchIcons.ICON_SHOCKWAVE) .addFeatureResult(AndroidFeatures.SHOCKWAVE) .addPrerequisite(attackBoostList[2]) + .addItem(Tags.Items.ENDER_PEARLS) + .addItem(Tags.Items.DUSTS_REDSTONE, 2) + .addItem(MItemTags.GOLD_WIRES, 4) + .addItem(MItemTags.PLATE_GOLD, 2) .build() val ITEM_MAGNET = @@ -237,6 +273,9 @@ fun addResearchData(serializer: Consumer, lang: MatteryLang .withIcon(ResearchIcons.ICON_ITEM_MAGNET) .addFeatureResult(AndroidFeatures.ITEM_MAGNET) .addPrerequisite(STEP_ASSIST) + .addItem(MItems.QUANTUM_TRANSCEIVER) + .addItem(Tags.Items.DUSTS_REDSTONE, 4) + .addItem(Items.ENDER_EYE) .build() serializer.accept(SHOCKWAVE) @@ -274,11 +313,11 @@ fun addResearchData(serializer: Consumer, lang: MatteryLang add(STEP_ASSIST, "description", "Allows unit to step up whole blocks") add(ITEM_MAGNET, "Item Magnet") - add(ITEM_MAGNET, "description0", "Pulls nearby items to you while active") + add(ITEM_MAGNET, "description0", "Pulls nearby items to unit while active") add(ITEM_MAGNET, "description1", "Drains energy for each item stack it pulls") add(SHOCKWAVE, "Shockwave Pulsator") - add(SHOCKWAVE, "description", "Releases a shockwave around you, damaging everything in small radius, as you quickly land on ground") + add(SHOCKWAVE, "description", "Releases a shockwave around unit, damaging everything in small radius, as unit quickly land on ground") add(attackBoostList[0], "Attack Boost %s") add(attackBoostList[0], "description", "Increases total melee attack strength by %s%%") diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/lang/English.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/lang/English.kt index abd0135b5..7f2eeeca8 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/lang/English.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/lang/English.kt @@ -391,6 +391,7 @@ private fun items(provider: MatteryLanguageProvider) { add(MItems.MACHINE_FRAME, "Machine Frame") add(MItems.TRITANIUM_PLATE, "Tritanium Plate") add(MItems.IRON_PLATE, "Iron Plate") + add(MItems.GOLD_PLATE, "Gold Plate") add(MItems.COPPER_WIRING, "Copper Wiring") add(MItems.GOLD_WIRING, "Gold Wiring") add(MItems.PORTABLE_CONDENSATION_DRIVE_CASING, "Portable Condensation Drive Casing") @@ -458,6 +459,9 @@ private fun research(provider: MatteryLanguageProvider) { add("android_research.status.requires", "Requires %s to be researched") add("android_research.status.blocks", "Locks %s") add("android_research.status.blocked_by", "Locked by %s") + add("android_research.status.requires_item", "Requires %s") + add("android_research.status.requires_item_multiple0", "Requires %s x%s (missing %s)") + add("android_research.status.requires_item_multiple1", "Requires %s x%s") } } diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/tags/Tags.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/tags/Tags.kt index 22c75a964..906ef4d7b 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/tags/Tags.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/tags/Tags.kt @@ -17,6 +17,7 @@ fun addTags(tagsProvider: TagsProvider) { tagsProvider.plates.add("tritanium", MItems.TRITANIUM_PLATE) tagsProvider.plates.add("iron", MItems.IRON_PLATE) + tagsProvider.plates.add("gold", MItems.GOLD_PLATE) tagsProvider.ore("tritanium", MBlocks.TRITANIUM_ORE) tagsProvider.ore("tritanium", MBlocks.DEEPSLATE_TRITANIUM_ORE) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearch.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearch.kt index 27c514a29..dc9a72811 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearch.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearch.kt @@ -10,19 +10,23 @@ import net.minecraft.resources.ResourceLocation import net.minecraft.world.entity.player.Player import net.minecraft.world.item.ItemStack import net.minecraftforge.common.util.INBTSerializable +import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability import ru.dbotthepony.mc.otm.capability.itemsStream import ru.dbotthepony.mc.otm.client.render.SkinElement import ru.dbotthepony.mc.otm.container.iterator +import ru.dbotthepony.mc.otm.core.TextComponent import ru.dbotthepony.mc.otm.core.TranslatableComponent import ru.dbotthepony.mc.otm.core.addAll import ru.dbotthepony.mc.otm.core.getCompoundList import ru.dbotthepony.mc.otm.core.nonEmpty +import ru.dbotthepony.mc.otm.core.registryName import ru.dbotthepony.mc.otm.core.set import ru.dbotthepony.mc.otm.network.FieldSynchronizer import ru.dbotthepony.mc.otm.registry.MRegistry import java.io.DataInputStream import java.io.InputStream +import kotlin.math.absoluteValue class AndroidResearch(val type: AndroidResearchType, val capability: MatteryPlayerCapability) : INBTSerializable { val ply: Player get() = capability.ply @@ -130,12 +134,12 @@ class AndroidResearch(val type: AndroidResearchType, val capability: MatteryPlay } } - for (item in type.items) { - var required = item.count + for ((tag, count) in type.items) { + var required = count val iterator = capability.ply.inventory.iterator().nonEmpty() for (invItem in iterator) { - if (ItemStack.isSameItemSameTags(invItem, item)) { + if (tag.test(invItem)) { val toExtract = required.coerceAtMost(invItem.count) required -= toExtract @@ -176,10 +180,12 @@ class AndroidResearch(val type: AndroidResearchType, val capability: MatteryPlay } for (item in type.items) { - capability.ply.inventory.add(item) + val stack = (item.first.items.firstOrNull { it.item.registryName?.namespace == OverdriveThatMatters.MOD_ID } ?: item.first.items.first()).copy() + stack.count = item.second + capability.ply.inventory.add(stack) - if (!item.isEmpty) { - capability.ply.spawnAtLocation(item) + if (!stack.isEmpty) { + capability.ply.spawnAtLocation(stack) } } @@ -300,32 +306,63 @@ class AndroidResearch(val type: AndroidResearchType, val capability: MatteryPlay if (type.experienceLevels != 0) { builder.add( - TranslatableComponent("otm.android_station.research.xp_cost", type.experienceLevels).withStyle( + TranslatableComponent("otm.android_station.research.xp_cost", TextComponent(type.experienceLevels.toString()).withStyle( if (capability.ply.experienceLevel >= type.experienceLevels) ChatFormatting.DARK_GREEN else ChatFormatting.DARK_RED - )) + )).withStyle(ChatFormatting.GRAY)) } for (value in this.type.flatPrerequisites) { val instance = capability.getResearch(value) builder.add( - TranslatableComponent("android_research.status.requires", instance.screenTooltipHeader).withStyle( + TranslatableComponent("android_research.status.requires", instance.screenTooltipHeader.copy().withStyle( if (instance.isResearched) ChatFormatting.DARK_GREEN else ChatFormatting.DARK_RED - )) + )).withStyle(ChatFormatting.GRAY)) } for (value in this.type.flatBlockedBy) { - builder.add(TranslatableComponent("android_research.status.blocked_by", capability.getResearch(value).screenTooltipHeader).withStyle(ChatFormatting.DARK_RED)) + builder.add(TranslatableComponent("android_research.status.blocked_by", capability.getResearch(value).screenTooltipHeader.copy().withStyle(ChatFormatting.DARK_RED)).withStyle(ChatFormatting.GRAY)) } for (value in this.type.flatBlocking) { - builder.add(TranslatableComponent("android_research.status.blocks", capability.getResearch(value).screenTooltipHeader).withStyle(ChatFormatting.DARK_RED)) + builder.add(TranslatableComponent("android_research.status.blocks", capability.getResearch(value).screenTooltipHeader.copy().withStyle(ChatFormatting.YELLOW)).withStyle(ChatFormatting.GRAY)) + } + + for ((tag, count) in type.items) { + var required = count + val iterator = capability.ply.inventory.iterator().nonEmpty() + + for (invItem in iterator) { + if (tag.test(invItem)) { + required -= required.coerceAtMost(invItem.count) + + if (required <= 0) { + break + } + } + } + + val chooseItem = tag.items[((System.nanoTime() / 300_000_000L).absoluteValue % tag.items.size).toInt()] + + if (required > 0) { + if (count == 1) { + builder.add(TranslatableComponent("android_research.status.requires_item", chooseItem.hoverName.copy().withStyle(ChatFormatting.DARK_RED)).withStyle(ChatFormatting.GRAY)) + } else { + builder.add(TranslatableComponent("android_research.status.requires_item_multiple0", chooseItem.hoverName.copy().withStyle(ChatFormatting.DARK_RED), TextComponent(count.toString()).withStyle(ChatFormatting.YELLOW), TextComponent(required.toString()).withStyle(ChatFormatting.YELLOW)).withStyle(ChatFormatting.GRAY)) + } + } else { + if (count == 1) { + builder.add(TranslatableComponent("android_research.status.requires_item", chooseItem.hoverName.copy().withStyle(ChatFormatting.DARK_GREEN)).withStyle(ChatFormatting.GRAY)) + } else { + builder.add(TranslatableComponent("android_research.status.requires_item_multiple1", chooseItem.hoverName.copy().withStyle(ChatFormatting.DARK_GREEN), TextComponent(count.toString()).withStyle(ChatFormatting.YELLOW)).withStyle(ChatFormatting.GRAY)) + } + } } return builder diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearchType.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearchType.kt index 2e20e8cb7..32703d99f 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearchType.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearchType.kt @@ -13,17 +13,20 @@ import net.minecraft.network.chat.ComponentContents import net.minecraft.network.chat.MutableComponent import net.minecraft.network.chat.contents.TranslatableContents import net.minecraft.resources.ResourceLocation +import net.minecraft.tags.TagKey import net.minecraft.world.item.Item import net.minecraft.world.item.ItemStack import net.minecraft.world.item.Items +import net.minecraft.world.item.crafting.Ingredient +import net.minecraft.world.level.ItemLike import net.minecraftforge.registries.ForgeRegistries import ru.dbotthepony.mc.otm.client.render.SkinElement import ru.dbotthepony.mc.otm.core.ListSet import ru.dbotthepony.mc.otm.core.TranslatableComponent +import ru.dbotthepony.mc.otm.core.isActuallyEmpty import ru.dbotthepony.mc.otm.core.registryName import ru.dbotthepony.mc.otm.core.set import ru.dbotthepony.mc.otm.core.toImmutableList -import ru.dbotthepony.mc.otm.data.ItemStackCodec import ru.dbotthepony.mc.otm.data.stream import ru.dbotthepony.mc.otm.registry.MRegistry import java.util.LinkedList @@ -76,7 +79,7 @@ class AndroidResearchType( prerequisites: Collection, blockedBy: Collection, - items: Collection, + items: Collection>, features: Collection, descriptionLines: Collection, @@ -249,12 +252,9 @@ class AndroidResearchType( null } }) } - private val itemCollection: List = items.stream().filter { !it.isEmpty }.map { it.copy() }.toList().toImmutableList() + private val definedItems: List> = ImmutableList.copyOf(items) - /** - * Stream containing copies of original items in list - */ - val items: Stream get() = itemCollection.stream().map { it.copy() } + val items: Stream> get() = definedItems.stream().filter { !it.first.isActuallyEmpty } private val descriptionLines: List = ImmutableList.copyOf(descriptionLines.map { it.copy() }) @@ -464,7 +464,7 @@ class AndroidResearchType( it["prerequisites"] = JsonArray().also { for (value in prerequisites) it.add(value.toJson()) } it["blocked_by"] = JsonArray().also { for (value in blockedBy) it.add(value.toJson()) } - it["required_items"] = JsonArray().also { for (item in itemCollection) it.add(ItemStackCodec.serialize(item)) } + it["required_items"] = JsonArray().also { for (item in definedItems) it.add(JsonObject().also { it["count"] = JsonPrimitive(item.second); it["ingredient"] = item.first.toJson() }) } it["feature_result"] = JsonArray().also { for (feature in features) it.add(feature.toJson()) } it["description"] = JsonArray().also { for (line in descriptionLines) it.add(Component.Serializer.toJsonTree(line)) } it["description_funcs"] = JsonArray().also { for (line in descriptionSuppliers) it.add(line.toJson()) } @@ -498,7 +498,7 @@ class AndroidResearchType( buff.writeUtf(id.toString()) buff.writeCollection(prerequisites) { a, b -> b.toNetwork(a) } buff.writeCollection(blockedBy) { a, b -> b.toNetwork(a) } - buff.writeCollection(itemCollection) { a, b -> a.writeItem(b) } + buff.writeCollection(definedItems) { a, b -> b.first.toNetwork(a); a.writeVarInt(b.second) } buff.writeCollection(features) { a, b -> b.toNetwork(a) } buff.writeCollection(descriptionLines) { a, b -> a.writeComponent(b) } buff.writeCollection(descriptionSuppliers) { a, b -> b.toNetwork(a) } @@ -522,7 +522,7 @@ class AndroidResearchType( val id = ResourceLocation(buff.readUtf()) val prerequisites = buff.readCollection({ LinkedList() }, Reference::fromNetwork) val blockedBy = buff.readCollection({ LinkedList() }, Reference::fromNetwork) - val items = buff.readCollection({ LinkedList() }, FriendlyByteBuf::readItem) + val items = buff.readCollection({ LinkedList() }, { Ingredient.fromNetwork(it) to it.readVarInt() }) val features = buff.readCollection({ LinkedList() }, FeatureReference::fromNetwork) val descriptionLines = buff.readCollection({ LinkedList() }, FriendlyByteBuf::readComponent) val descriptionSuppliers = buff.readCollection({ LinkedList() }, { AndroidResearchManager.descriptionFuncs.fromNetwork(it) }) @@ -590,7 +590,10 @@ class AndroidResearchType( prerequisites = prerequisites.stream().map { Reference.fromJson(it) }.toList(), blockedBy = blocked_by.stream().map { Reference.fromJson(it) }.toList(), features = features.stream().map { FeatureReference.fromJson(it) }.toList(), - items = items.stream().map { ItemStackCodec.deserialize(it) }.filter { !it.isEmpty }.toList(), + items = items.stream() + .map { it as? JsonObject ?: throw JsonSyntaxException("One of items is not an JsonObject") } + .map { Ingredient.fromJson(it["ingredient"] ?: throw JsonSyntaxException("Missing ingredient key")) to (it["count"]?.asInt ?: throw JsonSyntaxException("Missing count key")) } + .toList(), descriptionLines = description.stream().map { Component.Serializer.fromJson(it) }.toList() as List, descriptionSuppliers = description_funcs.stream().map { AndroidResearchManager.descriptionFuncs.fromJson(it) }.toList() as List, experienceLevels = experience, @@ -613,7 +616,7 @@ class AndroidResearchType( var skinIcon: SkinElement? = null, var iconText: Component? = null, ) { - private val items = ArrayList() + private val items = ArrayList>() private val prerequisites = LinkedList() private val blockers = ArrayList() @@ -802,7 +805,25 @@ class AndroidResearchType( } fun addItem(cost: ItemStack): Builder { - items.add(cost) + require(!cost.isEmpty) { "Provided stack is empty" } + items.add(Ingredient.of(cost) to cost.count) + return this + } + + fun addItem(cost: ItemLike, count: Int = 1): Builder { + items.add(Ingredient.of(cost) to count) + return this + } + + fun addItem(cost: Ingredient, count: Int = 1): Builder { + require(count >= 1) { "Invalid count $count" } + items.add(cost to count) + return this + } + + fun addItem(cost: TagKey, count: Int = 1): Builder { + require(count >= 1) { "Invalid count $count" } + items.add(Ingredient.of(cost) to count) return this } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/core/Ext.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/core/Ext.kt index 089fc6136..731ff77fb 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/core/Ext.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/core/Ext.kt @@ -15,29 +15,20 @@ import net.minecraft.resources.ResourceLocation import net.minecraft.world.entity.Entity import net.minecraft.world.item.Item import net.minecraft.world.item.ItemStack +import net.minecraft.world.item.crafting.Ingredient import net.minecraft.world.level.BlockGetter import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.block.state.StateHolder import net.minecraft.world.level.block.state.properties.Property import net.minecraft.world.phys.Vec3 -import net.minecraftforge.common.ForgeConfigSpec -import net.minecraftforge.common.ForgeConfigSpec.ConfigValue +import net.minecraftforge.common.ForgeHooks import net.minecraftforge.common.util.LazyOptional import net.minecraftforge.items.IItemHandler import net.minecraftforge.registries.ForgeRegistries import net.minecraftforge.registries.ForgeRegistry import net.minecraftforge.registries.IForgeRegistry -import net.minecraftforge.registries.RegistryManager -import ru.dbotthepony.mc.otm.ClientConfig -import ru.dbotthepony.mc.otm.item.BatteryItem import java.math.BigInteger -import java.util.Spliterator import java.util.Spliterators -import java.util.function.BiConsumer -import java.util.function.BinaryOperator -import java.util.function.Function -import java.util.function.Supplier -import java.util.stream.Collector import java.util.stream.Stream import java.util.stream.StreamSupport import kotlin.reflect.KProperty @@ -390,3 +381,5 @@ fun Iterable.stream(): Stream { fun Iterator.stream(): Stream { return StreamSupport.stream(Spliterators.spliteratorUnknownSize(this, 0), false) } + +val Ingredient.isActuallyEmpty: Boolean get() = ForgeHooks.hasNoElements(this) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MItems.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MItems.kt index 8ea20b01b..b95c47eed 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MItems.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MItems.kt @@ -272,6 +272,7 @@ object MItems { val MACHINE_FRAME: Item by registry.register(MNames.MACHINE_FRAME) { Item(DEFAULT_PROPERTIES) } val TRITANIUM_PLATE: Item by registry.register(MNames.TRITANIUM_PLATE) { Item(DEFAULT_PROPERTIES) } val IRON_PLATE: Item by registry.register(MNames.IRON_PLATE) { Item(DEFAULT_PROPERTIES) } + val GOLD_PLATE: Item by registry.register(MNames.GOLD_PLATE) { Item(DEFAULT_PROPERTIES) } val COPPER_WIRING: Item by registry.register(MNames.COPPER_WIRING) { Item(DEFAULT_PROPERTIES) } val GOLD_WIRING: Item by registry.register(MNames.GOLD_WIRING) { Item(DEFAULT_PROPERTIES) } val PORTABLE_CONDENSATION_DRIVE_CASING: Item by registry.register(MNames.PORTABLE_CONDENSATION_DRIVE_CASING) { Item(DEFAULT_PROPERTIES) } @@ -288,6 +289,7 @@ object MItems { { ELECTRIC_PARTS }, { TRITANIUM_PLATE }, { IRON_PLATE }, + { GOLD_PLATE }, { COPPER_WIRING }, { GOLD_WIRING }, { CIRCUIT_PLATING }, diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MNames.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MNames.kt index 2f2b1f964..18a9e08de 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MNames.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MNames.kt @@ -135,6 +135,7 @@ object MNames { const val MACHINE_FRAME = "machine_frame" const val TRITANIUM_PLATE = "tritanium_plate" const val IRON_PLATE = "iron_plate" + const val GOLD_PLATE = "gold_plate" const val COPPER_WIRING = "copper_wiring" const val GOLD_WIRING = "gold_wiring" diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/Tags.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/Tags.kt index bc34bc02f..f77ec235b 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/Tags.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/Tags.kt @@ -10,6 +10,7 @@ object MItemTags { val INGOT_TRITANIUM: TagKey = ItemTags.create(ResourceLocation("forge", "ingots/tritanium")) val PLATE_TRITANIUM: TagKey = ItemTags.create(ResourceLocation("forge", "plates/tritanium")) val PLATE_IRON: TagKey = ItemTags.create(ResourceLocation("forge", "plates/iron")) + val PLATE_GOLD: TagKey = ItemTags.create(ResourceLocation("forge", "plates/gold")) val TRITANIUM_CRATES: TagKey = ItemTags.create(ResourceLocation(OverdriveThatMatters.MOD_ID, "tritanium_crates")) val INDUSTRIAL_GLASS: TagKey = ItemTags.create(ResourceLocation(OverdriveThatMatters.MOD_ID, "industrial_glass")) diff --git a/src/main/resources/assets/overdrive_that_matters/textures/item/component/gold_plate.png b/src/main/resources/assets/overdrive_that_matters/textures/item/component/gold_plate.png new file mode 100644 index 000000000..d36635b4d Binary files /dev/null and b/src/main/resources/assets/overdrive_that_matters/textures/item/component/gold_plate.png differ