mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
76 lines
4.6 KiB
Diff
76 lines
4.6 KiB
Diff
From 0000000000000000000000000000000000000000 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
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/Creeper.java b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
|
|
index a878693fe74f1509b4d3ba5199a7b7f1dac4b8d1..f7b1d2cb0ba544aa4aec7d87d21335e9fcca6127 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
|
|
@@ -344,7 +344,7 @@ public class Creeper extends Monster implements PowerableMob {
|
|
|
|
public void explodeCreeper() {
|
|
if (!this.level.isClientSide) {
|
|
- Explosion.BlockInteraction explosion_effect = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.NONE;
|
|
+ Explosion.BlockInteraction explosion_effect = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && level.purpurConfig.creeperAllowGriefing ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.NONE; // Purpur
|
|
float f = this.isPowered() ? 2.0F : 1.0F;
|
|
|
|
// CraftBukkit start
|
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
|
index 66ff0e3aa1a7dfb233a459516c4c596c1bbe033e..71b472e3fefe549fe959fda1702213bac3c3e7d4 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
|
@@ -499,6 +499,7 @@ public class EnderMan extends Monster implements NeutralMob {
|
|
|
|
@Override
|
|
public boolean canUse() {
|
|
+ if (!enderman.level.purpurConfig.endermanAllowGriefing) return false; // Purpur
|
|
return this.enderman.getCarriedBlock() == null ? false : (!this.enderman.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? false : this.enderman.getRandom().nextInt(reducedTickDelay(2000)) == 0);
|
|
}
|
|
|
|
@@ -546,6 +547,7 @@ public class EnderMan extends Monster implements NeutralMob {
|
|
|
|
@Override
|
|
public boolean canUse() {
|
|
+ if (!enderman.level.purpurConfig.endermanAllowGriefing) return false; // Purpur
|
|
return this.enderman.getCarriedBlock() != null ? false : (!this.enderman.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? false : this.enderman.getRandom().nextInt(reducedTickDelay(20)) == 0);
|
|
}
|
|
|
|
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
index df553af2e0a7c9b411a2ba0ed2fd530a537e4bcd..ea072b32e1c92424d6e1cee5a92c86e460e11c5d 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -387,6 +387,7 @@ public class PurpurWorldConfig {
|
|
public boolean creeperRidableInWater = false;
|
|
public double creeperMaxHealth = 20.0D;
|
|
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);
|
|
@@ -397,6 +398,7 @@ public class PurpurWorldConfig {
|
|
}
|
|
creeperMaxHealth = getDouble("mobs.creeper.attributes.max_health", creeperMaxHealth);
|
|
creeperChargedChance = getDouble("mobs.creeper.naturally-charged-chance", creeperChargedChance);
|
|
+ creeperAllowGriefing = getBoolean("mobs.creeper.allow-griefing", creeperAllowGriefing);
|
|
}
|
|
|
|
public boolean dolphinRidable = false;
|
|
@@ -494,6 +496,7 @@ public class PurpurWorldConfig {
|
|
public boolean endermanRidable = false;
|
|
public boolean endermanRidableInWater = false;
|
|
public double endermanMaxHealth = 40.0D;
|
|
+ public boolean endermanAllowGriefing = true;
|
|
private void endermanSettings() {
|
|
endermanRidable = getBoolean("mobs.enderman.ridable", endermanRidable);
|
|
endermanRidableInWater = getBoolean("mobs.enderman.ridable-in-water", endermanRidableInWater);
|
|
@@ -503,6 +506,7 @@ public class PurpurWorldConfig {
|
|
set("mobs.enderman.attributes.max_health", oldValue);
|
|
}
|
|
endermanMaxHealth = getDouble("mobs.enderman.attributes.max_health", endermanMaxHealth);
|
|
+ endermanAllowGriefing = getBoolean("mobs.enderman.allow-griefing", endermanAllowGriefing);
|
|
}
|
|
|
|
public boolean endermiteRidable = false;
|