diff --git a/common/src/main/java/com/mt1006/irondoorkey/IronDoorKeyItem.java b/common/src/main/java/com/mt1006/irondoorkey/IronDoorKeyItem.java index e0a4454..0ddc346 100644 --- a/common/src/main/java/com/mt1006/irondoorkey/IronDoorKeyItem.java +++ b/common/src/main/java/com/mt1006/irondoorkey/IronDoorKeyItem.java @@ -1,6 +1,9 @@ package com.mt1006.irondoorkey; import net.minecraft.core.BlockPos; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundSource; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; @@ -24,12 +27,14 @@ public class IronDoorKeyItem extends Item { + public static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath(IronDoorKeyCommon.MOD_ID, "iron_door_key"); + private static boolean fenceGateSoundUsed = false; private static @Nullable Field fenceGateTypeField = null; public IronDoorKeyItem() { - super(new Item.Properties()); + super(new Item.Properties().setId(ResourceKey.create(Registries.ITEM, ID))); } @Override public @NotNull InteractionResult useOn(@NotNull UseOnContext ctx) @@ -45,18 +50,18 @@ public IronDoorKeyItem() { DoorBlock doorBlock = (DoorBlock)blockType; doorBlock.setOpen(ctx.getPlayer(), level, blockState, blockPos, !doorBlock.isOpen(blockState)); - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } else if (blockType instanceof TrapDoorBlock) { openTrapDoor(ctx.getPlayer(), level, blockPos, blockState); - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } else if (blockType instanceof FenceGateBlock) { // redundant in vanilla, added for better mod support, e.g. with SecurityCraft openFenceGate(ctx.getPlayer(), level, blockPos, blockState, (FenceGateBlock)blockType); - return InteractionResult.sidedSuccess(level.isClientSide); + return InteractionResult.SUCCESS; } IronDoorKeyCommon.LOGGER.warn("Failed to open the block - " + diff --git a/common/src/main/resources/data/irondoorkey/recipe/iron_door_key.json b/common/src/main/resources/data/irondoorkey/recipe/iron_door_key.json index b3c95c3..5891ac6 100644 --- a/common/src/main/resources/data/irondoorkey/recipe/iron_door_key.json +++ b/common/src/main/resources/data/irondoorkey/recipe/iron_door_key.json @@ -3,8 +3,8 @@ "category": "equipment", "key": { - "#": { "item": "minecraft:iron_nugget" }, - "*": { "item": "minecraft:redstone" } + "#": "minecraft:iron_nugget", + "*": "minecraft:redstone" }, "pattern": [ "# ", diff --git a/fabric/src/main/java/com/mt1006/irondoorkey/IronDoorKeyMod.java b/fabric/src/main/java/com/mt1006/irondoorkey/IronDoorKeyMod.java index fd67d05..763bbc1 100644 --- a/fabric/src/main/java/com/mt1006/irondoorkey/IronDoorKeyMod.java +++ b/fabric/src/main/java/com/mt1006/irondoorkey/IronDoorKeyMod.java @@ -4,7 +4,6 @@ import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; import net.minecraft.core.Registry; import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.CreativeModeTabs; import net.minecraft.world.item.Item; @@ -14,7 +13,7 @@ public class IronDoorKeyMod implements ModInitializer @Override public void onInitialize() { - Registry.register(BuiltInRegistries.ITEM, ResourceLocation.fromNamespaceAndPath(IronDoorKeyCommon.MOD_ID, "iron_door_key"), ITEM_IRON_DOOR_KEY); + Registry.register(BuiltInRegistries.ITEM, IronDoorKeyItem.ID, ITEM_IRON_DOOR_KEY); ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.TOOLS_AND_UTILITIES).register((content) -> content.accept(ITEM_IRON_DOOR_KEY)); } } diff --git a/gradle.properties b/gradle.properties index 21c0ebe..bcca18c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,13 +12,13 @@ issue_tracker=https://github.com/mt1006/mc-irondoorkey-mod/issues mod_description=Adds iron door key. It can be used to open iron doors and trapdoors. # Minecraft and Java -minecraft_version=1.21.1 +minecraft_version=1.21.3 java_version=21 # Requires -version_range_fabric=>=1.21 <1.21.2 -version_range_forge=[1.21.1,1.21.2) -version_range_neoforge=[1.21,1.21.2) +version_range_fabric=>=1.21.2 +version_range_forge=[1.21.2,) +version_range_neoforge=[1.21.2,) # Loaders # https://github.com/FabricMC/fabric-loader/releases @@ -26,9 +26,9 @@ version_range_neoforge=[1.21,1.21.2) # https://files.minecraftforge.net/net/minecraftforge/forge/ # https://projects.neoforged.net/neoforged/neoforge fabric_loader_version=0.16.8 -fabric_api_version=0.107.0+1.21.1 -forge_version=52.0.24 -neoforge_version=21.1.73 +fabric_api_version=0.107.0+1.21.3 +forge_version=53.0.5 +neoforge_version=21.3.4-beta # Mappings # https://parchmentmc.org/docs/getting-started