This repository has been archived by the owner on Sep 24, 2024. It is now read-only.
generated from MeteorDevelopment/meteor-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
57 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/main/java/nekiplay/meteorplus/features/modules/combat/velocity/modes/GrimSkip.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package nekiplay.meteorplus.features.modules.combat.velocity.modes; | ||
|
||
import meteordevelopment.meteorclient.events.packets.PacketEvent; | ||
import nekiplay.meteorplus.features.modules.combat.velocity.VelocityMode; | ||
import nekiplay.meteorplus.features.modules.combat.velocity.VelocityModes; | ||
import net.minecraft.network.packet.Packet; | ||
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; | ||
import net.minecraft.network.packet.s2c.play.EntityVelocityUpdateS2CPacket; | ||
import net.minecraft.network.packet.s2c.play.ExplosionS2CPacket; | ||
|
||
public class GrimSkip extends VelocityMode { | ||
public GrimSkip() { | ||
super(VelocityModes.Grim_Skip); | ||
} | ||
|
||
private int skip = 0; | ||
|
||
private boolean canCancel = false; | ||
|
||
@Override | ||
public void onActivate() { | ||
canCancel = false; | ||
skip = 0; | ||
} | ||
|
||
@Override | ||
public void onDeactivate() { | ||
canCancel = false; | ||
skip = 0; | ||
} | ||
|
||
@Override | ||
public void onReceivePacket(PacketEvent.Receive event) { | ||
Packet<?> packet = event.packet; | ||
|
||
if (((packet instanceof EntityVelocityUpdateS2CPacket && ((EntityVelocityUpdateS2CPacket) packet).getId() == mc.player.getId()) || packet instanceof ExplosionS2CPacket) && canCancel) { | ||
skip = 6; | ||
event.cancel(); | ||
} | ||
} | ||
|
||
@Override | ||
public void onSendPacket(PacketEvent.Send event) { | ||
Packet<?> packet = event.packet; | ||
|
||
if (packet instanceof PlayerMoveC2SPacket) { | ||
if (skip > 0) { | ||
skip--; | ||
event.cancel(); | ||
} | ||
} | ||
} | ||
} |