initial commit
This commit is contained in:
parent
3c9ee26b06
commit
22186c33b9
1458 changed files with 282792 additions and 0 deletions
69
java/src/game/packet/S2FPacketSetSlot.java
Executable file
69
java/src/game/packet/S2FPacketSetSlot.java
Executable file
|
@ -0,0 +1,69 @@
|
|||
package game.packet;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import game.item.ItemStack;
|
||||
import game.network.NetHandlerPlayClient;
|
||||
import game.network.Packet;
|
||||
import game.network.PacketBuffer;
|
||||
|
||||
public class S2FPacketSetSlot implements Packet<NetHandlerPlayClient>
|
||||
{
|
||||
private int windowId;
|
||||
private int slot;
|
||||
private ItemStack item;
|
||||
|
||||
public S2FPacketSetSlot()
|
||||
{
|
||||
}
|
||||
|
||||
public S2FPacketSetSlot(int windowIdIn, int slotIn, ItemStack itemIn)
|
||||
{
|
||||
this.windowId = windowIdIn;
|
||||
this.slot = slotIn;
|
||||
this.item = itemIn == null ? null : itemIn.copy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Passes this Packet on to the NetHandler for processing.
|
||||
*/
|
||||
public void processPacket(NetHandlerPlayClient handler)
|
||||
{
|
||||
handler.handleSetSlot(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the raw packet data from the data stream.
|
||||
*/
|
||||
public void readPacketData(PacketBuffer buf) throws IOException
|
||||
{
|
||||
this.windowId = buf.readByte();
|
||||
this.slot = buf.readShort();
|
||||
this.item = buf.readItemStackFromBuffer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the raw packet data to the data stream.
|
||||
*/
|
||||
public void writePacketData(PacketBuffer buf) throws IOException
|
||||
{
|
||||
buf.writeByte(this.windowId);
|
||||
buf.writeShort(this.slot);
|
||||
buf.writeItemStackToBuffer(this.item);
|
||||
}
|
||||
|
||||
public int getWindowId()
|
||||
{
|
||||
return this.windowId;
|
||||
}
|
||||
|
||||
public int getSlot()
|
||||
{
|
||||
return this.slot;
|
||||
}
|
||||
|
||||
public ItemStack getStack()
|
||||
{
|
||||
return this.item;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue