53 lines
1.3 KiB
Java
Executable file
53 lines
1.3 KiB
Java
Executable file
package proxy.packet;
|
|
|
|
import java.io.IOException;
|
|
|
|
import proxy.handler.ProxyHandler;
|
|
import proxy.network.Packet;
|
|
import proxy.network.PacketBuffer;
|
|
|
|
public class S13PacketDestroyEntities implements Packet<ProxyHandler>
|
|
{
|
|
private int[] entityIds;
|
|
|
|
public void replaceEntityIds(int real, int spoofed) {
|
|
for(int z = 0; z < this.entityIds.length; z++) {
|
|
if(this.entityIds[z] == real)
|
|
this.entityIds[z] = spoofed;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Reads the raw packet data from the data stream.
|
|
*/
|
|
public void readPacketData(PacketBuffer buf) throws IOException
|
|
{
|
|
this.entityIds = new int[buf.readVarIntFromBuffer()];
|
|
|
|
for (int i = 0; i < this.entityIds.length; ++i)
|
|
{
|
|
this.entityIds[i] = buf.readVarIntFromBuffer();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Writes the raw packet data to the data stream.
|
|
*/
|
|
public void writePacketData(PacketBuffer buf) throws IOException
|
|
{
|
|
buf.writeVarIntToBuffer(this.entityIds.length);
|
|
|
|
for (int i = 0; i < this.entityIds.length; ++i)
|
|
{
|
|
buf.writeVarIntToBuffer(this.entityIds[i]);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Passes this Packet on to the NetHandler for processing.
|
|
*/
|
|
public void processPacket(ProxyHandler handler)
|
|
{
|
|
handler.handleDestroyEntities(this);
|
|
}
|
|
}
|