Files
Purpur/patches/server/0058-Add-enderman-and-creeper-griefing-controls.patch
BillyGalbreath 296267da93 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
eb11845f8 Fix creating worlds with "invalid" names (Fixes #5331)
e4d8a6279 Implement Keyed on World
bcb63dab7 [CI-SKIP] [Auto] Rebuild Patches
48342b06c Allow signs that are inside of the spawn protection to be right clicked to use their run_command tag
c229f90c1 Add Block#isValidTool
20e709c1d Add recipe to cook events
2dcf8bff4 legacy formatting will be the death of me
f597fea0d legacy formatting is worse than walking around in wet socks
7f72c4675 Use implementation-provided legacy serializer for events
27a8d99ec Adventure 4.7.0
e65bd35a1 Respect teams in legacy chat name if configured (#5321)
b31089a92 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5325)
a52b30814 Fix title swapping fadeIn and stay
54ec85949 Prevent grindstones from overstacking items
d7795080c Fix NPE for AIR in meta operations in ItemStack
2e70796c7 [CI-SKIP] Improve documentation of PreCreatureSpawnEvent (#5244)
7bb92e750 [CI-SKIP] Add JavaDoc links to Tag class pointing to custom Paper tags (#5285)
28cd686bf fix per-world difficulty command (#5306)
be7cde2c7 [CI-SKIP] Always check PATH for JDK (#5315)
2021-03-09 17:52:38 -06:00

76 lines
4.2 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/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java
index ff80ac7db73b7c7dd6ac62ac128af1cab961d075..36bf307985624a3567eb1196e034470bd7002e1e 100644
--- a/src/main/java/net/minecraft/server/EntityCreeper.java
+++ b/src/main/java/net/minecraft/server/EntityCreeper.java
@@ -216,7 +216,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 f53525eb32a6096ae24fd23756b2169d5d39e9d4..7b175240e44b0c7eb5044d7bcaf54dac22f50f2a 100644
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
@@ -369,6 +369,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable {
@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);
}
@@ -402,7 +403,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable {
static class PathfinderGoalEndermanPlaceBlock extends PathfinderGoal {
- private final EntityEnderman a;
+ private final EntityEnderman a; public EntityEnderman getEnderman() { return a; } // Purpur - OBFHELPER
public PathfinderGoalEndermanPlaceBlock(EntityEnderman entityenderman) {
this.a = entityenderman;
@@ -410,6 +411,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable {
@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 4a0bbc0cd41b4a50ebad9b4569e07d727fc3e482..236b4f51ea805c671b905c1b081538b67cee7f57 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -191,8 +191,10 @@ public class PurpurWorldConfig {
cowFeedMushrooms = getInt("mobs.cow.feed-mushrooms-for-mooshroom", cowFeedMushrooms);
}
+ public boolean creeperAllowGriefing = true;
public double creeperChargedChance = 0.0D;
private void creeperSettings() {
+ creeperAllowGriefing = getBoolean("mobs.creeper.allow-griefing", creeperAllowGriefing);
creeperChargedChance = getDouble("mobs.creeper.naturally-charged-chance", creeperChargedChance);
}
@@ -201,6 +203,11 @@ public class PurpurWorldConfig {
enderDragonAlwaysDropsFullExp = getBoolean("mobs.ender_dragon.always-drop-full-exp", enderDragonAlwaysDropsFullExp);
}
+ public boolean endermanAllowGriefing = true;
+ private void endermanSettings() {
+ endermanAllowGriefing = getBoolean("mobs.enderman.allow-griefing", endermanAllowGriefing);
+ }
+
public boolean foxTypeChangesWithTulips = false;
private void foxSettings() {
foxTypeChangesWithTulips = getBoolean("mobs.fox.tulips-change-type", foxTypeChangesWithTulips);