feat: added AntiHunger
This commit is contained in:
parent
a7664f8485
commit
1a11a3e163
2 changed files with 62 additions and 0 deletions
|
@ -63,6 +63,7 @@ public class BoSCoVicino implements ICommons {
|
||||||
BoSCoVicino.mods.add(new Coordinates(cfg, dp).done(cfg));
|
BoSCoVicino.mods.add(new Coordinates(cfg, dp).done(cfg));
|
||||||
BoSCoVicino.mods.add(new EntityList(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 Fullbright(cfg, dp).done(cfg));
|
||||||
|
BoSCoVicino.mods.add(new AntiHunger(cfg, dp).done(cfg));
|
||||||
BoSCoVicino.mods.add(new Freecam(cfg, dp).done(cfg));
|
BoSCoVicino.mods.add(new Freecam(cfg, dp).done(cfg));
|
||||||
|
|
||||||
BoSCoVicino.spec = cfg.build();
|
BoSCoVicino.spec = cfg.build();
|
||||||
|
|
61
src/main/java/ftbsc/bscv/modules/self/AntiHunger.java
Normal file
61
src/main/java/ftbsc/bscv/modules/self/AntiHunger.java
Normal file
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue