Skip to content

Commit 32feb53

Browse files
committed
fixes
1 parent dd59996 commit 32feb53

File tree

4 files changed

+11
-15
lines changed

4 files changed

+11
-15
lines changed

changelog.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
- Updated several lang files
2-
- Added a several mod items to the default config
1+
- Fixed: Rotation feature not working
2+
- Fixed: Removing an Item from the Tool changes its title to the raw name

src/main/java/vazkii/morphtool/MorphToolItem.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package vazkii.morphtool;
22

3+
import net.minecraft.core.BlockPos;
34
import net.minecraft.nbt.CompoundTag;
45
import net.minecraft.network.chat.Component;
56
import net.minecraft.world.InteractionResult;
@@ -9,6 +10,7 @@
910
import net.minecraft.world.item.TooltipFlag;
1011
import net.minecraft.world.item.context.UseOnContext;
1112
import net.minecraft.world.level.Level;
13+
import net.minecraft.world.level.block.Block;
1214
import net.minecraft.world.level.block.Rotation;
1315
import net.minecraft.world.level.block.state.BlockState;
1416

@@ -28,8 +30,12 @@ public MorphToolItem() {
2830

2931
@Override
3032
public InteractionResult useOn(UseOnContext context) {
33+
Level level = context.getLevel();
34+
BlockPos pos = context.getClickedPos();
3135
BlockState block = context.getLevel().getBlockState(context.getClickedPos());
32-
block.rotate(context.getLevel(), context.getClickedPos(), Rotation.CLOCKWISE_90);
36+
if (level.setBlock(pos, block.rotate(level, pos, Rotation.CLOCKWISE_90), Block.UPDATE_ALL)) {
37+
return InteractionResult.sidedSuccess(level.isClientSide);
38+
}
3339
return super.useOn(context);
3440
}
3541

src/main/java/vazkii/morphtool/MorphingHandler.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,6 @@ public static void removeItemFromTool(Entity e, ItemStack stack, boolean itemBro
7373
}
7474

7575
copyCmp.remove("display");
76-
Component displayName = null;
77-
CompoundTag nameCmp = (CompoundTag) copyCmp.get(TAG_MORPH_TOOL_DISPLAY_NAME);
78-
if (nameCmp != null) {
79-
displayName = Component.literal(nameCmp.getString("text"));
80-
}
81-
if (displayName != null && !displayName.getString().isEmpty() && displayName != copy.getHoverName()) {
82-
copy.setHoverName(displayName);
83-
}
8476

8577
copyCmp.remove(TAG_MORPHING_TOOL);
8678
copyCmp.remove(TAG_MORPH_TOOL_DISPLAY_NAME);

src/main/resources/META-INF/mods.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ license="Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported Lice
77
modId="morphtool"
88
displayName="Morph-o-Tool"
99
version="${file.jarVersion}"
10-
authors="Vazkii, MoreThanHidden"
11-
description='''
12-
The wrench to end all wrenches.
13-
'''
10+
authors="Vazkii, MoreThanHidden, Uraneptus"
11+
description='''The wrench to end all wrenches.'''
1412
[[dependencies.morphtool]]
1513
modId="autoreglib"
1614
mandatory=true

0 commit comments

Comments
 (0)