Structure Compass

Structure Compass

13M Downloads

[Bug]: Selecting a structure removes all enchantment on the structure compass

notcake opened this issue ยท 1 comments

commented

General Info

  • I am running a modpack
  • I can reproduce this issue consistently in single-player
  • I can reproduce this issue consistently in multi-player
  • I have searched for this issue previously and it was either (1) not previously reported, or (2) previously fixed and I am having the same problem.
  • I am crashing and can provide my crash report(s)
  • I am using the latest version of the mod

Forge version

47.2.20

Minecraft version

1.20.1

Mod version

StructureCompass-1.20.1-2.0.8.jar

Java version

Java 17.0.8

Issue Description

  1. Enchant the structure compass with Soulbound.
  2. Shift + Right click and select a structure.
  3. The enchantment is lost.

The SetStructureMessage handler erases all other NBT tags on the item.

public void handle(Supplier<Context> context) {
NetworkEvent.Context ctx = context.get();
ctx.enqueueWork(() -> {
if (ctx.getDirection().getReceptionSide().isServer() && ctx.getSender() != null) {
ItemStack stack = ctx.getSender().getItemInHand(hand);
if (stack.getItem() instanceof StructureCompassItem) {
CompoundTag tag = new CompoundTag();
tag.putString(Reference.structure_tag, structureLocation.toString());
stack.setTag(tag);
}
}
});
ctx.setPacketHandled(true);
}

Additional Information

No response

commented

Thanks for the incredibly fast fix for this!