mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 17:07:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: 12dec20 Bump paerweight to 1.1.7 e33ed89 Get short commit ref using a more proper method 7d6147d Remove now unneeded patch due to paperweight 1.1.7 e72fa41 Update task dependency for includeMappings so the new task isn't skipped 0ad5526 Trim whitspace off of git hash (oops) Tuinity Changes: e878ba9 Update paper 2bd2849 Bring back fix codec spam patch
70 lines
3.7 KiB
Diff
70 lines
3.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
|
Date: Fri, 27 Nov 2020 10:33:33 -0600
|
|
Subject: [PATCH] Zombie break door minimum difficulty option
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java
|
|
index fe045f8e35fe2aac51032a67ce52b27a53a8eff0..03bc86c776596ca5964c22adb757115d60980311 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java
|
|
@@ -7,6 +7,8 @@ import net.minecraft.world.entity.Mob;
|
|
import net.minecraft.world.level.GameRules;
|
|
import net.minecraft.world.level.block.Block;
|
|
|
|
+import static net.minecraft.world.Difficulty.*; // Purpur
|
|
+
|
|
public class BreakDoorGoal extends DoorInteractGoal {
|
|
|
|
private static final int DEFAULT_DOOR_BREAK_TIME = 240;
|
|
@@ -19,7 +21,7 @@ public class BreakDoorGoal extends DoorInteractGoal {
|
|
super(mob);
|
|
this.lastBreakProgress = -1;
|
|
this.doorBreakTime = -1;
|
|
- this.validDifficulties = difficultySufficientPredicate;
|
|
+ this.validDifficulties = mob instanceof net.minecraft.world.entity.monster.Zombie ? difficulty -> testDifficulty(mob) : difficultySufficientPredicate; // Purpur
|
|
}
|
|
|
|
public BreakDoorGoal(Mob mob, int maxProgress, Predicate<Difficulty> difficultySufficientPredicate) {
|
|
@@ -88,4 +90,16 @@ public class BreakDoorGoal extends DoorInteractGoal {
|
|
private boolean isValidDifficulty(Difficulty difficulty) {
|
|
return this.validDifficulties.test(difficulty);
|
|
}
|
|
+
|
|
+ // Purpur start
|
|
+ private boolean testDifficulty(Mob entity) {
|
|
+ Difficulty d = entity.level.getDifficulty();
|
|
+ return switch (entity.level.purpurConfig.zombieBreakDoorMinDifficulty) {
|
|
+ case PEACEFUL -> d == HARD || d == NORMAL || d == EASY || d == PEACEFUL;
|
|
+ case EASY -> d == HARD || d == NORMAL || d == EASY;
|
|
+ case NORMAL -> d == HARD || d == NORMAL;
|
|
+ default -> d == HARD;
|
|
+ };
|
|
+ }
|
|
+ // Purpur end
|
|
}
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index aaca5c8007ce8a33ecec0b9ff057c59a4c2778a3..ef742c14be5920db31fb291f1b93b671c5f59e30 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -1760,6 +1760,7 @@ public class PurpurWorldConfig {
|
|
public double zombieJockeyChance = 0.05D;
|
|
public boolean zombieJockeyTryExistingChickens = true;
|
|
public boolean zombieAggressiveTowardsVillagerWhenLagging = true;
|
|
+ public Difficulty zombieBreakDoorMinDifficulty = Difficulty.HARD;
|
|
private void zombieSettings() {
|
|
zombieRidable = getBoolean("mobs.zombie.ridable", zombieRidable);
|
|
zombieRidableInWater = getBoolean("mobs.zombie.ridable-in-water", zombieRidableInWater);
|
|
@@ -1774,6 +1775,11 @@ public class PurpurWorldConfig {
|
|
zombieJockeyChance = getDouble("mobs.zombie.jockey.chance", zombieJockeyChance);
|
|
zombieJockeyTryExistingChickens = getBoolean("mobs.zombie.jockey.try-existing-chickens", zombieJockeyTryExistingChickens);
|
|
zombieAggressiveTowardsVillagerWhenLagging = getBoolean("mobs.zombie.aggressive-towards-villager-when-lagging", zombieAggressiveTowardsVillagerWhenLagging);
|
|
+ try {
|
|
+ zombieBreakDoorMinDifficulty = Difficulty.valueOf(getString("mobs.zombie.break-door-minimum-difficulty", zombieBreakDoorMinDifficulty.name()));
|
|
+ } catch (IllegalArgumentException ignore) {
|
|
+ zombieBreakDoorMinDifficulty = Difficulty.HARD;
|
|
+ }
|
|
}
|
|
|
|
public boolean zombieHorseRidableInWater = false;
|