Code example for DataInput

Methods: readByte, readShort

0
        connection.handleSetSlot(this);
    } 
 
    public void readPacketData(DataInput datainput)
    { 
        this.windowId = datainput.readByte();
        this.itemSlot = datainput.readShort();
        this.myItemStack = readItemStack(datainput);
    } 
 
    public void writePacketData(DataOutput dataoutput)
    { 
        dataoutput.writeByte(this.windowId);
        dataoutput.writeShort(this.itemSlot);
        writeItemStack(this.myItemStack, dataoutput);
    } 
 
    public int getPacketSize() 
    { 
        return 8; 
    }