|
143 | 143 | import org.bukkit.Location; |
144 | 144 | import org.bukkit.World; |
145 | 145 | import org.bukkit.World.Environment; |
| 146 | +import org.bukkit.block.TileState; |
146 | 147 | import org.bukkit.block.data.BlockData; |
147 | 148 | import org.bukkit.craftbukkit.CraftServer; |
148 | 149 | import org.bukkit.craftbukkit.CraftWorld; |
| 150 | +import org.bukkit.craftbukkit.block.CraftBlockEntityState; |
149 | 151 | import org.bukkit.craftbukkit.block.data.CraftBlockData; |
150 | 152 | import org.bukkit.craftbukkit.entity.CraftEntity; |
151 | 153 | import org.bukkit.craftbukkit.entity.CraftPlayer; |
@@ -589,6 +591,24 @@ public void sendFakeNBT(Player player, BlockVector3 pos, LinCompoundTag nbtData) |
589 | 591 | )); |
590 | 592 | } |
591 | 593 |
|
| 594 | + @Override |
| 595 | + public void sendFakeNBT(Player player, BlockVector3 pos, TileState tileState, @Nullable LinCompoundTag nbtData) { |
| 596 | + CraftBlockEntityState<?> craftState = (CraftBlockEntityState<?>) tileState; |
| 597 | + |
| 598 | + CompoundTag vanillaNBT; |
| 599 | + if (nbtData == null) { |
| 600 | + vanillaNBT = craftState.getSnapshotNBT(); |
| 601 | + } else { |
| 602 | + vanillaNBT = (net.minecraft.nbt.CompoundTag) fromNative(nbtData); |
| 603 | + } |
| 604 | + |
| 605 | + ((CraftPlayer) player).getHandle().connection.send(new ClientboundBlockEntityDataPacket( |
| 606 | + new BlockPos(pos.x(), pos.y(), pos.z()), |
| 607 | + craftState.getBlockEntity().getType(), |
| 608 | + vanillaNBT |
| 609 | + )); |
| 610 | + } |
| 611 | + |
592 | 612 | @Override |
593 | 613 | public void sendFakeOP(Player player) { |
594 | 614 | ((CraftPlayer) player).getHandle().connection.send(new ClientboundEntityEventPacket( |
|
0 commit comments