Advertisement
Guest User

Untitled

a guest
Jul 21st, 2015
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. public class PacketRequestData<T extends TileEntity & ITileNetworkable> extends PacketBlockLocation implements IMessage, IMessageHandler<PacketRequestData, IMessage> {
  2. public PacketRequestData() {
  3.  
  4. }
  5.  
  6. public PacketRequestData(BlockLocation blockLocation) {
  7. super(blockLocation);
  8. }
  9.  
  10. public PacketRequestData(T tileEntity) {
  11. super(new BlockLocation(tileEntity));
  12. }
  13.  
  14. public PacketRequestData(ITileComponent tileComponent) {
  15. super(new BlockLocation(tileComponent.getTileEntity()));
  16. }
  17.  
  18. @Override
  19. public IMessage onMessage(PacketRequestData message, MessageContext context) {
  20. TileEntity tileEntity = message.getBlockLocation().getTileEntity(PacketHandler.getWorld(context));
  21.  
  22. if (tileEntity != null && tileEntity instanceof ITileNetworkable) {
  23. return new PacketTileEntity((T) tileEntity);
  24. }
  25.  
  26. return null;
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement