tcr/java/src/game/packet/S1EPacketRemoveEntityEffect.java

62 lines
1.4 KiB
Java
Raw Normal View History

2025-03-11 00:23:54 +01:00
package game.packet;
import java.io.IOException;
import game.network.ClientPlayer;
2025-03-11 00:23:54 +01:00
import game.network.Packet;
import game.network.PacketBuffer;
2025-03-26 21:07:23 +01:00
import game.potion.Potion;
2025-03-11 00:23:54 +01:00
import game.potion.PotionEffect;
public class S1EPacketRemoveEntityEffect implements Packet<ClientPlayer>
2025-03-11 00:23:54 +01:00
{
private int entityId;
2025-03-26 21:07:23 +01:00
private Potion effectId;
2025-03-11 00:23:54 +01:00
public S1EPacketRemoveEntityEffect()
{
}
public S1EPacketRemoveEntityEffect(int entityIdIn, PotionEffect effect)
{
this.entityId = entityIdIn;
2025-03-26 21:07:23 +01:00
this.effectId = effect.getPotion();
2025-03-11 00:23:54 +01:00
}
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
this.entityId = buf.readVarIntFromBuffer();
2025-03-26 21:07:23 +01:00
this.effectId = buf.readEnumValue(Potion.class);
2025-03-11 00:23:54 +01:00
}
/**
* Writes the raw packet data to the data stream.
*/
public void writePacketData(PacketBuffer buf) throws IOException
{
buf.writeVarIntToBuffer(this.entityId);
2025-03-26 21:07:23 +01:00
buf.writeEnumValue(this.effectId);
2025-03-11 00:23:54 +01:00
}
/**
* Passes this Packet on to the NetHandler for processing.
*/
public void processPacket(ClientPlayer handler)
2025-03-11 00:23:54 +01:00
{
handler.handleRemoveEntityEffect(this);
}
public int getEntityId()
{
return this.entityId;
}
2025-03-26 21:07:23 +01:00
public Potion getEffectId()
2025-03-11 00:23:54 +01:00
{
return this.effectId;
}
}