Skip to content

Commit

Permalink
Version for 1.21.3
Browse files Browse the repository at this point in the history
  • Loading branch information
mt1006 committed Oct 28, 2024
1 parent 7960b71 commit 1f626b6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
13 changes: 9 additions & 4 deletions common/src/main/java/com/mt1006/irondoorkey/IronDoorKeyItem.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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)
Expand All @@ -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 - " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"category": "equipment",
"key":
{
"#": { "item": "minecraft:iron_nugget" },
"*": { "item": "minecraft:redstone" }
"#": "minecraft:iron_nugget",
"*": "minecraft:redstone"
},
"pattern": [
"# ",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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));
}
}
14 changes: 7 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ 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
# https://modrinth.com/mod/fabric-api/versions?c=release
# 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
Expand Down

0 comments on commit 1f626b6

Please sign in to comment.