antihunger silent disable

This commit is contained in:
Bella 2020-04-15 18:06:40 -04:00
parent c81e5aff1a
commit 101a30c69a
No known key found for this signature in database
GPG Key ID: DBD4A6030080C8B3
1 changed files with 8 additions and 8 deletions

View File

@ -9,13 +9,13 @@ import me.zeroeightsix.kami.setting.Settings;
import net.minecraft.network.play.client.CPacketEntityAction;
import net.minecraft.network.play.client.CPacketPlayer;
import static me.zeroeightsix.kami.KamiMod.MODULE_MANAGER;
import static me.zeroeightsix.kami.util.MessageSendHelper.sendChatMessage;
import static net.minecraft.network.play.client.CPacketEntityAction.Action.START_SPRINTING;
import static net.minecraft.network.play.client.CPacketEntityAction.Action.STOP_SPRINTING;
/**
* Created by 086 on 8/04/2018.
* Code tweaked by coderynx & OverFloyd.
*
* Movement taken from Seppuku
* https://github.com/seppukudevelopment/seppuku/blob/005e2da/src/main/java/me/rigamortis/seppuku/impl/module/player/NoHungerModule.java
*/
@ -25,15 +25,15 @@ public class AntiHunger extends Module {
@EventHandler
public Listener<PacketEvent.Send> packetListener = new Listener<>(event -> {
if (MODULE_MANAGER.getModule(ElytraFlight.class).isEnabled()) {
return;
}
if (event.getPacket() instanceof CPacketEntityAction) {
final CPacketEntityAction packet = (CPacketEntityAction) event.getPacket();
if (cancelMovementState.getValue() && (packet.getAction() == START_SPRINTING || packet.getAction() == STOP_SPRINTING)) {
if (mc.player == null || mc.player.isElytraFlying()) return;
if (cancelMovementState.getValue() && event.getPacket() instanceof CPacketEntityAction) {
CPacketEntityAction packet = (CPacketEntityAction) event.getPacket();
if (packet.getAction() == START_SPRINTING || packet.getAction() == STOP_SPRINTING) {
event.cancel();
}
}
if (event.getPacket() instanceof CPacketPlayer) {
((CPacketPlayer) event.getPacket()).onGround = mc.player.fallDistance > 0 || mc.playerController.isHittingBlock;
}