From 32feb53c8506f5039350eabaad3c5e9531a62b3a Mon Sep 17 00:00:00 2001 From: Uraneptus Date: Wed, 7 Aug 2024 19:26:15 +0200 Subject: [PATCH] fixes --- changelog.txt | 4 ++-- src/main/java/vazkii/morphtool/MorphToolItem.java | 8 +++++++- src/main/java/vazkii/morphtool/MorphingHandler.java | 8 -------- src/main/resources/META-INF/mods.toml | 6 ++---- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/changelog.txt b/changelog.txt index 7c657d5..5c711e6 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,2 +1,2 @@ -- Updated several lang files -- Added a several mod items to the default config \ No newline at end of file +- Fixed: Rotation feature not working +- Fixed: Removing an Item from the Tool changes its title to the raw name \ No newline at end of file diff --git a/src/main/java/vazkii/morphtool/MorphToolItem.java b/src/main/java/vazkii/morphtool/MorphToolItem.java index 05b7691..38ad80b 100644 --- a/src/main/java/vazkii/morphtool/MorphToolItem.java +++ b/src/main/java/vazkii/morphtool/MorphToolItem.java @@ -1,5 +1,6 @@ package vazkii.morphtool; +import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.world.InteractionResult; @@ -9,6 +10,7 @@ import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Rotation; import net.minecraft.world.level.block.state.BlockState; @@ -28,8 +30,12 @@ public MorphToolItem() { @Override public InteractionResult useOn(UseOnContext context) { + Level level = context.getLevel(); + BlockPos pos = context.getClickedPos(); BlockState block = context.getLevel().getBlockState(context.getClickedPos()); - block.rotate(context.getLevel(), context.getClickedPos(), Rotation.CLOCKWISE_90); + if (level.setBlock(pos, block.rotate(level, pos, Rotation.CLOCKWISE_90), Block.UPDATE_ALL)) { + return InteractionResult.sidedSuccess(level.isClientSide); + } return super.useOn(context); } diff --git a/src/main/java/vazkii/morphtool/MorphingHandler.java b/src/main/java/vazkii/morphtool/MorphingHandler.java index 61f2285..7ed1238 100644 --- a/src/main/java/vazkii/morphtool/MorphingHandler.java +++ b/src/main/java/vazkii/morphtool/MorphingHandler.java @@ -73,14 +73,6 @@ public static void removeItemFromTool(Entity e, ItemStack stack, boolean itemBro } copyCmp.remove("display"); - Component displayName = null; - CompoundTag nameCmp = (CompoundTag) copyCmp.get(TAG_MORPH_TOOL_DISPLAY_NAME); - if (nameCmp != null) { - displayName = Component.literal(nameCmp.getString("text")); - } - if (displayName != null && !displayName.getString().isEmpty() && displayName != copy.getHoverName()) { - copy.setHoverName(displayName); - } copyCmp.remove(TAG_MORPHING_TOOL); copyCmp.remove(TAG_MORPH_TOOL_DISPLAY_NAME); diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 31df860..b7a5133 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -7,10 +7,8 @@ license="Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported Lice modId="morphtool" displayName="Morph-o-Tool" version="${file.jarVersion}" -authors="Vazkii, MoreThanHidden" -description=''' -The wrench to end all wrenches. -''' +authors="Vazkii, MoreThanHidden, Uraneptus" +description='''The wrench to end all wrenches.''' [[dependencies.morphtool]] modId="autoreglib" mandatory=true