1
0
Fork 0

Disable creeper explosions

This commit is contained in:
Ryan Fox 2022-02-08 10:43:58 -08:00
parent d7c1f5297a
commit ff5774f3cb
Signed by: flewkey
GPG Key ID: 94F56ADFD848851E
3 changed files with 32 additions and 1 deletions

View File

@ -0,0 +1,29 @@
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<? extends CreeperEntity> entityType, World world) {
super((EntityType<? extends HostileEntity>)entityType, world);
}
@Redirect(method = "explode()V", at = @At(value = "INVOKE",
target = "Lnet/minecraft/world/World;createExplosion(Lnet/minecraft/entity/Entity;DDDFLnet/minecraft/world/explosion/Explosion$DestructionType;)Lnet/minecraft/world/explosion/Explosion;"))
private Explosion OnCreeperExplode(World self, Entity entity,
double x, double y, double z, float r,
Explosion.DestructionType destructionType) {
if (Config.getBool("disableCreeperExplosions"))
destructionType = Explosion.DestructionType.NONE;
return self.createExplosion(entity, x, y, z, r, destructionType);
}
}

View File

@ -35,9 +35,10 @@ public class Config {
json = new JSONObject();
}
setDefault("persistentFlight", true);
setDefault("persistentFlight", false);
setDefault("disableFlyCommand", true);
setDefault("disableTntExplosions", false);
setDefault("disableCreeperExplosions", false);
setDefault("disableRespawnAnchorExplosions", false);
setDefault("iphubApiKey", "");
setDefault("spawn", (new PlayerPosition()).getJSON());

View File

@ -3,6 +3,7 @@
"package": "party._2a03.mc.mixin",
"compatibilityLevel": "JAVA_17",
"server": [
"MixinCreeperEntity",
"MixinGameModeCommand",
"MixinPlayerManager",
"MixinRespawnAnchorBlock",