From 2a117a540e3d528e265f7f52eb97b667d2d391e9 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Mon, 1 Jan 2024 21:07:43 +0700 Subject: [PATCH] More backporting --- .../android/feature/EnderTeleporterFeature.kt | 1 - .../android/feature/FallDampenersFeature.kt | 8 --- .../android/feature/NanobotsArmorFeature.kt | 3 - .../otm/android/feature/ShockwaveFeature.kt | 1 - .../matter/MatterEntanglerBlockEntity.kt | 2 +- .../entity/storage/ItemMonitorBlockEntity.kt | 8 +-- .../entity/tech/PlatePressBlockEntity.kt | 2 +- .../entity/tech/PoweredFurnaceBlockEntity.kt | 2 +- .../energy/BatteryBackedEnergyStorage.kt | 20 +++++- .../mc/otm/client/render/FontRenderer.kt | 10 +-- .../mc/otm/client/render/MGUIGraphics.kt | 6 +- .../MatterReconstructorRenderer.kt | 4 +- .../blockentity/MatterReplicatorRenderer.kt | 3 +- .../blockentity/MatterScannerRenderer.kt | 5 +- .../mc/otm/client/screen/MatteryScreen.kt | 41 +++++++---- .../otm/client/screen/panels/EditablePanel.kt | 22 +----- .../screen/panels/EntityRendererPanel.kt | 9 ++- .../item/armor/SimpleTritaniumArmorItem.kt | 22 +++--- .../mc/otm/item/armor/TritaniumArmorItem.kt | 28 ++++---- .../exopack/AbstractExopackSlotUpgradeItem.kt | 2 - .../mc/otm/item/weapon/AbstractWeaponItem.kt | 4 +- .../mc/otm/matter/ComputeAction.kt | 8 +-- .../ru/dbotthepony/mc/otm/menu/MatteryMenu.kt | 16 +---- .../mc/otm/menu/decorative/PainterMenu.kt | 2 +- .../recipe/ExplosiveHammerPrimingRecipe.kt | 4 +- .../mc/otm/recipe/MatterEntanglerRecipe.kt | 12 ++-- .../mc/otm/recipe/UpgradeRecipe.kt | 12 ++-- .../mc/otm/registry/MCreativeTabs.kt | 4 +- .../mc/otm/registry/MDamageTypes.kt | 32 ++++----- .../ru/dbotthepony/mc/otm/registry/MItems.kt | 17 ++--- .../ru/dbotthepony/mc/otm/registry/MMenus.kt | 68 +++++++++---------- .../dbotthepony/mc/otm/registry/MRegistry.kt | 12 +--- .../mc/otm/triggers/MCriterionTrigger.kt | 6 +- .../resources/META-INF/accesstransformer.cfg | 2 +- 34 files changed, 183 insertions(+), 215 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/EnderTeleporterFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/EnderTeleporterFeature.kt index 624247c79..6fb7cd0b6 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/EnderTeleporterFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/EnderTeleporterFeature.kt @@ -37,7 +37,6 @@ import ru.dbotthepony.mc.otm.client.render.sprites.sprite import ru.dbotthepony.mc.otm.config.AndroidConfig import ru.dbotthepony.mc.otm.core.genericPositions import ru.dbotthepony.mc.otm.core.holder -import ru.dbotthepony.mc.otm.core.isFall import ru.dbotthepony.mc.otm.core.math.RGBAColor import ru.dbotthepony.mc.otm.core.math.Vector import ru.dbotthepony.mc.otm.core.math.asVector diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/FallDampenersFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/FallDampenersFeature.kt index 4b1b75900..ea63587bb 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/FallDampenersFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/FallDampenersFeature.kt @@ -1,20 +1,12 @@ package ru.dbotthepony.mc.otm.android.feature -import net.minecraft.ChatFormatting -import net.minecraft.resources.ResourceLocation import net.minecraft.server.level.ServerPlayer import net.minecraftforge.event.entity.living.LivingAttackEvent import net.minecraftforge.event.entity.living.LivingHurtEvent -import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.android.AndroidFeature -import ru.dbotthepony.mc.otm.android.AndroidResearchManager import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability import ru.dbotthepony.mc.otm.config.AndroidConfig -import ru.dbotthepony.mc.otm.core.TextComponent -import ru.dbotthepony.mc.otm.core.TranslatableComponent -import ru.dbotthepony.mc.otm.core.isFall import ru.dbotthepony.mc.otm.registry.AndroidFeatures -import ru.dbotthepony.mc.otm.registry.MNames import ru.dbotthepony.mc.otm.triggers.FallDampenersSaveTrigger class FallDampenersFeature(capability: MatteryPlayerCapability) : AndroidFeature(AndroidFeatures.FALL_DAMPENERS, capability) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NanobotsArmorFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NanobotsArmorFeature.kt index 8dc1f81db..66a16c3ce 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NanobotsArmorFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NanobotsArmorFeature.kt @@ -4,12 +4,9 @@ import net.minecraft.nbt.CompoundTag import net.minecraft.resources.ResourceLocation import net.minecraft.server.level.ServerPlayer import net.minecraftforge.event.entity.living.LivingHurtEvent -import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.android.AndroidFeature -import ru.dbotthepony.mc.otm.android.AndroidResearchManager import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact -import ru.dbotthepony.mc.otm.core.isBypassArmor import ru.dbotthepony.mc.otm.core.math.Decimal import ru.dbotthepony.mc.otm.registry.AndroidFeatures import ru.dbotthepony.mc.otm.registry.StatNames diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ShockwaveFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ShockwaveFeature.kt index 26979d8e9..a95c85975 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ShockwaveFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ShockwaveFeature.kt @@ -14,7 +14,6 @@ import ru.dbotthepony.mc.otm.capability.matteryPlayer import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.ResearchIcons import ru.dbotthepony.mc.otm.config.AndroidConfig -import ru.dbotthepony.mc.otm.core.damageType import ru.dbotthepony.mc.otm.core.getEntitiesInEllipsoid import ru.dbotthepony.mc.otm.core.getExplosionResistance import ru.dbotthepony.mc.otm.core.math.RGBAColor diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterEntanglerBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterEntanglerBlockEntity.kt index 18b389486..59130c1e3 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterEntanglerBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterEntanglerBlockEntity.kt @@ -151,7 +151,7 @@ class MatterEntanglerBlockEntity(blockPos: BlockPos, blockState: BlockState) : M .values .firstOrNull { it.value.matches(inputs, level!!) } ?: return JobContainer.noItem() - val result = recipe.value.assemble(inputs, level!!.registryAccess()) + val result = recipe.value.assemble(inputs) inputs.forEach { it.shrink(1) } inputs.setChanged() diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/ItemMonitorBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/ItemMonitorBlockEntity.kt index d42d9f0fe..062e42e86 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/ItemMonitorBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/ItemMonitorBlockEntity.kt @@ -292,7 +292,7 @@ class ItemMonitorBlockEntity(blockPos: BlockPos, blockState: BlockState) : Matte override fun getItem(slot: Int): ItemStack { require(slot == 0) { "Invalid slot: $slot" } - return craftingRecipe?.getResultItem(level?.registryAccess() ?: return ItemStack.EMPTY)?.copy() ?: ItemStack.EMPTY + return craftingRecipe?.resultItem?.copy() ?: ItemStack.EMPTY } override fun removeItem(index: Int, amount: Int): ItemStack { @@ -305,7 +305,7 @@ class ItemMonitorBlockEntity(blockPos: BlockPos, blockState: BlockState) : Matte try { ForgeHooks.setCraftingPlayer(craftingPlayer) - if (craftingRecipe.getResultItem(level.registryAccess()).count != amount) { + if (craftingRecipe.resultItem.count != amount) { return ItemStack.EMPTY } } finally { @@ -331,7 +331,7 @@ class ItemMonitorBlockEntity(blockPos: BlockPos, blockState: BlockState) : Matte try { residue = craftingRecipe.getRemainingItems(craftingGrid) - result = craftingRecipe.getResultItem(level.registryAccess()) + result = craftingRecipe.resultItem } finally { ForgeHooks.setCraftingPlayer(null) } @@ -398,7 +398,7 @@ class ItemMonitorBlockEntity(blockPos: BlockPos, blockState: BlockState) : Matte } override fun setItem(p_18944_: Int, p_18945_: ItemStack) { - if ((craftingRecipe != null && !craftingRecipe!!.let { it.getResultItem(level?.registryAccess() ?: return@let ItemStack.EMPTY) }.isEmpty) || !p_18945_.isEmpty) { + if ((craftingRecipe != null && !craftingRecipe!!.resultItem.isEmpty) || !p_18945_.isEmpty) { throw RuntimeException("BUG-DETECT: Tried to set crafting result slot item to something, and either we have crafting recipe which have valid result, or we are trying to set slot to non empty item: $p_18945_") } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/PlatePressBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/PlatePressBlockEntity.kt index 2789cdf25..2ba1f2a45 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/PlatePressBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/PlatePressBlockEntity.kt @@ -93,7 +93,7 @@ class PlatePressBlockEntity( return JobContainer.success( ItemJob( - recipe.getResultItem(level.registryAccess()).copyWithCount(toProcess), + recipe.getResultItem().copyWithCount(toProcess), recipe.workTime * MachinesConfig.PLATE_PRESS.workTimeMultiplier, MachinesConfig.PLATE_PRESS.energyConsumption * toProcess, experience = recipe.experience.sample(level.random) * toProcess)) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/PoweredFurnaceBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/PoweredFurnaceBlockEntity.kt index f9975f87d..f24900862 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/PoweredFurnaceBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/PoweredFurnaceBlockEntity.kt @@ -136,7 +136,7 @@ class PoweredFurnaceBlockEntity( } return level.recipeManager.getRecipeFor(recipeType as RecipeType, inputs[id], level).map { - val output = it.value.assemble(inputs[id], level.registryAccess()) + val output = it.value.assemble(inputs[id]) val toProcess = inputs[id][0].count.coerceAtMost(upgrades.processingItems + 1) inputs[id][0].shrink(toProcess) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/energy/BatteryBackedEnergyStorage.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/energy/BatteryBackedEnergyStorage.kt index a39770a12..38281241a 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/energy/BatteryBackedEnergyStorage.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/energy/BatteryBackedEnergyStorage.kt @@ -4,12 +4,12 @@ import net.minecraft.nbt.CompoundTag import net.minecraft.server.level.ServerPlayer import net.minecraft.world.entity.player.Player import net.minecraft.world.item.ItemStack -import net.minecraft.world.ticks.ContainerSingleItem import net.minecraftforge.common.capabilities.ForgeCapabilities import net.minecraftforge.common.util.INBTSerializable import ru.dbotthepony.mc.otm.capability.FlowDirection import ru.dbotthepony.mc.otm.capability.extractEnergy import ru.dbotthepony.mc.otm.capability.receiveEnergy +import ru.dbotthepony.mc.otm.container.IContainer import ru.dbotthepony.mc.otm.core.math.Decimal import ru.dbotthepony.mc.otm.core.math.getDecimal import ru.dbotthepony.mc.otm.core.nbt.getItemStack @@ -27,7 +27,7 @@ class BatteryBackedEnergyStorage( maxCharge: Decimal, val isAndroid: Boolean, val onChange: Runnable? = null -) : IMatteryEnergyStorage, INBTSerializable, ContainerSingleItem { +) : IMatteryEnergyStorage, INBTSerializable, IContainer { override val energyFlow: FlowDirection get() = FlowDirection.INPUT @@ -61,6 +61,22 @@ class BatteryBackedEnergyStorage( item = stack } + override fun clearContent() { + item = ItemStack.EMPTY + } + + override fun getContainerSize(): Int { + return 1 + } + + override fun isEmpty(): Boolean { + return item.isEmpty + } + + override fun removeItemNoUpdate(slot: Int): ItemStack { + TODO("Not yet implemented") + } + override fun setChanged() { } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/FontRenderer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/FontRenderer.kt index cf9383d38..edcd8de6f 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/FontRenderer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/FontRenderer.kt @@ -17,7 +17,7 @@ private fun buffer() = buffer private fun Font.drawInBatch( text: Any, x: Float, y: Float, color: Int, drawShadow: Boolean, - matrix4f: Matrix4f, buffer: MultiBufferSource, displayMode: Font.DisplayMode, + matrix4f: Matrix4f, buffer: MultiBufferSource, displayMode: Boolean, effectColor: Int, packedLightCoords: Int, gravity: RenderGravity, rounding: GravityRounding, width: FloatSupplier ): Int { @@ -120,7 +120,7 @@ private fun Font.drawInternal( scale: Float, color: RGBAColor, drawShadow: Boolean, - displayMode: Font.DisplayMode, + displayMode: Boolean, packedLightCoords: Int, effectColor: Int, shadowColor: RGBAColor, @@ -239,7 +239,7 @@ fun Font.draw( scale: Float = 1f, color: RGBAColor = RGBAColor.WHITE, drawShadow: Boolean = false, - displayMode: Font.DisplayMode = Font.DisplayMode.NORMAL, + displayMode: Boolean = false, packedLightCoords: Int = 15728880, effectColor: Int = 0, shadowColor: RGBAColor = RGBAColor.BLACK, @@ -287,7 +287,7 @@ fun Font.draw( scale: Float = 1f, color: RGBAColor = RGBAColor.WHITE, drawShadow: Boolean = false, - displayMode: Font.DisplayMode = Font.DisplayMode.NORMAL, + displayMode: Boolean = false, packedLightCoords: Int = 15728880, effectColor: Int = 0, shadowColor: RGBAColor = RGBAColor.BLACK, @@ -335,7 +335,7 @@ fun Font.draw( scale: Float = 1f, color: RGBAColor = RGBAColor.WHITE, drawShadow: Boolean = false, - displayMode: Font.DisplayMode = Font.DisplayMode.NORMAL, + displayMode: Boolean = false, packedLightCoords: Int = 15728880, effectColor: Int = 0, shadowColor: RGBAColor = RGBAColor.BLACK, diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/MGUIGraphics.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/MGUIGraphics.kt index dfa97516c..d92ec4d20 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/MGUIGraphics.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/MGUIGraphics.kt @@ -35,7 +35,7 @@ class MGUIGraphics(val pose: PoseStack) { } fun renderFakeItem(itemStack: ItemStack, x: Int, y: Int) { - minecraft.itemRenderer.renderGuiItem(pose, itemStack, x, y) + minecraft.itemRenderer.renderGuiItem(itemStack, x, y) } fun drawLine( @@ -130,7 +130,9 @@ class MGUIGraphics(val pose: PoseStack) { for (i in mapped.indices) { val line = mapped[i] - line.renderImage(preEvent.font, x, yCurrent, pose, minecraft.itemRenderer) + line.renderImage(preEvent.font, x, yCurrent, pose, minecraft.itemRenderer, 0 /* blit offset, i love you, go commit self-murder */) + /* because your existence servers ZERO FUCKING PURPOSE */ + /* Z-BUFFER IN MY GUI PIECE OF SHIT */ yCurrent += line.height + if (i == 0) 2 else 0 } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/MatterReconstructorRenderer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/MatterReconstructorRenderer.kt index 1d252f645..df2c300b3 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/MatterReconstructorRenderer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/MatterReconstructorRenderer.kt @@ -3,9 +3,9 @@ package ru.dbotthepony.mc.otm.client.render.blockentity import com.mojang.blaze3d.vertex.PoseStack import com.mojang.math.Axis import net.minecraft.client.renderer.MultiBufferSource +import net.minecraft.client.renderer.block.model.ItemTransforms import net.minecraft.client.renderer.blockentity.BlockEntityRenderer import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider -import net.minecraft.world.item.ItemDisplayContext import ru.dbotthepony.mc.otm.block.entity.matter.MatterReconstructorBlockEntity import ru.dbotthepony.mc.otm.client.render.DynamicBufferSource @@ -32,7 +32,7 @@ class MatterReconstructorRenderer(private val context: BlockEntityRendererProvid pose.mulPose(Axis.XP.rotationDegrees(90f)) pose.mulPose(Axis.ZP.rotationDegrees(tile.blockRotation.back.toYRot())) - context.itemRenderer.renderStatic(item, ItemDisplayContext.FIXED, packedLight, packedOverlay, pose, DynamicBufferSource.WORLD, tile.level, tile.blockPos.asLong().toInt()) + context.itemRenderer.renderStatic(item, ItemTransforms.TransformType.FIXED, packedLight, packedOverlay, pose, DynamicBufferSource.WORLD, tile.blockPos.asLong().toInt()) pose.popPose() } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/MatterReplicatorRenderer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/MatterReplicatorRenderer.kt index 2f4a080ce..73bc49d0d 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/MatterReplicatorRenderer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/MatterReplicatorRenderer.kt @@ -9,7 +9,6 @@ import net.minecraft.client.renderer.block.model.ItemTransforms import net.minecraft.client.renderer.blockentity.BlockEntityRenderer import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider import net.minecraft.core.particles.DustParticleOptions -import net.minecraft.world.item.ItemDisplayContext import net.minecraft.world.level.levelgen.XoroshiroRandomSource import org.joml.Vector3f import org.lwjgl.opengl.GL14.glBlendColor @@ -80,7 +79,7 @@ class MatterReplicatorRenderer(private val context: BlockEntityRendererProvider. context.itemRenderer.render( item, - ItemDisplayContext.NONE, + ItemTransforms.TransformType.NONE, false, pose, source, diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/MatterScannerRenderer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/MatterScannerRenderer.kt index adf55b8b1..f61b83232 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/MatterScannerRenderer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/MatterScannerRenderer.kt @@ -5,9 +5,9 @@ import com.mojang.blaze3d.systems.RenderSystem import com.mojang.blaze3d.vertex.PoseStack import com.mojang.math.Axis import net.minecraft.client.renderer.MultiBufferSource +import net.minecraft.client.renderer.block.model.ItemTransforms import net.minecraft.client.renderer.blockentity.BlockEntityRenderer import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider -import net.minecraft.world.item.ItemDisplayContext import ru.dbotthepony.mc.otm.block.entity.matter.MatterScannerBlockEntity import ru.dbotthepony.mc.otm.client.render.DynamicBufferSource import ru.dbotthepony.mc.otm.client.render.lockBlendFunc @@ -41,12 +41,11 @@ class MatterScannerRenderer(private val context: BlockEntityRendererProvider.Con context.itemRenderer.renderStatic( item, - ItemDisplayContext.FIXED, + ItemTransforms.TransformType.FIXED, packedLight, packedOverlay, pose, source, - tile.level, tile.blockPos.asLong().toInt() ) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/MatteryScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/MatteryScreen.kt index d3fbe4daa..252a9a062 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/MatteryScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/MatteryScreen.kt @@ -12,7 +12,6 @@ import net.minecraft.network.chat.Component import net.minecraft.world.entity.player.Inventory import net.minecraft.world.inventory.Slot import net.minecraft.world.item.Item -import net.minecraft.world.item.ItemDisplayContext import net.minecraft.world.item.ItemStack import net.minecraftforge.client.event.ContainerScreenEvent.Render.Background import net.minecraftforge.client.event.ContainerScreenEvent.Render.Foreground @@ -23,7 +22,6 @@ import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.moveMousePosScaled import ru.dbotthepony.mc.otm.client.render.WidgetLocation import ru.dbotthepony.mc.otm.client.render.Widgets18 -import ru.dbotthepony.mc.otm.client.render.translation import ru.dbotthepony.mc.otm.client.screen.panels.* import ru.dbotthepony.mc.otm.client.screen.panels.button.DeviceControls import ru.dbotthepony.mc.otm.client.screen.panels.slot.AbstractSlotPanel @@ -46,8 +44,6 @@ import ru.dbotthepony.mc.otm.client.screen.widget.WidePowerGaugePanel import ru.dbotthepony.mc.otm.client.screen.widget.WideProfiledPowerGaugePanel import ru.dbotthepony.mc.otm.config.ClientConfig import ru.dbotthepony.mc.otm.core.TranslatableComponent -import ru.dbotthepony.mc.otm.core.math.component1 -import ru.dbotthepony.mc.otm.core.math.component2 import ru.dbotthepony.mc.otm.core.math.integerDivisionDown import ru.dbotthepony.mc.otm.menu.MatteryMenu import ru.dbotthepony.mc.otm.menu.MatterySlot @@ -89,20 +85,37 @@ abstract class MatteryScreen(menu: T, inventory: Inventory, tit val quickCraftingType: Int get() = super.quickCraftingType val isQuickCrafting: Boolean get() = super.isQuickCrafting - fun renderItemStack(graphics: MGUIGraphics, itemstack: ItemStack, countOverride: String? = null) { + fun renderItemStack(absoluteX: Float, absoluteY: Float, itemstack: ItemStack, countOverride: String? = null) { if (!itemstack.isEmpty) { RenderSystem.enableDepthTest() - itemRenderer.renderGuiItem(graphics.pose, itemstack, 1, 1) - RenderSystem.depthFunc(GL11.GL_ALWAYS) - itemRenderer.renderGuiItemDecorations( - graphics.pose, - super.font, + val systemPoseStack = RenderSystem.getModelViewStack() + + systemPoseStack.pushPose() + systemPoseStack.translate(absoluteX + 1f, absoluteY + 1f, 0f) + RenderSystem.applyModelViewMatrix() + RenderSystem.depthFunc(GL11.GL_LESS) + + // Thanks Mojang + // Very cool + // (for int x, int y, which are then cast into doubles anyway) + itemRenderer.blitOffset = 1f // Z pos + + itemRenderer.renderAndDecorateItem( + requireNotNull(ru.dbotthepony.mc.otm.client.minecraft.player) { "yo, dude, what the fuck" }, itemstack, - 1, - 1, - countOverride + 0, + 0, + (absoluteX + absoluteY * 1000f).toInt() ) + + RenderSystem.depthFunc(GL11.GL_ALWAYS) + itemRenderer.renderGuiItemDecorations(super.font, itemstack, 0, 0, countOverride) + itemRenderer.blitOffset = 0f + + // too big accumulations can lead to Z near clipping issues + systemPoseStack.popPose() + RenderSystem.applyModelViewMatrix() } } @@ -695,7 +708,7 @@ abstract class MatteryScreen(menu: T, inventory: Inventory, tit } @Suppress("NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS") - renderFloatingItem(poseStack, itemstack, mouseX - 8, mouseY - i2, overrideCount) + renderFloatingItem(itemstack, mouseX - 8, mouseY - i2, overrideCount) } if (menu.carried.isEmpty) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EditablePanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EditablePanel.kt index 0746b9b0e..96719477e 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EditablePanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EditablePanel.kt @@ -5,11 +5,8 @@ import com.mojang.blaze3d.platform.InputConstants import com.mojang.blaze3d.systems.RenderSystem import it.unimi.dsi.fastutil.ints.IntAVLTreeSet import it.unimi.dsi.fastutil.objects.ReferenceArraySet -import net.minecraft.client.gui.ComponentPath import net.minecraft.client.gui.Font import net.minecraft.client.gui.components.events.GuiEventListener -import net.minecraft.client.gui.navigation.FocusNavigationEvent -import net.minecraft.client.gui.navigation.ScreenRectangle import net.minecraft.client.gui.screens.Screen import net.minecraft.client.renderer.Rect2i import net.minecraft.network.chat.Component @@ -78,17 +75,15 @@ open class EditablePanel @JvmOverloads constructor( ) : Comparable> { // layout engine does not support navigation using keyboard val listener: GuiEventListener = object : GuiEventListener { - override fun setFocused(p_265728_: Boolean) { + override fun changeFocus(p_265728_: Boolean): Boolean { if (p_265728_) { if (isVisible()) requestFocus() } else { killFocus() } - } - override fun isFocused(): Boolean { - return isEverFocused() + return true } override fun mouseMoved(p_94758_: Double, p_94759_: Double) { @@ -123,22 +118,9 @@ open class EditablePanel @JvmOverloads constructor( return this@EditablePanel.charTyped(p_94732_, p_94733_) } - override fun nextFocusPath(p_265234_: FocusNavigationEvent): ComponentPath? { - return null - } - override fun isMouseOver(p_94748_: Double, p_94749_: Double): Boolean { return this@EditablePanel.isMouseOver(p_94748_, p_94749_) } - - override fun getCurrentFocusPath(): ComponentPath? { - return null - } - - override fun getRectangle(): ScreenRectangle { - val rect = calculateAbsoluteRectangle() - return ScreenRectangle(rect.x.toInt(), rect.y.toInt(), rect.width.toInt(), rect.height.toInt()) - } } /** diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EntityRendererPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EntityRendererPanel.kt index 3dc6017e0..f8d193e91 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EntityRendererPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EntityRendererPanel.kt @@ -170,15 +170,14 @@ class EntityRendererPanel @JvmOverloads constructor( return } - val renderX = width.toInt() / 2 - val renderY = (height * 0.9f).toInt() + val renderX = absoluteX.toInt() + width.toInt() / 2 + val renderY = absoluteY.toInt() + (height * 0.9f).toInt() - InventoryScreen.renderEntityInInventoryFollowsMouse( - graphics.pose, + InventoryScreen.renderEntityInInventory( renderX, renderY, renderScale, - absoluteX.toInt() + renderX - mouseX, + renderX - mouseX, absoluteY + height * 0.15f - mouseY, entity ) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/armor/SimpleTritaniumArmorItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/armor/SimpleTritaniumArmorItem.kt index 4441e7237..892d74340 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/armor/SimpleTritaniumArmorItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/armor/SimpleTritaniumArmorItem.kt @@ -12,22 +12,22 @@ import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.registry.MItemTags private object SimpleTritaniumArmorMaterial : ArmorMaterial { - override fun getDurabilityForType(p_40410_: ArmorItem.Type): Int { + override fun getDurabilityForSlot(p_40410_: EquipmentSlot): Int { return when (p_40410_) { - ArmorItem.Type.HELMET -> 380 - ArmorItem.Type.CHESTPLATE -> 590 - ArmorItem.Type.LEGGINGS -> 500 - ArmorItem.Type.BOOTS -> 420 + EquipmentSlot.HEAD -> 380 + EquipmentSlot.CHEST -> 590 + EquipmentSlot.LEGS -> 500 + EquipmentSlot.FEET -> 420 else -> throw IllegalArgumentException("yo dude what the fuck $p_40410_") } } - override fun getDefenseForType(p_40411_: ArmorItem.Type): Int { + override fun getDefenseForSlot(p_40411_: EquipmentSlot): Int { return when (p_40411_) { - ArmorItem.Type.HELMET -> 2 - ArmorItem.Type.CHESTPLATE -> 6 - ArmorItem.Type.LEGGINGS -> 7 - ArmorItem.Type.BOOTS -> 2 + EquipmentSlot.HEAD -> 2 + EquipmentSlot.CHEST -> 6 + EquipmentSlot.LEGS -> 7 + EquipmentSlot.FEET -> 2 else -> throw IllegalArgumentException("yo dude what the fuck $p_40411_") } } @@ -43,7 +43,7 @@ private object SimpleTritaniumArmorMaterial : ArmorMaterial { override fun getKnockbackResistance() = 0f } -class SimpleTritaniumArmorItem(slot: Type) : ArmorItem(SimpleTritaniumArmorMaterial, slot, Properties().stacksTo(1)) { +class SimpleTritaniumArmorItem(slot: EquipmentSlot) : ArmorItem(SimpleTritaniumArmorMaterial, slot, Properties().stacksTo(1)) { override fun getArmorTexture(stack: ItemStack, entity: Entity?, slot: EquipmentSlot, type: String?): String? { if (type != "overlay" || slot == EquipmentSlot.FEET) return when (slot) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/armor/TritaniumArmorItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/armor/TritaniumArmorItem.kt index 2a1f8a588..0abbd1be4 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/armor/TritaniumArmorItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/armor/TritaniumArmorItem.kt @@ -3,7 +3,7 @@ package ru.dbotthepony.mc.otm.item.armor import net.minecraft.client.model.HumanoidModel import net.minecraft.sounds.SoundEvent import net.minecraft.sounds.SoundEvents -import net.minecraft.world.damagesource.DamageTypes +import net.minecraft.world.damagesource.DamageSource import net.minecraft.world.entity.Entity import net.minecraft.world.entity.EquipmentSlot import net.minecraft.world.entity.LivingEntity @@ -19,21 +19,23 @@ import ru.dbotthepony.mc.otm.registry.MItems import java.util.function.Consumer private object TritaniumArmorMaterial : ArmorMaterial { - override fun getDurabilityForType(p_40410_: ArmorItem.Type): Int { + override fun getDurabilityForSlot(p_40410_: EquipmentSlot): Int { return when (p_40410_) { - ArmorItem.Type.HELMET -> 520 - ArmorItem.Type.CHESTPLATE -> 920 - ArmorItem.Type.LEGGINGS -> 650 - ArmorItem.Type.BOOTS -> 540 + EquipmentSlot.HEAD -> 520 + EquipmentSlot.CHEST -> 920 + EquipmentSlot.LEGS -> 650 + EquipmentSlot.FEET -> 540 + else -> throw IllegalArgumentException(p_40410_.toString()) } } - override fun getDefenseForType(p_40411_: ArmorItem.Type): Int { + override fun getDefenseForSlot(p_40411_: EquipmentSlot): Int { return when (p_40411_) { - ArmorItem.Type.HELMET -> 4 - ArmorItem.Type.CHESTPLATE -> 9 - ArmorItem.Type.LEGGINGS -> 7 - ArmorItem.Type.BOOTS -> 3 + EquipmentSlot.HEAD -> 4 + EquipmentSlot.CHEST -> 9 + EquipmentSlot.LEGS -> 7 + EquipmentSlot.FEET -> 3 + else -> throw IllegalArgumentException(p_40411_.toString()) } } @@ -63,7 +65,7 @@ private object TritaniumArmorRenderProperties : IClientItemExtensions { } } -class TritaniumArmorItem(slot: Type) : DyeableArmorItem(TritaniumArmorMaterial, slot, Properties().stacksTo(1).rarity(Rarity.RARE)) { +class TritaniumArmorItem(slot: EquipmentSlot) : DyeableArmorItem(TritaniumArmorMaterial, slot, Properties().stacksTo(1).rarity(Rarity.RARE)) { override fun initializeClient(consumer: Consumer) { super.initializeClient(consumer) consumer.accept(TritaniumArmorRenderProperties) @@ -87,7 +89,7 @@ class TritaniumArmorItem(slot: Type) : DyeableArmorItem(TritaniumArmorMaterial, const val TEXTURE_LOCATION_OVERLAY = "${OverdriveThatMatters.MOD_ID}:textures/models/armor/tritanium_armor_overlay.png" fun onHurt(event: LivingAttackEvent) { - if (event.source.typeHolder().`is`(DamageTypes.SWEET_BERRY_BUSH) || event.source.msgId == "sweetBerryBush") { + if (event.source == DamageSource.SWEET_BERRY_BUSH || event.source.msgId == "sweetBerryBush") { if ( event.entity.getItemBySlot(EquipmentSlot.FEET).let { !it.isEmpty && it.item == MItems.TRITANIUM_BOOTS } && event.entity.getItemBySlot(EquipmentSlot.LEGS).let { !it.isEmpty && it.item == MItems.TRITANIUM_PANTS } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/exopack/AbstractExopackSlotUpgradeItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/exopack/AbstractExopackSlotUpgradeItem.kt index d99790504..ba3213c5c 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/exopack/AbstractExopackSlotUpgradeItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/exopack/AbstractExopackSlotUpgradeItem.kt @@ -18,8 +18,6 @@ import ru.dbotthepony.mc.otm.config.ServerConfig import ru.dbotthepony.mc.otm.capability.matteryPlayer import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.core.TranslatableComponent -import ru.dbotthepony.mc.otm.core.isExplosion -import ru.dbotthepony.mc.otm.core.isFire import ru.dbotthepony.mc.otm.registry.MItems import ru.dbotthepony.mc.otm.runIfClient import ru.dbotthepony.mc.otm.triggers.ExopackSlotsExpandedTrigger diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/weapon/AbstractWeaponItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/weapon/AbstractWeaponItem.kt index 5c8a81d7d..964402223 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/weapon/AbstractWeaponItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/weapon/AbstractWeaponItem.kt @@ -3,13 +3,13 @@ package ru.dbotthepony.mc.otm.item.weapon import com.mojang.blaze3d.systems.RenderSystem import net.minecraft.client.Minecraft import net.minecraft.client.model.HumanoidModel +import net.minecraft.client.renderer.block.model.ItemTransforms import net.minecraft.nbt.CompoundTag import net.minecraft.network.FriendlyByteBuf import net.minecraft.server.level.ServerPlayer import net.minecraft.world.entity.Entity import net.minecraft.world.entity.player.Player import net.minecraft.world.item.Item -import net.minecraft.world.item.ItemDisplayContext import net.minecraft.world.item.ItemStack import net.minecraft.world.item.Rarity import net.minecraft.world.level.block.state.BlockState @@ -429,7 +429,7 @@ abstract class AbstractWeaponItem(val tables: KClass, pr itemInHandRenderer.renderItem( player, stack, - ItemDisplayContext.FIRST_PERSON_RIGHT_HAND, + ItemTransforms.TransformType.FIRST_PERSON_RIGHT_HAND, false, pose, event.multiBufferSource, diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/matter/ComputeAction.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/matter/ComputeAction.kt index 50449c5dd..5de261641 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/matter/ComputeAction.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/matter/ComputeAction.kt @@ -112,10 +112,10 @@ class ComputeAction( try { DataResult.success(Pair(Constant(Decimal(it.substring(1).trim()), it.substring(1).trim().toDouble(), fn, fn), ops.empty())) } catch (err: NumberFormatException) { - DataResult.error { "Not a number: ${it.substring(1).trim()} (input string: $it)" } + DataResult.error("Not a number: ${it.substring(1).trim()} (input string: $it)") } } else { - DataResult.error { "Input string does not match expected operand: expected $symbol, got ${it[0]} (for input $it)" } + DataResult.error("Input string does not match expected operand: expected $symbol, got ${it[0]} (for input $it)") } } } @@ -135,7 +135,7 @@ class ComputeAction( try { DataResult.success(Pair(Constant(Decimal(it.toString()), it.toDouble(), IMatterFunction.PLUS, IMatterFunction.PLUS), ops.empty())) } catch (err: NumberFormatException) { - DataResult.error { "Not a number: $it" } + DataResult.error("Not a number: $it") } } @@ -146,7 +146,7 @@ class ComputeAction( try { DataResult.success(Pair(Constant(Decimal(it), it.toDouble(), IMatterFunction.PLUS, IMatterFunction.PLUS), ops.empty())) } catch (err: NumberFormatException) { - DataResult.error { "Not a number: $it" } + DataResult.error("Not a number: $it") } } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MatteryMenu.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MatteryMenu.kt index 73709213c..ac48cb38a 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MatteryMenu.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MatteryMenu.kt @@ -297,12 +297,6 @@ abstract class MatteryMenu( open inner class EquipmentSlot(container: Container, index: Int, val type: net.minecraft.world.entity.EquipmentSlot) : InventorySlot(container, index) { constructor(type: net.minecraft.world.entity.EquipmentSlot) : this(inventory, 34 + type.ordinal, type) - override fun setByPlayer(newItem: ItemStack) { - val oldItem = item - inventory.player.onEquipItem(type, oldItem, newItem) - super.setByPlayer(newItem) - } - override fun mayPlace(itemStack: ItemStack): Boolean { return super.mayPlace(itemStack) && itemStack.canEquip(type, inventory.player) } @@ -327,12 +321,6 @@ abstract class MatteryMenu( autoCreateInventoryFrame = autoFrame offhandSlot = object : InventorySlot(inventory, 40) { - override fun setByPlayer(newItem: ItemStack) { - val oldItem = this.item - inventory.player.onEquipItem(net.minecraft.world.entity.EquipmentSlot.OFFHAND, oldItem, newItem) - super.setByPlayer(newItem) - } - override fun getNoItemIcon(): Pair { return Pair.of(InventoryMenu.BLOCK_ATLAS, InventoryMenu.EMPTY_ARMOR_SLOT_SHIELD) } @@ -602,7 +590,7 @@ abstract class MatteryMenu( val copy = source.item.copy() if (remainder.isEmpty) { - source.setByPlayer(ItemStack.EMPTY) + source.set(ItemStack.EMPTY) source.onTake(player, copy) } else { copy.count = source.item.count - remainder.count @@ -662,7 +650,7 @@ abstract class MatteryMenu( val newCount = copy.count.coerceAtMost(limit) if (!simulate) { - slot.setByPlayer(copy.copy().also { it.count = newCount }) + slot.set(copy.copy().also { it.count = newCount }) slot.setChanged() } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/decorative/PainterMenu.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/decorative/PainterMenu.kt index 6aeed61ad..d61b81d0b 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/decorative/PainterMenu.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/decorative/PainterMenu.kt @@ -141,7 +141,7 @@ class PainterMenu( if (recipe == null || !recipe.value.canCraft(dyeStoredDirect) || !recipe.value.matches(inputContainer, inventory.player.level)) { outputContainer.clearContent() } else { - outputContainer[0] = recipe.value.assemble(inputContainer, inventory.player.level.registryAccess()) + outputContainer[0] = recipe.value.assemble(inputContainer) lastRecipe = recipe } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/recipe/ExplosiveHammerPrimingRecipe.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/recipe/ExplosiveHammerPrimingRecipe.kt index b713fb6b0..dbd47c23e 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/recipe/ExplosiveHammerPrimingRecipe.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/recipe/ExplosiveHammerPrimingRecipe.kt @@ -40,7 +40,7 @@ class ExplosiveHammerPrimingRecipe(val payload: Ingredient, private val id: Reso result.any { payload.test(it) } } - override fun assemble(pContainer: CraftingContainer, registry: RegistryAccess): ItemStack { + override fun assemble(pContainer: CraftingContainer): ItemStack { val hammer = pContainer.stream().filter { it.isNotEmpty && it.item is ExplosiveHammerItem }.findAny() if (hammer.isEmpty) return ItemStack.EMPTY @@ -53,7 +53,7 @@ class ExplosiveHammerPrimingRecipe(val payload: Ingredient, private val id: Reso return pWidth * pHeight >= 3 } - override fun getResultItem(registry: RegistryAccess): ItemStack { + override fun getResultItem(): ItemStack { return ItemStack.EMPTY } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/recipe/MatterEntanglerRecipe.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/recipe/MatterEntanglerRecipe.kt index aa0633bbd..1bd928749 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/recipe/MatterEntanglerRecipe.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/recipe/MatterEntanglerRecipe.kt @@ -65,7 +65,7 @@ open class MatterEntanglerRecipe( return ingredients.preemptiveTest(container) } - override fun assemble(container: CraftingContainer, registry: RegistryAccess): ItemStack { + override fun assemble(container: CraftingContainer): ItemStack { return result.copy().also { it.tagNotNull[uuidKey] = fixedUuid.getOrElse { UUID.randomUUID() } } @@ -75,7 +75,7 @@ open class MatterEntanglerRecipe( return width >= ingredients.width && height >= ingredients.height } - override fun getResultItem(registry: RegistryAccess): ItemStack { + override fun getResultItem(): ItemStack { return result } @@ -111,8 +111,8 @@ open class MatterEntanglerRecipe( fun matter() = Matter(this) open class Energy(val parent: MatterEntanglerRecipe) : IMatterEntanglerRecipe by parent { - override fun assemble(container: CraftingContainer, registry: RegistryAccess): ItemStack { - return parent.assemble(container, registry).also { result -> + override fun assemble(container: CraftingContainer): ItemStack { + return parent.assemble(container).also { result -> container.iterator().map { it.matteryEnergy }.filterNotNull().forEach { result.matteryEnergy!!.batteryLevel += it.batteryLevel } @@ -129,8 +129,8 @@ open class MatterEntanglerRecipe( } open class Matter(val parent: MatterEntanglerRecipe) : IMatterEntanglerRecipe by parent { - override fun assemble(container: CraftingContainer, registry: RegistryAccess): ItemStack { - return parent.assemble(container, registry).also { result -> + override fun assemble(container: CraftingContainer): ItemStack { + return parent.assemble(container).also { result -> container.iterator().map { it.matter }.filterNotNull().forEach { result.matter!!.storedMatter += it.storedMatter } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/recipe/UpgradeRecipe.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/recipe/UpgradeRecipe.kt index a946509eb..01eb1200a 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/recipe/UpgradeRecipe.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/recipe/UpgradeRecipe.kt @@ -42,8 +42,8 @@ class UpgradeRecipe( return parent.recipe.canCraftInDimensions(p_43999_, p_44000_) } - override fun getResultItem(p_267052_: RegistryAccess): ItemStack { - return parent.recipe.getResultItem(p_267052_) + override fun getResultItem(): ItemStack { + return parent.recipe.resultItem } override fun getRemainingItems(p_44004_: CraftingContainer): NonNullList { @@ -58,10 +58,6 @@ class UpgradeRecipe( return parent.recipe.isSpecial } - override fun showNotification(): Boolean { - return parent.recipe.showNotification() - } - override fun getGroup(): String { return parent.recipe.group } @@ -184,8 +180,8 @@ class UpgradeRecipe( val copyPaths: ImmutableList = copyPaths.collect(ImmutableList.toImmutableList()) - override fun assemble(pInv: CraftingContainer, registryAccess: RegistryAccess): ItemStack { - val result = parent.recipe.assemble(pInv, registryAccess) + override fun assemble(pInv: CraftingContainer): ItemStack { + val result = parent.recipe.assemble(pInv) if (result.isEmpty) { return result diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MCreativeTabs.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MCreativeTabs.kt index 118ae68ca..e73002ea4 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MCreativeTabs.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MCreativeTabs.kt @@ -280,7 +280,7 @@ object MCreativeTabs { it.icon { ItemStack(BATTERY_CREATIVE, 1) } it.title(TranslatableComponent("itemGroup.otm")) - it.displayItems { _, consumer -> + it.displayItems { _, consumer, hasPerms -> addMainCreativeTabItems(consumer) } } @@ -289,7 +289,7 @@ object MCreativeTabs { it.icon { ItemStack(MRegistry.VENT.item, 1) } it.title(TranslatableComponent("itemGroup.otm_decorative")) - it.displayItems { _, consumer -> + it.displayItems { _, consumer, hasPerms -> addDecorativeTabItems(consumer) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MDamageTypes.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MDamageTypes.kt index a1af1bade..65a92be76 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MDamageTypes.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MDamageTypes.kt @@ -1,24 +1,18 @@ package ru.dbotthepony.mc.otm.registry -import net.minecraft.core.registries.Registries -import net.minecraft.resources.ResourceKey -import net.minecraft.resources.ResourceLocation -import net.minecraft.world.damagesource.DamageType -import ru.dbotthepony.mc.otm.OverdriveThatMatters +import net.minecraft.world.damagesource.DamageSource object MDamageTypes { - private fun register(name: String): ResourceKey = ResourceKey.create(Registries.DAMAGE_TYPE, ResourceLocation(OverdriveThatMatters.MOD_ID, name)) - - val BECOME_ANDROID = register("become_android") - val BECOME_HUMANE = register("become_humane") - val EVENT_HORIZON = register("event_horizon") - val HAWKING_RADIATION = register("hawking_radiation") - val EXOPACK_PROBE = register("exopack_probe") - val EMP = register("emp") - val SHOCKWAVE = register("shockwave") - val PLASMA = register("plasma") - val COSMIC_RAYS = register("cosmic_rays") - val EXPLOSIVE_HAMMER = register("explosive_hammer") - val HAMMER_NAIL = register("hammer_nail") - val ANDROID_DISCHARGE = register("android_discharge") + val BECOME_ANDROID = DamageSource("become_android") + val BECOME_HUMANE = DamageSource("become_humane") + val EVENT_HORIZON = DamageSource("event_horizon") + val HAWKING_RADIATION = DamageSource("hawking_radiation") + val EXOPACK_PROBE = DamageSource("exopack_probe") + val EMP = DamageSource("emp") + val SHOCKWAVE = DamageSource("shockwave") + val PLASMA = DamageSource("plasma") + val COSMIC_RAYS = DamageSource("cosmic_rays") + val EXPLOSIVE_HAMMER = DamageSource("explosive_hammer") + val HAMMER_NAIL = DamageSource("hammer_nail") + val ANDROID_DISCHARGE = DamageSource("android_discharge") } 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 0d3611aaa..bc94ff668 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MItems.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MItems.kt @@ -4,6 +4,7 @@ package ru.dbotthepony.mc.otm.registry import net.minecraft.ChatFormatting import net.minecraft.network.chat.Component import net.minecraft.resources.ResourceLocation +import net.minecraft.world.entity.EquipmentSlot import net.minecraft.world.food.FoodProperties import net.minecraft.world.item.* import net.minecraft.world.item.crafting.Ingredient @@ -341,15 +342,15 @@ object MItems { ::TRITANIUM_SHEARS, ) - val TRITANIUM_HELMET: TritaniumArmorItem by registry.register(MNames.TRITANIUM_HELMET) { TritaniumArmorItem(ArmorItem.Type.HELMET) } - val TRITANIUM_CHESTPLATE: TritaniumArmorItem by registry.register(MNames.TRITANIUM_CHESTPLATE) { TritaniumArmorItem(ArmorItem.Type.CHESTPLATE) } - val TRITANIUM_PANTS: TritaniumArmorItem by registry.register(MNames.TRITANIUM_PANTS) { TritaniumArmorItem(ArmorItem.Type.LEGGINGS) } - val TRITANIUM_BOOTS: TritaniumArmorItem by registry.register(MNames.TRITANIUM_BOOTS) { TritaniumArmorItem(ArmorItem.Type.BOOTS) } + val TRITANIUM_HELMET: TritaniumArmorItem by registry.register(MNames.TRITANIUM_HELMET) { TritaniumArmorItem(EquipmentSlot.HEAD) } + val TRITANIUM_CHESTPLATE: TritaniumArmorItem by registry.register(MNames.TRITANIUM_CHESTPLATE) { TritaniumArmorItem(EquipmentSlot.CHEST) } + val TRITANIUM_PANTS: TritaniumArmorItem by registry.register(MNames.TRITANIUM_PANTS) { TritaniumArmorItem(EquipmentSlot.LEGS) } + val TRITANIUM_BOOTS: TritaniumArmorItem by registry.register(MNames.TRITANIUM_BOOTS) { TritaniumArmorItem(EquipmentSlot.FEET) } - val SIMPLE_TRITANIUM_HELMET: SimpleTritaniumArmorItem by registry.register(MNames.SIMPLE_TRITANIUM_HELMET) { SimpleTritaniumArmorItem(ArmorItem.Type.HELMET) } - val SIMPLE_TRITANIUM_CHESTPLATE: SimpleTritaniumArmorItem by registry.register(MNames.SIMPLE_TRITANIUM_CHESTPLATE) { SimpleTritaniumArmorItem(ArmorItem.Type.CHESTPLATE) } - val SIMPLE_TRITANIUM_PANTS: SimpleTritaniumArmorItem by registry.register(MNames.SIMPLE_TRITANIUM_PANTS) { SimpleTritaniumArmorItem(ArmorItem.Type.LEGGINGS) } - val SIMPLE_TRITANIUM_BOOTS: SimpleTritaniumArmorItem by registry.register(MNames.SIMPLE_TRITANIUM_BOOTS) { SimpleTritaniumArmorItem(ArmorItem.Type.BOOTS) } + val SIMPLE_TRITANIUM_HELMET: SimpleTritaniumArmorItem by registry.register(MNames.SIMPLE_TRITANIUM_HELMET) { SimpleTritaniumArmorItem(EquipmentSlot.HEAD) } + val SIMPLE_TRITANIUM_CHESTPLATE: SimpleTritaniumArmorItem by registry.register(MNames.SIMPLE_TRITANIUM_CHESTPLATE) { SimpleTritaniumArmorItem(EquipmentSlot.CHEST) } + val SIMPLE_TRITANIUM_PANTS: SimpleTritaniumArmorItem by registry.register(MNames.SIMPLE_TRITANIUM_PANTS) { SimpleTritaniumArmorItem(EquipmentSlot.LEGS) } + val SIMPLE_TRITANIUM_BOOTS: SimpleTritaniumArmorItem by registry.register(MNames.SIMPLE_TRITANIUM_BOOTS) { SimpleTritaniumArmorItem(EquipmentSlot.FEET) } val TRITANIUM_ARMOR = SupplierList( ::TRITANIUM_HELMET, diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MMenus.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MMenus.kt index 25f1c43ab..e308ef926 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MMenus.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MMenus.kt @@ -77,41 +77,41 @@ import ru.dbotthepony.mc.otm.menu.tech.TwinPlatePressMenu object MMenus { private val registry = DeferredRegister.create(ForgeRegistries.MENU_TYPES, OverdriveThatMatters.MOD_ID) - val ANDROID_STATION: MenuType by registry.register(MNames.ANDROID_STATION) { MenuType(::AndroidStationMenu, FeatureFlags.VANILLA_SET) } - val ANDROID_CHARGER: MenuType by registry.register(MNames.ANDROID_CHARGER) { MenuType({ a, b -> AndroidChargerMenu(a, b, null as AndroidChargerBlockEntity?) }, FeatureFlags.VANILLA_SET) } - val BATTERY_BANK: MenuType by registry.register(MNames.BATTERY_BANK) { MenuType(::BatteryBankMenu, FeatureFlags.VANILLA_SET) } - val MATTER_DECOMPOSER: MenuType by registry.register(MNames.MATTER_DECOMPOSER) { MenuType(::MatterDecomposerMenu, FeatureFlags.VANILLA_SET) } - val MATTER_CAPACITOR_BANK: MenuType by registry.register(MNames.MATTER_CAPACITOR_BANK) { MenuType(::MatterCapacitorBankMenu, FeatureFlags.VANILLA_SET) } - val PATTERN_STORAGE: MenuType by registry.register(MNames.PATTERN_STORAGE) { MenuType(::PatternStorageMenu, FeatureFlags.VANILLA_SET) } - val MATTER_SCANNER: MenuType by registry.register(MNames.MATTER_SCANNER) { MenuType(::MatterScannerMenu, FeatureFlags.VANILLA_SET) } - val MATTER_PANEL: MenuType by registry.register(MNames.MATTER_PANEL) { MenuType(::MatterPanelMenu, FeatureFlags.VANILLA_SET) } - val MATTER_REPLICATOR: MenuType by registry.register(MNames.MATTER_REPLICATOR) { MenuType(::MatterReplicatorMenu, FeatureFlags.VANILLA_SET) } - val MATTER_BOTTLER: MenuType by registry.register(MNames.MATTER_BOTTLER) { MenuType(::MatterBottlerMenu, FeatureFlags.VANILLA_SET) } - val DRIVE_VIEWER: MenuType by registry.register(MNames.DRIVE_VIEWER) { MenuType(::DriveViewerMenu, FeatureFlags.VANILLA_SET) } - val CARGO_CRATE: MenuType by registry.register(MNames.CARGO_CRATE) { MenuType(::CargoCrateMenu, FeatureFlags.VANILLA_SET) } - val MINECART_CARGO_CRATE: MenuType by registry.register(MNames.MINECART_CARGO_CRATE) { MenuType(::MinecartCargoCrateMenu, FeatureFlags.VANILLA_SET) } - val DRIVE_RACK: MenuType by registry.register(MNames.DRIVE_RACK) { MenuType(::DriveRackMenu, FeatureFlags.VANILLA_SET) } - val ITEM_MONITOR: MenuType by registry.register(MNames.ITEM_MONITOR) { MenuType(::ItemMonitorMenu, FeatureFlags.VANILLA_SET) } - val ENERGY_COUNTER: MenuType by registry.register(MNames.ENERGY_COUNTER) { MenuType(::EnergyCounterMenu, FeatureFlags.VANILLA_SET) } - val CHEMICAL_GENERATOR: MenuType by registry.register(MNames.CHEMICAL_GENERATOR) { MenuType(::ChemicalGeneratorMenu, FeatureFlags.VANILLA_SET) } - val PLATE_PRESS: MenuType by registry.register(MNames.PLATE_PRESS) { MenuType(::PlatePressMenu, FeatureFlags.VANILLA_SET) } - val POWERED_FURNACE: MenuType by registry.register(MNames.POWERED_FURNACE) { MenuType(PoweredFurnaceMenu::furnace, FeatureFlags.VANILLA_SET) } - val POWERED_BLAST_FURNACE: MenuType by registry.register(MNames.POWERED_BLAST_FURNACE) { MenuType(PoweredFurnaceMenu::blasting, FeatureFlags.VANILLA_SET) } - val POWERED_SMOKER: MenuType by registry.register(MNames.POWERED_SMOKER) { MenuType(PoweredFurnaceMenu::smoking, FeatureFlags.VANILLA_SET) } - val TWIN_PLATE_PRESS: MenuType by registry.register(MNames.TWIN_PLATE_PRESS) { MenuType(::TwinPlatePressMenu, FeatureFlags.VANILLA_SET) } - val MATTER_RECYCLER: MenuType by registry.register(MNames.MATTER_RECYCLER) { MenuType(::MatterRecyclerMenu, FeatureFlags.VANILLA_SET) } - val ENERGY_SERVO: MenuType by registry.register(MNames.ENERGY_SERVO) { MenuType(::EnergyServoMenu, FeatureFlags.VANILLA_SET) } - val HOLO_SIGN: MenuType by registry.register(MNames.HOLO_SIGN) { MenuType(::HoloSignMenu, FeatureFlags.VANILLA_SET) } - val COBBLESTONE_GENERATOR: MenuType by registry.register(MNames.COBBLESTONE_GENERATOR) { MenuType(::CobblerMenu, FeatureFlags.VANILLA_SET) } - val ESSENCE_STORAGE: MenuType by registry.register(MNames.ESSENCE_STORAGE) { MenuType(::EssenceStorageMenu, FeatureFlags.VANILLA_SET) } - val ITEM_REPAIER: MenuType by registry.register(MNames.MATTER_RECONSTRUCTOR) { MenuType(::MatterReconstructorMenu, FeatureFlags.VANILLA_SET) } - val FLUID_TANK: MenuType by registry.register(MNames.FLUID_TANK) { MenuType(::FluidTankMenu, FeatureFlags.VANILLA_SET) } - val PAINTER: MenuType by registry.register(MNames.PAINTER) { MenuType(::PainterMenu, FeatureFlags.VANILLA_SET) } - val MATTER_ENTANGLER: MenuType by registry.register(MNames.MATTER_ENTANGLER) { MenuType(::MatterEntanglerMenu, FeatureFlags.VANILLA_SET) } + val ANDROID_STATION: MenuType by registry.register(MNames.ANDROID_STATION) { MenuType(::AndroidStationMenu) } + val ANDROID_CHARGER: MenuType by registry.register(MNames.ANDROID_CHARGER) { MenuType({ a, b -> AndroidChargerMenu(a, b, null as AndroidChargerBlockEntity?) }) } + val BATTERY_BANK: MenuType by registry.register(MNames.BATTERY_BANK) { MenuType(::BatteryBankMenu) } + val MATTER_DECOMPOSER: MenuType by registry.register(MNames.MATTER_DECOMPOSER) { MenuType(::MatterDecomposerMenu) } + val MATTER_CAPACITOR_BANK: MenuType by registry.register(MNames.MATTER_CAPACITOR_BANK) { MenuType(::MatterCapacitorBankMenu) } + val PATTERN_STORAGE: MenuType by registry.register(MNames.PATTERN_STORAGE) { MenuType(::PatternStorageMenu) } + val MATTER_SCANNER: MenuType by registry.register(MNames.MATTER_SCANNER) { MenuType(::MatterScannerMenu) } + val MATTER_PANEL: MenuType by registry.register(MNames.MATTER_PANEL) { MenuType(::MatterPanelMenu) } + val MATTER_REPLICATOR: MenuType by registry.register(MNames.MATTER_REPLICATOR) { MenuType(::MatterReplicatorMenu) } + val MATTER_BOTTLER: MenuType by registry.register(MNames.MATTER_BOTTLER) { MenuType(::MatterBottlerMenu) } + val DRIVE_VIEWER: MenuType by registry.register(MNames.DRIVE_VIEWER) { MenuType(::DriveViewerMenu) } + val CARGO_CRATE: MenuType by registry.register(MNames.CARGO_CRATE) { MenuType(::CargoCrateMenu) } + val MINECART_CARGO_CRATE: MenuType by registry.register(MNames.MINECART_CARGO_CRATE) { MenuType(::MinecartCargoCrateMenu) } + val DRIVE_RACK: MenuType by registry.register(MNames.DRIVE_RACK) { MenuType(::DriveRackMenu) } + val ITEM_MONITOR: MenuType by registry.register(MNames.ITEM_MONITOR) { MenuType(::ItemMonitorMenu) } + val ENERGY_COUNTER: MenuType by registry.register(MNames.ENERGY_COUNTER) { MenuType(::EnergyCounterMenu) } + val CHEMICAL_GENERATOR: MenuType by registry.register(MNames.CHEMICAL_GENERATOR) { MenuType(::ChemicalGeneratorMenu) } + val PLATE_PRESS: MenuType by registry.register(MNames.PLATE_PRESS) { MenuType(::PlatePressMenu) } + val POWERED_FURNACE: MenuType by registry.register(MNames.POWERED_FURNACE) { MenuType(PoweredFurnaceMenu::furnace) } + val POWERED_BLAST_FURNACE: MenuType by registry.register(MNames.POWERED_BLAST_FURNACE) { MenuType(PoweredFurnaceMenu::blasting) } + val POWERED_SMOKER: MenuType by registry.register(MNames.POWERED_SMOKER) { MenuType(PoweredFurnaceMenu::smoking) } + val TWIN_PLATE_PRESS: MenuType by registry.register(MNames.TWIN_PLATE_PRESS) { MenuType(::TwinPlatePressMenu) } + val MATTER_RECYCLER: MenuType by registry.register(MNames.MATTER_RECYCLER) { MenuType(::MatterRecyclerMenu) } + val ENERGY_SERVO: MenuType by registry.register(MNames.ENERGY_SERVO) { MenuType(::EnergyServoMenu) } + val HOLO_SIGN: MenuType by registry.register(MNames.HOLO_SIGN) { MenuType(::HoloSignMenu) } + val COBBLESTONE_GENERATOR: MenuType by registry.register(MNames.COBBLESTONE_GENERATOR) { MenuType(::CobblerMenu) } + val ESSENCE_STORAGE: MenuType by registry.register(MNames.ESSENCE_STORAGE) { MenuType(::EssenceStorageMenu) } + val ITEM_REPAIER: MenuType by registry.register(MNames.MATTER_RECONSTRUCTOR) { MenuType(::MatterReconstructorMenu) } + val FLUID_TANK: MenuType by registry.register(MNames.FLUID_TANK) { MenuType(::FluidTankMenu) } + val PAINTER: MenuType by registry.register(MNames.PAINTER) { MenuType(::PainterMenu) } + val MATTER_ENTANGLER: MenuType by registry.register(MNames.MATTER_ENTANGLER) { MenuType(::MatterEntanglerMenu) } - val STORAGE_BUS: MenuType by registry.register(MNames.STORAGE_BUS) { MenuType(::StorageBusMenu, FeatureFlags.VANILLA_SET) } - val STORAGE_IMPORTER_EXPORTER: MenuType by registry.register(MNames.STORAGE_IMPORTER) { MenuType(::StorageImporterExporterMenu, FeatureFlags.VANILLA_SET) } - val STORAGE_POWER_SUPPLIER: MenuType by registry.register(MNames.STORAGE_POWER_SUPPLIER) { MenuType(::StoragePowerSupplierMenu, FeatureFlags.VANILLA_SET) } + val STORAGE_BUS: MenuType by registry.register(MNames.STORAGE_BUS) { MenuType(::StorageBusMenu) } + val STORAGE_IMPORTER_EXPORTER: MenuType by registry.register(MNames.STORAGE_IMPORTER) { MenuType(::StorageImporterExporterMenu) } + val STORAGE_POWER_SUPPLIER: MenuType by registry.register(MNames.STORAGE_POWER_SUPPLIER) { MenuType(::StoragePowerSupplierMenu) } internal fun register(bus: IEventBus) { registry.register(bus) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MRegistry.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MRegistry.kt index d164e3bd2..931960ee0 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MRegistry.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MRegistry.kt @@ -364,16 +364,8 @@ object MRegistry { } private fun registerItemDecorators(event: RegisterItemDecorationsEvent) { - event.register(Items.SHIELD, object : IItemDecorator { - override fun render(poseStack: PoseStack, font: Font, stack: ItemStack, xOffset: Int, yOffset: Int): Boolean { - return MatteryGUI.renderShieldCooldownOverlay(poseStack, font, stack, xOffset, yOffset) - } - }) + event.register(Items.SHIELD) { font, stack, xOffset, yOffset, blitOffset -> MatteryGUI.renderShieldCooldownOverlay(PoseStack(), font, stack, xOffset, yOffset) } - event.register(MItems.TRITANIUM_SHIELD, object : IItemDecorator { - override fun render(poseStack: PoseStack, font: Font, stack: ItemStack, xOffset: Int, yOffset: Int): Boolean { - return MatteryGUI.renderShieldCooldownOverlay(poseStack, font, stack, xOffset, yOffset) - } - }) + event.register(MItems.TRITANIUM_SHIELD) { font, stack, xOffset, yOffset, blitOffset -> MatteryGUI.renderShieldCooldownOverlay(PoseStack(), font, stack, xOffset, yOffset) } } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/triggers/MCriterionTrigger.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/triggers/MCriterionTrigger.kt index dbbc1bb97..2d5bdee45 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/triggers/MCriterionTrigger.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/triggers/MCriterionTrigger.kt @@ -106,16 +106,16 @@ abstract class MCriterionTrigger.AbstractInstance>(priv @JvmStatic protected val predicateCodec: Codec = object : Codec { override fun encode(input: ContextAwarePredicate, ops: DynamicOps, prefix: T): DataResult { - return DataResult.success(JsonOps.INSTANCE.convertTo(ops, input.toJson(serializationContext.get().lastOrNull() ?: return DataResult.error { "Not serializing trigger instance" }))) + return DataResult.success(JsonOps.INSTANCE.convertTo(ops, input.toJson(serializationContext.get().lastOrNull() ?: return DataResult.error("Not serializing trigger instance")))) } override fun decode(ops: DynamicOps, input: T): DataResult> { - val context = deserializationContext.get().lastOrNull() ?: return DataResult.error { "Not current deserializing trigger instance" } + val context = deserializationContext.get().lastOrNull() ?: return DataResult.error("Not current deserializing trigger instance") return try { DataResult.success(Pair.of(EntityPredicate.Composite.fromJson(JsonObject().also { it["a"] = ops.convertTo(JsonOps.INSTANCE, input) }, "a", context), ops.empty())) } catch (err: Exception) { - DataResult.error { "Failed to deserialize ContextAwarePredicate: " + err.message } + DataResult.error("Failed to deserialize ContextAwarePredicate: " + err.message) } } } diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index d00eefc3f..bea3566fc 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -31,7 +31,7 @@ public net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_9772 public net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97722_ # lastClickButton public net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97723_ # doubleclick public net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97724_ # lastQuickMoved -public net.minecraft.client.gui.screens.inventory.AbstractContainerScreen m_274323_(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/world/item/ItemStack;IILjava/lang/String;)V # renderFloatingItem +public net.minecraft.client.gui.screens.inventory.AbstractContainerScreen m_97782_(Lnet/minecraft/world/item/ItemStack;IILjava/lang/String;)V # renderFloatingItem public net.minecraft.client.gui.GuiComponent m_168740_(Lcom/mojang/blaze3d/vertex/PoseStack;IIIIIII)V # fillGradient public net.minecraft.client.gui.GuiComponent m_93123_(Lorg/joml/Matrix4f;Lcom/mojang/blaze3d/vertex/BufferBuilder;IIIIIII)V # fillGradient