From 5ff6cf9a54782a9ce5b44d54e4e6c738578d9920 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=90=E6=82=A6=E8=A7=A3=E8=AF=B4?= Date: Sun, 22 Sep 2024 00:22:26 +0800 Subject: [PATCH] Fixed bug again --- .../ziyue/tjmetro/mapping/MetalDetectionDoorEntity.java | 9 ++++++--- .../main/java/ziyue/tjmetro/mapping/RegistryHelper.java | 4 ++-- .../forge/mixin/AbstractMinecartContainerMixin.java | 2 +- .../ziyue/tjmetro/mapping/MetalDetectionDoorEntity.java | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/fabric/src/main/java/ziyue/tjmetro/mapping/MetalDetectionDoorEntity.java b/fabric/src/main/java/ziyue/tjmetro/mapping/MetalDetectionDoorEntity.java index c64883a..4668a46 100644 --- a/fabric/src/main/java/ziyue/tjmetro/mapping/MetalDetectionDoorEntity.java +++ b/fabric/src/main/java/ziyue/tjmetro/mapping/MetalDetectionDoorEntity.java @@ -8,7 +8,7 @@ * @since 1.0.0-beta-2 */ -#if MC_VERSION >= "11902" +#if MC_VERSION >= "11904" import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; @@ -78,7 +78,6 @@ public Text getDisplayName() { import net.minecraft.screen.ScreenHandler; import net.minecraft.screen.ScreenHandlerType; import net.minecraft.text.Text; -import net.minecraft.text.TranslatableText; import org.mtr.mapping.holder.BlockPos; import org.mtr.mapping.holder.World; import ziyue.tjmetro.mod.block.BlockMetalDetectionDoor; @@ -127,7 +126,11 @@ public int getMaxCountPerStack() { @Override public Text getDisplayName() { - return new TranslatableText("gui.tjmetro.metal_detection_door"); +#if MC_VERSION >= "11902" + return net.minecraft.text.Text.translatable("gui.tjmetro.metal_detection_door"); +#else + return new net.minecraft.text.TranslatableText("gui.tjmetro.metal_detection_door"); +#endif } } diff --git a/fabric/src/main/java/ziyue/tjmetro/mapping/RegistryHelper.java b/fabric/src/main/java/ziyue/tjmetro/mapping/RegistryHelper.java index a35615f..e8b06ac 100644 --- a/fabric/src/main/java/ziyue/tjmetro/mapping/RegistryHelper.java +++ b/fabric/src/main/java/ziyue/tjmetro/mapping/RegistryHelper.java @@ -30,7 +30,7 @@ static ItemStack cloneSingleItemStack(ItemStack itemStack) { } static Identifier getIdentifierByItem(net.minecraft.item.Item item) { -#if MC_VERSION >= "11902" +#if MC_VERSION >= "11904" return new Identifier(net.minecraft.registry.Registries.ITEM.getId(item)); #else return new Identifier(net.minecraft.util.registry.Registry.ITEM.getId(item)); @@ -38,7 +38,7 @@ static Identifier getIdentifierByItem(net.minecraft.item.Item item) { } static ItemStack getItemStackByIdentifier(Identifier identifier) { -#if MC_VERSION >= "11902" +#if MC_VERSION >= "11904" return net.minecraft.registry.Registries.ITEM.get(identifier.data).getDefaultStack(); #else return net.minecraft.util.registry.Registry.ITEM.get(identifier.data).getDefaultStack(); diff --git a/forge/src/main/java/ziyue/tjmetro/forge/mixin/AbstractMinecartContainerMixin.java b/forge/src/main/java/ziyue/tjmetro/forge/mixin/AbstractMinecartContainerMixin.java index 145ce30..20e8ddd 100644 --- a/forge/src/main/java/ziyue/tjmetro/forge/mixin/AbstractMinecartContainerMixin.java +++ b/forge/src/main/java/ziyue/tjmetro/forge/mixin/AbstractMinecartContainerMixin.java @@ -6,7 +6,7 @@ * @since 1.0.0-beta-2 */ -#if MC_VERSION >= "11904" +#if MC_VERSION >= "11902" import net.minecraft.core.NonNullList; import net.minecraft.world.Container; diff --git a/forge/src/main/java/ziyue/tjmetro/mapping/MetalDetectionDoorEntity.java b/forge/src/main/java/ziyue/tjmetro/mapping/MetalDetectionDoorEntity.java index a548c24..a9bb97d 100644 --- a/forge/src/main/java/ziyue/tjmetro/mapping/MetalDetectionDoorEntity.java +++ b/forge/src/main/java/ziyue/tjmetro/mapping/MetalDetectionDoorEntity.java @@ -8,7 +8,7 @@ * @since 1.0.0-beta-2 */ -#if MC_VERSION >= "11904" +#if MC_VERSION >= "11902" import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory;