Guest User

OpenGuiPacket

a guest
Dec 26th, 2015
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.89 KB | None | 0 0
  1. package com.happykiller.weightlimit.server.packet.packets;
  2.  
  3. import com.happykiller.weightlimit.main.ModMain;
  4. import com.happykiller.weightlimit.server.packet.AbstractPacket;
  5.  
  6. import io.netty.buffer.ByteBuf;
  7. import io.netty.channel.ChannelHandlerContext;
  8. import net.minecraft.entity.player.EntityPlayer;
  9.  
  10. public class OpenGuiPacket extends AbstractPacket {
  11.    
  12.     private int id;
  13.    
  14.     public OpenGuiPacket(){}
  15.    
  16.     public OpenGuiPacket(int id) {
  17.         this.id = id;
  18.     }
  19.  
  20.     public void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
  21.         buffer.writeInt(id);
  22.     }
  23.  
  24.     public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
  25.         id = buffer.readInt();
  26.     }
  27.  
  28.     public void handleClientSide(EntityPlayer player) {
  29.        
  30.     }
  31.  
  32.     public void handleServerSide(EntityPlayer player) {
  33.         player.openGui(ModMain.instance, id, player.worldObj,(int)player.posX, (int)player.posY, (int)player.posZ);
  34.     }
  35. }
Add Comment
Please, Sign In to add comment