package party._2a03.mc.mixin; import net.minecraft.entity.EntityType; import net.minecraft.entity.Entity; import net.minecraft.entity.mob.CreeperEntity; import net.minecraft.entity.mob.HostileEntity; import net.minecraft.world.World; import net.minecraft.world.explosion.Explosion; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.Mixin; import party._2a03.mc.util.Config; @Mixin(CreeperEntity.class) public abstract class MixinCreeperEntity extends HostileEntity { public MixinCreeperEntity(EntityType entityType, World world) { super((EntityType)entityType, world); } @Redirect(method = "explode()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;createExplosion(Lnet/minecraft/entity/Entity;DDDFLnet/minecraft/world/World$ExplosionSourceType;)Lnet/minecraft/world/explosion/Explosion;")) private Explosion OnCreeperExplode(World self, Entity entity, double x, double y, double z, float r, World.ExplosionSourceType explosionSourceType) { if (Config.getBool("disableCreeperExplosions")) explosionSourceType = World.ExplosionSourceType.NONE; return self.createExplosion(entity, x, y, z, r, explosionSourceType); } }