Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Uraneptus committed Aug 7, 2024
1 parent dd59996 commit 32feb53
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 deletions.
4 changes: 2 additions & 2 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
- Updated several lang files
- Added a several mod items to the default config
- Fixed: Rotation feature not working
- Fixed: Removing an Item from the Tool changes its title to the raw name
8 changes: 7 additions & 1 deletion src/main/java/vazkii/morphtool/MorphToolItem.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;

Expand All @@ -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);
}

Expand Down
8 changes: 0 additions & 8 deletions src/main/java/vazkii/morphtool/MorphingHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 2 additions & 4 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 32feb53

Please sign in to comment.