尝试加入取消击退的mixin,但没有生效
This commit is contained in:
parent
3d47f33ed1
commit
9274d3e291
3 changed files with 46 additions and 0 deletions
|
@ -45,6 +45,7 @@ public class BoundingBoxManager {
|
|||
});
|
||||
registerHeadshotBox(TargetModEntities.SENPAI.get(), new BasicHeadshotBox<>(8.0, 22.0));
|
||||
registerHeadshotBox(TargetModEntities.TARGET_1.get(), new BasicHeadshotBox<>(14.0, 20.0));
|
||||
registerHeadshotBox(EntityType.ENDERMAN, new BasicHeadshotBox<>(8.0, 38.0));
|
||||
registerHeadshotBox(EntityType.ZOMBIE, new ChildHeadshotBox<>(8.0, 26.0, 0.75, 0.5));
|
||||
registerHeadshotBox(EntityType.ZOMBIFIED_PIGLIN, new ChildHeadshotBox<>(8.0, 26.0, 0.75, 0.5));
|
||||
registerHeadshotBox(EntityType.HUSK, new ChildHeadshotBox<>(8.0, 26.0, 0.75, 0.5));
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package net.mcreator.target.mixins;
|
||||
|
||||
import net.mcreator.target.entity.ProjectileEntity;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
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.ModifyArg;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
/**
|
||||
* Author: MrCrayfish
|
||||
*/
|
||||
@Mixin(LivingEntity.class)
|
||||
public class LivingEntityMixin
|
||||
{
|
||||
private DamageSource source;
|
||||
|
||||
@Inject(method = "hurt", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;knockback(DDD)V"))
|
||||
private void capture(DamageSource source, float amount, CallbackInfoReturnable<Boolean> cir)
|
||||
{
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
@ModifyArg(method = "hurt", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;knockback(DDD)V"), index = 0)
|
||||
private double modifyApplyKnockbackArgs(double original)
|
||||
{
|
||||
if(this.source.getEntity() instanceof ProjectileEntity)
|
||||
{
|
||||
if(true)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
double strength = 0;
|
||||
if(strength > 0)
|
||||
{
|
||||
return strength;
|
||||
}
|
||||
}
|
||||
return original;
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@
|
|||
"compatibilityLevel": "JAVA_17",
|
||||
"refmap": "mixins.target.refmap.json",
|
||||
"mixins": [
|
||||
"LivingEntityMixin",
|
||||
"ClientboundSetEntityMotionPacketMixin"
|
||||
],
|
||||
"client": [
|
||||
|
|
Loading…
Add table
Reference in a new issue