diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/ftbsc/bscv/BoSCoVicino.java | 1 | ||||
-rw-r--r-- | src/main/java/ftbsc/bscv/modules/self/AntiHunger.java | 61 |
2 files changed, 62 insertions, 0 deletions
diff --git a/src/main/java/ftbsc/bscv/BoSCoVicino.java b/src/main/java/ftbsc/bscv/BoSCoVicino.java index 4f4c108..5f2bc6b 100644 --- a/src/main/java/ftbsc/bscv/BoSCoVicino.java +++ b/src/main/java/ftbsc/bscv/BoSCoVicino.java @@ -63,6 +63,7 @@ public class BoSCoVicino implements ICommons { BoSCoVicino.mods.add(new Coordinates(cfg, dp).done(cfg)); BoSCoVicino.mods.add(new EntityList(cfg, dp).done(cfg)); BoSCoVicino.mods.add(new Fullbright(cfg, dp).done(cfg)); + BoSCoVicino.mods.add(new AntiHunger(cfg, dp).done(cfg)); BoSCoVicino.mods.add(new Freecam(cfg, dp).done(cfg)); BoSCoVicino.spec = cfg.build(); diff --git a/src/main/java/ftbsc/bscv/modules/self/AntiHunger.java b/src/main/java/ftbsc/bscv/modules/self/AntiHunger.java new file mode 100644 index 0000000..6630aa5 --- /dev/null +++ b/src/main/java/ftbsc/bscv/modules/self/AntiHunger.java @@ -0,0 +1,61 @@ +package ftbsc.bscv.modules.self; + +import com.mojang.brigadier.CommandDispatcher; +import com.mojang.brigadier.arguments.BoolArgumentType; + +import ftbsc.bscv.ICommons; +import ftbsc.bscv.events.PacketEvent; +import ftbsc.bscv.modules.Module; +import net.minecraft.command.CommandSource; +import net.minecraft.network.play.client.CEntityActionPacket; +import net.minecraft.network.play.client.CPlayerPacket; +import net.minecraft.network.play.client.CEntityActionPacket.Action; +import net.minecraftforge.common.ForgeConfigSpec; +import net.minecraftforge.eventbus.api.SubscribeEvent; + +public class AntiHunger extends Module implements ICommons { + + public final ForgeConfigSpec.ConfigValue<Boolean> sprint; + public final ForgeConfigSpec.ConfigValue<Boolean> hover; + + public AntiHunger(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) { + super("AntiHunger", Group.SELF, builder, dispatcher); + + this.sprint = this.option( + "sprint", "mask sprint toggle packets", true, + BoolArgumentType.bool(), Boolean.class, + builder, dispatcher + ); + + this.hover = this.option( + "hover", "mark as not on-ground while walking", true, + BoolArgumentType.bool(), Boolean.class, + builder, dispatcher + ); + } + + @SubscribeEvent + public void onPacket(PacketEvent event) { + if (!event.outgoing) return; + if (this.sprint.get() && event.packet instanceof CEntityActionPacket) { + CEntityActionPacket packet = (CEntityActionPacket) event.packet; + if ( + packet.getAction() == Action.START_SPRINTING || + packet.getAction() == Action.STOP_SPRINTING + ) { + event.setCanceled(true); + } + } + + if ( + this.hover.get() + && event.packet instanceof CPlayerPacket + && MC.player != null + && MC.player.fallDistance <= 0.f + && !MC.gameMode.isDestroying() + ) { + CPlayerPacket packet = (CPlayerPacket) event.packet; + packet.onGround = false; // ACCESSTRANSFORMER public net.minecraft.network.play.client.CPlayerPacket field_149474_g + } + } +} |