2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
|
|
Date: Sun, 3 Jan 2021 22:27:43 -0800
|
|
|
|
Subject: [PATCH] Configurable door breaking difficulty
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2021-11-25 12:20:13 +01:00
|
|
|
index 53681d342935feb4d0f0428df751a4f8004e783e..ad355eaf5e597be9c35fbf0a635944b16603bdc2 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2021-11-24 18:58:26 +01:00
|
|
|
@@ -6,6 +6,9 @@ import java.util.stream.Collectors;
|
2021-11-09 08:59:15 +01:00
|
|
|
import it.unimi.dsi.fastutil.objects.Reference2IntMap;
|
|
|
|
import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap;
|
|
|
|
import net.minecraft.world.entity.MobCategory;
|
2021-06-11 14:02:28 +02:00
|
|
|
+import net.minecraft.world.Difficulty;
|
|
|
|
+import net.minecraft.world.entity.monster.Vindicator;
|
|
|
|
+import net.minecraft.world.entity.monster.Zombie;
|
|
|
|
import org.bukkit.Bukkit;
|
2021-06-15 15:20:52 +02:00
|
|
|
import org.bukkit.configuration.file.YamlConfiguration;
|
2021-11-24 18:58:26 +01:00
|
|
|
import org.spigotmc.SpigotWorldConfig;
|
|
|
|
@@ -107,6 +110,25 @@ public class PaperWorldConfig {
|
2021-06-11 14:02:28 +02:00
|
|
|
disableMobSpawnerSpawnEggTransformation = getBoolean("game-mechanics.disable-mob-spawner-spawn-egg-transformation", disableMobSpawnerSpawnEggTransformation);
|
|
|
|
}
|
2021-06-14 21:17:47 +02:00
|
|
|
|
2021-06-11 14:02:28 +02:00
|
|
|
+ public List<Difficulty> zombieBreakDoors;
|
|
|
|
+ public List<Difficulty> vindicatorBreakDoors;
|
|
|
|
+ private void setupEntityBreakingDoors() {
|
|
|
|
+ zombieBreakDoors = getEnumList(
|
|
|
|
+ "door-breaking-difficulty.zombie",
|
2021-06-14 21:17:47 +02:00
|
|
|
+ java.util.Arrays.stream(Difficulty.values())
|
|
|
|
+ .filter(Zombie.DOOR_BREAKING_PREDICATE)
|
2021-06-11 14:02:28 +02:00
|
|
|
+ .collect(Collectors.toList()),
|
|
|
|
+ Difficulty.class
|
|
|
|
+ );
|
|
|
|
+ vindicatorBreakDoors = getEnumList(
|
|
|
|
+ "door-breaking-difficulty.vindicator",
|
2021-06-14 21:17:47 +02:00
|
|
|
+ java.util.Arrays.stream(Difficulty.values())
|
|
|
|
+ .filter(Vindicator.DOOR_BREAKING_PREDICATE)
|
2021-06-11 14:02:28 +02:00
|
|
|
+ .collect(Collectors.toList()),
|
|
|
|
+ Difficulty.class
|
|
|
|
+ );
|
|
|
|
+ }
|
2021-06-14 21:17:47 +02:00
|
|
|
+
|
|
|
|
public short keepLoadedRange;
|
|
|
|
private void keepLoadedRange() {
|
|
|
|
keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16);
|
2021-06-11 14:02:28 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
|
2021-11-24 18:58:26 +01:00
|
|
|
index ddf77350b1762be523eeed760669bc33f634109f..85294ab8eaa654be9358f489cec7e1ae665fc34b 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
|
2021-06-14 21:17:47 +02:00
|
|
|
@@ -195,7 +195,7 @@ public class Vindicator extends AbstractIllager {
|
2021-06-11 14:02:28 +02:00
|
|
|
|
2021-06-14 21:17:47 +02:00
|
|
|
static class VindicatorBreakDoorGoal extends BreakDoorGoal {
|
2021-06-11 14:02:28 +02:00
|
|
|
public VindicatorBreakDoorGoal(Mob mob) {
|
|
|
|
- super(mob, 6, Vindicator.DOOR_BREAKING_PREDICATE);
|
|
|
|
+ super(mob, 6, com.google.common.base.Predicates.in(mob.level.paperConfig.vindicatorBreakDoors)); // Paper
|
|
|
|
this.setFlags(EnumSet.of(Goal.Flag.MOVE));
|
|
|
|
}
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
2021-11-24 18:58:26 +01:00
|
|
|
index 64222cced10e87438ee3ada26aead0284649be78..e72e9b748b3f3e34baddf01366c703efba50c67c 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
2021-11-24 18:58:26 +01:00
|
|
|
@@ -97,7 +97,7 @@ public class Zombie extends Monster {
|
2021-06-11 14:02:28 +02:00
|
|
|
|
|
|
|
public Zombie(EntityType<? extends Zombie> type, Level world) {
|
|
|
|
super(type, world);
|
|
|
|
- this.breakDoorGoal = new BreakDoorGoal(this, Zombie.DOOR_BREAKING_PREDICATE);
|
|
|
|
+ this.breakDoorGoal = new BreakDoorGoal(this, com.google.common.base.Predicates.in(world.paperConfig.zombieBreakDoors)); // Paper
|
|
|
|
}
|
|
|
|
|
|
|
|
public Zombie(Level world) {
|