mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-03 14:11:27 +01:00
SPIGOT-7894: NPE when sending tile entity update
By: md_5 <git@md-5.net>
This commit is contained in:
parent
b7359583f2
commit
5bc6a90535
@ -115,6 +115,14 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState
|
|||||||
return nbt;
|
return nbt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// gets the packet data of the TileEntity represented by this block state
|
||||||
|
public NBTTagCompound getUpdateNBT() {
|
||||||
|
// update snapshot
|
||||||
|
applyTo(snapshot);
|
||||||
|
|
||||||
|
return snapshot.getUpdateTag(getRegistryAccess());
|
||||||
|
}
|
||||||
|
|
||||||
// copies the data of the given tile entity to this block state
|
// copies the data of the given tile entity to this block state
|
||||||
protected void load(T tileEntity) {
|
protected void load(T tileEntity) {
|
||||||
if (tileEntity != null && tileEntity != snapshot) {
|
if (tileEntity != null && tileEntity != snapshot) {
|
||||||
@ -156,8 +164,7 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public Packet<PacketListenerPlayOut> getUpdatePacket(@NotNull Location location) {
|
public Packet<PacketListenerPlayOut> getUpdatePacket(@NotNull Location location) {
|
||||||
T vanillaTileEntitiy = (T) TileEntity.loadStatic(CraftLocation.toBlockPosition(location), getHandle(), getSnapshotNBT(), getRegistryAccess());
|
return new PacketPlayOutTileEntityData(CraftLocation.toBlockPosition(location), snapshot.getType(), getUpdateNBT());
|
||||||
return PacketPlayOutTileEntityData.create(vanillaTileEntitiy);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user