Skip to content

Commit

Permalink
critical fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoLezury committed Sep 28, 2024
1 parent ecb5bd5 commit 51052e0
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
package team.leomc.assortedarmaments.mixin;

import net.minecraft.world.damagesource.DamageSource;
import com.llamalad7.mixinextras.sugar.Local;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.phys.Vec3;
import net.neoforged.neoforge.event.entity.player.CriticalHitEvent;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import team.leomc.assortedarmaments.entity.FlailOwner;
import team.leomc.assortedarmaments.entity.ThrownFlail;
import team.leomc.assortedarmaments.tags.AAItemTags;
Expand All @@ -30,9 +27,9 @@ public abstract class PlayerMixin implements FlailOwner {
@Unique
private ThrownFlail aa$flail;

@Inject(method = "attack", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;getEntitiesOfClass(Ljava/lang/Class;Lnet/minecraft/world/phys/AABB;)Ljava/util/List;", shift = At.Shift.BEFORE), locals = LocalCapture.CAPTURE_FAILHARD)
private void captureOriginalDamage(Entity target, CallbackInfo ci, float f, ItemStack itemstack, DamageSource damagesource, float f1, float f2, boolean flag4, boolean flag, boolean flag1, CriticalHitEvent critEvent, float f3, boolean flag2, double d0, float f6, Vec3 vec3, boolean flag3, float f4, float f7) {
aa$originalAttackDamage = f;
@Inject(method = "attack", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;getEntitiesOfClass(Ljava/lang/Class;Lnet/minecraft/world/phys/AABB;)Ljava/util/List;"))
private void captureOriginalDamage(Entity target, CallbackInfo ci, @Local(ordinal = 0) float originalDamage) {
aa$originalAttackDamage = originalDamage;
}

@ModifyArg(method = "attack", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/player/Player;getEnchantedDamage(Lnet/minecraft/world/entity/Entity;FLnet/minecraft/world/damagesource/DamageSource;)F", ordinal = 1), index = 1)
Expand Down

0 comments on commit 51052e0

Please sign in to comment.