use of org.spongepowered.common.interfaces.entity.IMixinGriefer in project SpongeCommon by SpongePowered.
the class MixinEntityWitherSkull method onExplode.
@Redirect(method = "onImpact", at = @At(value = "INVOKE", target = EXPLOSION_TARGET))
protected net.minecraft.world.Explosion onExplode(net.minecraft.world.World worldObj, Entity self, double x, double y, double z, float strength, boolean flaming, boolean smoking) {
boolean griefer = ((IMixinGriefer) this).canGrief();
try (final CauseStackManager.StackFrame frame = Sponge.getCauseStackManager().pushCauseFrame()) {
Sponge.getCauseStackManager().pushCause(this);
Sponge.getCauseStackManager().addContext(EventContextKeys.THROWER, getShooter());
Sponge.getCauseStackManager().pushCause(getShooter());
return detonate(Explosion.builder().location(new Location<>((World) worldObj, new Vector3d(x, y, z))).sourceExplosive(this).radius(this.explosionRadius).canCauseFire(flaming).shouldPlaySmoke(smoking && griefer).shouldBreakBlocks(smoking && griefer)).orElse(null);
}
}
Aggregations