mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Add enderman and creeper griefing controls
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
From 8fb8e949daeebc6eeed7beef40512ed1319444a4 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sun, 26 Apr 2020 16:28:38 -0500
|
||||
Subject: [PATCH] Add enderman and creeper griefing controls
|
||||
|
||||
---
|
||||
src/main/java/net/minecraft/server/EntityCreeper.java | 2 +-
|
||||
src/main/java/net/minecraft/server/EntityEnderman.java | 2 ++
|
||||
src/main/java/net/pl3x/purpur/PurpurWorldConfig.java | 4 ++++
|
||||
3 files changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java
|
||||
index ce366f401..93efc7977 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityCreeper.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityCreeper.java
|
||||
@@ -237,7 +237,7 @@ public class EntityCreeper extends EntityMonster {
|
||||
|
||||
public void explode() {
|
||||
if (!this.world.isClientSide) {
|
||||
- Explosion.Effect explosion_effect = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING) ? Explosion.Effect.DESTROY : Explosion.Effect.NONE;
|
||||
+ Explosion.Effect explosion_effect = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING) && world.purpurConfig.creeperAllowGriefing ? Explosion.Effect.DESTROY : Explosion.Effect.NONE; // Purpur
|
||||
float f = this.isPowered() ? 2.0F : 1.0F;
|
||||
|
||||
// CraftBukkit start
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java
|
||||
index de30ce483..68165d72d 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
|
||||
@@ -354,6 +354,7 @@ public class EntityEnderman extends EntityMonster {
|
||||
|
||||
@Override
|
||||
public boolean a() {
|
||||
+ if (!enderman.world.purpurConfig.endermanAllowGriefing) return false; // Purpur
|
||||
return this.enderman.getCarried() != null ? false : (!this.enderman.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING) ? false : this.enderman.getRandom().nextInt(20) == 0);
|
||||
}
|
||||
|
||||
@@ -397,6 +398,7 @@ public class EntityEnderman extends EntityMonster {
|
||||
|
||||
@Override
|
||||
public boolean a() {
|
||||
+ if (!getEnderman().world.purpurConfig.endermanAllowGriefing) return false; // Purpur
|
||||
return this.a.getCarried() == null ? false : (!this.a.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING) ? false : this.a.getRandom().nextInt(2000) == 0);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index d98cf3bd9..2a81fed03 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -418,11 +418,13 @@ public class PurpurWorldConfig {
|
||||
public boolean creeperRidableInWater = false;
|
||||
public boolean creeperRequireShiftToMount = true;
|
||||
public double creeperChargedChance = 0.0D;
|
||||
+ public boolean creeperAllowGriefing = true;
|
||||
private void creeperSettings() {
|
||||
creeperRidable = getBoolean("mobs.creeper.ridable", creeperRidable);
|
||||
creeperRidableInWater = getBoolean("mobs.creeper.ridable-in-water", creeperRidableInWater);
|
||||
creeperRequireShiftToMount = getBoolean("mobs.creeper.require-shift-to-mount", creeperRequireShiftToMount);
|
||||
creeperChargedChance = getDouble("mobs.creeper.naturally-charged-chance", creeperChargedChance);
|
||||
+ creeperAllowGriefing = getBoolean("mobs.creeper.allow-griefing", creeperAllowGriefing);
|
||||
}
|
||||
|
||||
public boolean dolphinRidable = false;
|
||||
@@ -487,10 +489,12 @@ public class PurpurWorldConfig {
|
||||
public boolean endermanRidable = false;
|
||||
public boolean endermanRidableInWater = false;
|
||||
public boolean endermanRequireShiftToMount = true;
|
||||
+ public boolean endermanAllowGriefing = true;
|
||||
private void endermanSettings() {
|
||||
endermanRidable = getBoolean("mobs.enderman.ridable", endermanRidable);
|
||||
endermanRidableInWater = getBoolean("mobs.enderman.ridable-in-water", endermanRidableInWater);
|
||||
endermanRequireShiftToMount = getBoolean("mobs.enderman.require-shift-to-mount", endermanRequireShiftToMount);
|
||||
+ endermanAllowGriefing = getBoolean("mobs.enderman.allow-griefing", endermanAllowGriefing);
|
||||
}
|
||||
|
||||
public boolean endermiteRidable = false;
|
||||
--
|
||||
2.24.0
|
||||
|
||||
Reference in New Issue
Block a user