Merge remote-tracking branch 'origin/master'

This commit is contained in:
TheMode 2021-05-04 23:01:03 +02:00
commit 79a4bd135a
2 changed files with 14 additions and 5 deletions

View File

@ -679,11 +679,11 @@ public class Entity implements Viewable, Tickable, EventHandler, DataContainer,
* <p>
* The following packets are sent to viewers (check are performed in this order):
* <ol>
* <li>{@link EntityTeleportPacket} if <pre>distanceX > 8 || distanceY > 8 || distanceZ > 8</pre>
* <li>{@link EntityTeleportPacket} if {@code distanceX > 8 || distanceY > 8 || distanceZ > 8}
* <i>(performed using {@link #synchronizePosition()})</i></li>
* <li>{@link EntityPositionAndRotationPacket} if <pre>positionChange && viewChange</pre></li>
* <li>{@link EntityPositionPacket} if <pre>positionChange</pre></li>
* <li>{@link EntityRotationPacket} if <pre>viewChange</pre>
* <li>{@link EntityPositionAndRotationPacket} if {@code positionChange && viewChange}</li>
* <li>{@link EntityPositionPacket} if {@code positionChange}</li>
* <li>{@link EntityRotationPacket} if {@code viewChange}
* <i>(performed using {@link #setView(float, float)})</i></li>
* </ol>
* In case of a player's position and/or view change an additional {@link PlayerPositionAndLookPacket}

View File

@ -84,7 +84,16 @@ public class ItemTag<T> {
public static @NotNull ItemTag<NBT> NBT(@NotNull String key) {
return new ItemTag<>(key,
nbt -> nbt.get(key).deepClone(),
nbt -> {
var currentNBT = nbt.get(key);
// Avoid a NPE when cloning a null variable.
if (currentNBT == null) {
return null;
}
return currentNBT.deepClone();
},
((nbt, value) -> nbt.set(key, value.deepClone())));
}