001 package net.minecraft.network.packet; 002 003 import java.io.DataInputStream; 004 import java.io.DataOutputStream; 005 import java.io.IOException; 006 007 public class Packet106Transaction extends Packet 008 { 009 /** The id of the window that the action occurred in. */ 010 public int windowId; 011 public short shortWindowId; 012 public boolean accepted; 013 014 public Packet106Transaction() {} 015 016 public Packet106Transaction(int par1, short par2, boolean par3) 017 { 018 this.windowId = par1; 019 this.shortWindowId = par2; 020 this.accepted = par3; 021 } 022 023 /** 024 * Passes this Packet on to the NetHandler for processing. 025 */ 026 public void processPacket(NetHandler par1NetHandler) 027 { 028 par1NetHandler.handleTransaction(this); 029 } 030 031 /** 032 * Abstract. Reads the raw packet data from the data stream. 033 */ 034 public void readPacketData(DataInputStream par1DataInputStream) throws IOException 035 { 036 this.windowId = par1DataInputStream.readByte(); 037 this.shortWindowId = par1DataInputStream.readShort(); 038 this.accepted = par1DataInputStream.readByte() != 0; 039 } 040 041 /** 042 * Abstract. Writes the raw packet data to the data stream. 043 */ 044 public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException 045 { 046 par1DataOutputStream.writeByte(this.windowId); 047 par1DataOutputStream.writeShort(this.shortWindowId); 048 par1DataOutputStream.writeByte(this.accepted ? 1 : 0); 049 } 050 051 /** 052 * Abstract. Return the size of the packet (not counting the header). 053 */ 054 public int getPacketSize() 055 { 056 return 4; 057 } 058 }