Capture lightningBolt.

This commit is contained in:
IzzelAliz 2020-06-17 13:48:57 +08:00
parent 595e927ebf
commit 83085ec4f4

View File

@ -3,6 +3,7 @@ package io.izzel.arclight.common.mixin.core.entity.effect;
import io.izzel.arclight.common.mixin.core.entity.EntityMixin; import io.izzel.arclight.common.mixin.core.entity.EntityMixin;
import io.izzel.arclight.common.mod.util.ArclightCaptures; import io.izzel.arclight.common.mod.util.ArclightCaptures;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.effect.LightningBoltEntity; import net.minecraft.entity.effect.LightningBoltEntity;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -30,6 +31,11 @@ public abstract class LightningBoltEntityMixin extends EntityMixin {
this.isSilent = false; this.isSilent = false;
} }
@Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;onStruckByLightning(Lnet/minecraft/entity/effect/LightningBoltEntity;)V"))
private void arclight$captureEntity(CallbackInfo ci) {
ArclightCaptures.captureDamageEventEntity((Entity) (Object) this);
}
@Inject(method = "tick", at = @At(value = "INVOKE", shift = At.Shift.AFTER, target = "Lnet/minecraft/entity/Entity;onStruckByLightning(Lnet/minecraft/entity/effect/LightningBoltEntity;)V")) @Inject(method = "tick", at = @At(value = "INVOKE", shift = At.Shift.AFTER, target = "Lnet/minecraft/entity/Entity;onStruckByLightning(Lnet/minecraft/entity/effect/LightningBoltEntity;)V"))
private void arclight$resetEntity(CallbackInfo ci) { private void arclight$resetEntity(CallbackInfo ci) {
ArclightCaptures.captureDamageEventEntity(null); ArclightCaptures.captureDamageEventEntity(null);