Skip to content

Commit

Permalink
Fixed wrong entity metadata position
Browse files Browse the repository at this point in the history
  • Loading branch information
cavallium committed Jul 7, 2020
1 parent 52f006d commit d80d893
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.warp</groupId>
<artifactId>CoordinatesObfuscator</artifactId>
<version>1.3.2</version>
<version>1.3.3</version>
<name>CoordinatesObfuscator</name>
<build>
<resources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
public class TranslatorClientbound {


/**
/**ENTITY_METADATA
*
*
* @param logger
Expand Down Expand Up @@ -423,10 +423,18 @@ private static void sendInt8(Logger logger, final PacketContainer packet, final
private static void sendTileEntityData(Logger logger, final PacketContainer packet, final CoordinateOffset offset) {
sendBlockPosition(logger, packet, offset);

final NbtCompound nbt = (NbtCompound) packet.getNbtModifier().read(0).deepClone();
if (nbt.containsKey("x") && nbt.containsKey("z")) {
nbt.put("x", nbt.getInteger("x") - offset.getXInt());
nbt.put("z", nbt.getInteger("z") - offset.getZInt());
}
packet.getNbtModifier().modify(0, nbtBase -> {
if (nbtBase == null) return null;
if (nbtBase instanceof NbtCompound) {
final NbtCompound nbt = (NbtCompound) (((NbtCompound) nbtBase).deepClone());
if (nbt.containsKey("x") && nbt.containsKey("z")) {
nbt.put("x", nbt.getInteger("x") - offset.getXInt());
nbt.put("z", nbt.getInteger("z") - offset.getZInt());
}
return nbt;
} else {
return nbtBase;
}
});
}
}

0 comments on commit d80d893

Please sign in to comment.