Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

Commit

Permalink
Try fix Criticals work on Shulker Bullet
Browse files Browse the repository at this point in the history
  • Loading branch information
Nekiplay committed Apr 22, 2024
1 parent a6eec4e commit 19b4876
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package nekiplay.meteorplus.mixin.meteorclient.modules;

import meteordevelopment.meteorclient.events.packets.PacketEvent;
import meteordevelopment.meteorclient.mixininterface.IPlayerInteractEntityC2SPacket;
import meteordevelopment.meteorclient.systems.modules.Category;
import meteordevelopment.meteorclient.systems.modules.Module;
import meteordevelopment.meteorclient.systems.modules.combat.Criticals;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import static nekiplay.meteorplus.features.modules.combat.criticals.CriticalsPlus.skipCrit;

@Mixin(value = Criticals.class, remap = false, priority = 1001)
public class CriticalsMixin extends Module {
public CriticalsMixin(Category category, String name, String description) {
super(category, name, description);
}

@Inject(method = "onSendPacket", at = @At("HEAD"), cancellable = true)
private void onSendPacket(PacketEvent.Send event, CallbackInfo ci) {
if (event.packet instanceof IPlayerInteractEntityC2SPacket packet && packet.getType() == PlayerInteractEntityC2SPacket.InteractType.ATTACK) {
if (skipCrit()) return;

Entity entity = packet.getEntity();
if (entity.getType() == EntityType.SHULKER_BULLET || entity.getType() == EntityType.FIREBALL) {
ci.cancel();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public class KillAuraMixin extends Module {
private final List<Entity> targets = new ArrayList<>();

@Shadow

public Entity getTarget() {
if (!targets.isEmpty()) return targets.get(0);
return null;
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/meteorplus.accesswidener
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
accessWidener v1 named

accessible method net/minecraft/entity/passive/AbstractHorseEntity canBreed ()Z
accessible class net/minecraft/network/packet/c2s/play/PlayerInteractEntityC2SPacket$InteractType
1 change: 1 addition & 0 deletions src/main/resources/meteorplus.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"meteorclient.modules.TracersMixin",
"meteorclient.modules.WaypointsModuleMixin",
"meteorclient.modules.MiddleClickExtraMixin",
"meteorclient.modules.CriticalsMixin",
"minecraft.ClientConnectionAccessor",
"minecraft.ClientPlayerInteractionManagerMixin",
"minecraft.CraftingScreenHandlerAccessor",
Expand Down

0 comments on commit 19b4876

Please sign in to comment.