diff --git a/README.md b/README.md index 7ea47de..2eee9cf 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ configured for them.) Simply invoke `./gradlew build` in the mod directory and after some time the finished jar will be saved at -`build/libs/TurnBasedMinecraft-NeoForge-1.26.2-all.jar` +`build/libs/TurnBasedMinecraft-NeoForge-1.26.3-all.jar` # Reproducibility diff --git a/gradle.properties b/gradle.properties index 897435a..f00184a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,17 +13,17 @@ parchment_mappings_version=2024.07.28 # Environment Properties # You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge # The Minecraft version must agree with the Neo version to get a valid artifact -minecraft_version=1.21.1 +minecraft_version=1.21.3 # The Minecraft version range can use any release version of Minecraft as bounds. # Snapshots, pre-releases, and release candidates are not guaranteed to sort properly # as they do not follow standard versioning conventions. -minecraft_version_range=[1.21.1, 1.22) +minecraft_version_range=[1.21.3, 1.22) # The Neo version must agree with the Minecraft version to get a valid artifact -neo_version=21.1.72 +neo_version=21.3.2-beta # The Neo version range can use any version of Neo as bounds -neo_version_range=[21.1.0,) +neo_version_range=[21.3.0,) # The loader version range can only use the major version of FML as bounds loader_version_range=[4,) @@ -37,7 +37,7 @@ mod_name=TurnBasedMinecraftMod # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. mod_license=MIT # The mod version. See https://semver.org/ -mod_version=1.26.2 +mod_version=1.26.3 # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # This should match the base package used for the mod sources. # See https://maven.apache.org/guides/mini/guide-naming-conventions.html diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/ClientProxy.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/ClientProxy.java index 2023666..eafb820 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/ClientProxy.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/ClientProxy.java @@ -168,7 +168,7 @@ public class ClientProxy extends CommonProxy { parentComponent.getSiblings().add(prefix); parentComponent.getSiblings().add(text); // UUID is required by sendMessage, but appears to be unused, so just give dummy UUID - Minecraft.getInstance().player.sendSystemMessage(parentComponent); + Minecraft.getInstance().player.displayClientMessage(parentComponent, false); } @Override @@ -181,7 +181,7 @@ public class ClientProxy extends CommonProxy { parentComponent.getSiblings().add(prefix); parentComponent.getSiblings().add(text); // UUID is required by sendMessage, but appears to be unused, so just give dummy UUID - Minecraft.getInstance().player.sendSystemMessage(parentComponent); + Minecraft.getInstance().player.displayClientMessage(parentComponent, false); } private void checkBattleTypes(boolean entityLeft) { diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/Battle.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/Battle.java index b7dff97..3bd43eb 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/Battle.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/Battle.java @@ -6,6 +6,7 @@ import com.burnedkirby.TurnBasedMinecraft.common.networking.PacketBattlePing; import net.minecraft.resources.ResourceKey; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.Entity; @@ -1134,7 +1135,13 @@ public class Battle { final int nextItemToUse = next.itemToUse; final int prevItem = ((Player)nextEntity).getInventory().selected; ((Player)nextEntity).getInventory().selected = nextItemToUse; - ((Player)nextEntity).getInventory().setItem(nextItemToUse, targetItem.use(nextEntity.level(), (Player)nextEntity, InteractionHand.MAIN_HAND).getObject()); + InteractionResult interactionResult = targetItem.use(nextEntity.level(), (Player)nextEntity, InteractionHand.MAIN_HAND); + if (interactionResult instanceof InteractionResult.Success resultSuccess) { + ItemStack transformed = resultSuccess.heldItemTransformedTo(); + if (transformed != null) { + ((Player) nextEntity).getInventory().setItem(nextItemToUse, transformed); + } + } ((Player)nextEntity).getInventory().selected = prevItem; } } diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/TurnBasedMinecraftMod.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/TurnBasedMinecraftMod.java index c374d69..a6ffbeb 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/TurnBasedMinecraftMod.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/TurnBasedMinecraftMod.java @@ -41,7 +41,7 @@ import org.apache.logging.log4j.Logger; public class TurnBasedMinecraftMod { public static final String MODID = "com_burnedkirby_turnbasedminecraft"; public static final String NAME = "Turn Based Minecraft Mod"; - public static final String VERSION = "1.26.2"; + public static final String VERSION = "1.26.3"; public static final String CONFIG_FILENAME = "TBM_Config.toml"; public static final String DEFAULT_CONFIG_FILENAME = "TBM_Config_DEFAULT.toml"; public static final String CONFIG_DIRECTORY = "config/TurnBasedMinecraft/"; diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/Utility.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/Utility.java index a27bb6e..14dcb60 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/Utility.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/Utility.java @@ -1,5 +1,6 @@ package com.burnedkirby.TurnBasedMinecraft.common; +import net.minecraft.core.component.DataComponents; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; @@ -68,6 +69,6 @@ public class Utility } public static boolean isItemEdible(ItemStack itemStack, @Nullable LivingEntity entity) { - return itemStack.getFoodProperties(entity) != null; + return itemStack.get(DataComponents.CONSUMABLE) != null; } }