ProtocolLib

3M Downloads

ENTITY_EFFECT packet field not same with wiki

IllegalTempo opened this issue ยท 1 comments

commented
PacketContainer hideplayer = new PacketContainer(PacketType.Play.Server.ENTITY_EFFECT);
		hideplayer.getIntegers().write(0, player.getEntityId()); //Entity ID
		hideplayer.getIntegers().write(1, 14); //Potion Effect ID (Invisibility)
		hideplayer.getBytes().write(1, (byte) 1); //Amplifier
		hideplayer.getIntegers().write(2, 1); //Duration

I enter the field provided on wiki,
image
But It returns Field index 2 is out of bounds for length 2
which means the integer 2 is not existing
How can I fix this?

commented

The effect is not an int (you have to look at the data types of the variables in the packet class, not at the serialized protocol bytes):

    private final int entityId;
    private final MobEffect effect;
    private final byte effectAmplifier;
    private final int effectDurationTicks;
    private final byte flags;
    private final MobEffectInstance.FactorData factorData;