forked from RepoMirrors/kami-blue
get potionID with the listener instead of onUpdate
This commit is contained in:
parent
9b78ecb03d
commit
b61fef6b0e
|
@ -26,27 +26,18 @@ public class BetterBeacons extends Module {
|
||||||
|
|
||||||
private Setting<Effects> effects = register(Settings.e("Effect", Effects.SPEED));
|
private Setting<Effects> effects = register(Settings.e("Effect", Effects.SPEED));
|
||||||
|
|
||||||
private int potionID = 1;
|
|
||||||
private boolean doCancelPacket = true;
|
private boolean doCancelPacket = true;
|
||||||
|
|
||||||
private enum Effects { SPEED, HASTE, RESISTANCE, JUMP_BOOST, STRENGTH }
|
private enum Effects { SPEED, HASTE, RESISTANCE, JUMP_BOOST, STRENGTH }
|
||||||
|
|
||||||
@Override
|
private int getPotionID() {
|
||||||
public void onUpdate() {
|
switch (effects.getValue()) {
|
||||||
if (effects.getValue().equals(Effects.SPEED)) {
|
case SPEED: return 1;
|
||||||
potionID = 1;
|
case HASTE: return 3;
|
||||||
}
|
case RESISTANCE: return 11;
|
||||||
if (effects.getValue().equals(Effects.HASTE)) {
|
case JUMP_BOOST: return 8;
|
||||||
potionID = 3;
|
case STRENGTH: return 5;
|
||||||
}
|
default: return -1;
|
||||||
if (effects.getValue().equals(Effects.RESISTANCE)) {
|
|
||||||
potionID = 11;
|
|
||||||
}
|
|
||||||
if (effects.getValue().equals(Effects.JUMP_BOOST)) {
|
|
||||||
potionID = 8;
|
|
||||||
}
|
|
||||||
if (effects.getValue().equals(Effects.STRENGTH)) {
|
|
||||||
potionID = 5;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +53,7 @@ public class BetterBeacons extends Module {
|
||||||
event.cancel();
|
event.cancel();
|
||||||
|
|
||||||
PacketBuffer buf = new PacketBuffer(Unpooled.buffer());
|
PacketBuffer buf = new PacketBuffer(Unpooled.buffer());
|
||||||
buf.writeInt(potionID);
|
buf.writeInt(getPotionID());
|
||||||
buf.writeInt(k1);
|
buf.writeInt(k1);
|
||||||
|
|
||||||
Wrapper.getPlayer().connection.sendPacket(new CPacketCustomPayload("MC|Beacon", buf));
|
Wrapper.getPlayer().connection.sendPacket(new CPacketCustomPayload("MC|Beacon", buf));
|
||||||
|
|
Loading…
Reference in New Issue