disable fireballs from ghasts aswell
This commit is contained in:
parent
b5f0ce1981
commit
821f1ac044
|
@ -0,0 +1,17 @@
|
|||
package zone.oat.disableharmfulmobgriefs.mixin;
|
||||
|
||||
import net.minecraft.entity.projectile.FireballEntity;
|
||||
import net.minecraft.world.GameRules;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(FireballEntity.class)
|
||||
public class DisableFireball {
|
||||
// the explode function references `.getGameRules().getBoolean(GameRules.DO_MOB_GRIEFING)`
|
||||
// we simply redirect it to a "false", making it always believe the gamerule is off - meaning it *doesn't* to mob griefing
|
||||
@Redirect(method = "onCollision", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/GameRules;getBoolean(Lnet/minecraft/world/GameRules$Key;)Z"))
|
||||
private boolean injected(GameRules instance, GameRules.Key<GameRules.BooleanRule> rule) {
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -4,7 +4,8 @@
|
|||
"package": "zone.oat.disableharmfulmobgriefs.mixin",
|
||||
"compatibilityLevel": "JAVA_16",
|
||||
"mixins": [
|
||||
"DisableCreeperExplosion"
|
||||
"DisableCreeperExplosion",
|
||||
"DisableFireball"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
|
Loading…
Reference in New Issue