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
7 changed files
with
84 additions
and
18 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
8 changes: 7 additions & 1 deletion
8
src/main/java/nekiplay/meteorplus/features/modules/combat/velocity/VelocityModes.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 |
---|---|---|
@@ -1,5 +1,11 @@ | ||
package nekiplay.meteorplus.features.modules.combat.velocity; | ||
|
||
public enum VelocityModes { | ||
Grim, | ||
Grim_Cancel, | ||
Grim_Cancel_v2; | ||
|
||
@Override | ||
public String toString() { | ||
return super.toString().replace('_', ' '); | ||
} | ||
} |
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
64 changes: 64 additions & 0 deletions
64
src/main/java/nekiplay/meteorplus/features/modules/combat/velocity/modes/GrimCancel_v2.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,64 @@ | ||
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.PlayerActionC2SPacket; | ||
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; | ||
import net.minecraft.network.packet.s2c.play.EntityVelocityUpdateS2CPacket; | ||
import net.minecraft.network.packet.s2c.play.ExplosionS2CPacket; | ||
import net.minecraft.network.packet.s2c.play.PlayerPositionLookS2CPacket; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.Direction; | ||
|
||
public class GrimCancel_v2 extends VelocityMode { | ||
public GrimCancel_v2() { | ||
super(VelocityModes.Grim_Cancel_v2); | ||
} | ||
|
||
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) { | ||
event.cancel(); | ||
canCancel = true; | ||
} | ||
else if (packet instanceof PlayerPositionLookS2CPacket) { | ||
skip = 3; | ||
} | ||
} | ||
|
||
@Override | ||
public void onSendPacket(PacketEvent.Send event) { | ||
Packet<?> packet = event.packet; | ||
|
||
if (packet instanceof PlayerMoveC2SPacket) { | ||
skip--; | ||
if (canCancel) { | ||
if (skip <= 0) { | ||
BlockPos blockPos = mc.player.getBlockPos(); | ||
mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.Full(mc.player.getX(), mc.player.getY(), mc.player.getZ(), mc.player.getYaw(), mc.player.getPitch(), mc.player.isOnGround())); | ||
mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK, mc.player.getBlockPos(), Direction.UP)); | ||
} | ||
} | ||
} | ||
} | ||
} |
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