diff --git a/patches/server/Configurable-door-breaking-difficulty.patch b/patches/server/Configurable-door-breaking-difficulty.patch index 7f839bfaa1..1f907b1ce7 100644 --- a/patches/server/Configurable-door-breaking-difficulty.patch +++ b/patches/server/Configurable-door-breaking-difficulty.patch @@ -3,6 +3,7 @@ From: Jake Potrebic Date: Sun, 3 Jan 2021 22:27:43 -0800 Subject: [PATCH] Configurable door breaking difficulty +Co-authored-by: Doc diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -14,21 +15,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public List zombieBreakDoors; + public List vindicatorBreakDoors; ++ private final List> entitiesValidForBreakDoors = Arrays.asList(net.minecraft.world.entity.EntityType.ZOMBIE, net.minecraft.world.entity.EntityType.ZOMBIE_VILLAGER, net.minecraft.world.entity.EntityType.HUSK, net.minecraft.world.entity.EntityType.ZOMBIFIED_PIGLIN, net.minecraft.world.entity.EntityType.VINDICATOR); ++ public java.util.Map, java.util.List> entitiesDifficultyBreakDoors = new it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap<>(); + private void setupEntityBreakingDoors() { -+ zombieBreakDoors = getEnumList( -+ "door-breaking-difficulty.zombie", -+ java.util.Arrays.stream(net.minecraft.world.Difficulty.values()) -+ .filter(net.minecraft.world.entity.monster.Zombie.DOOR_BREAKING_PREDICATE) -+ .collect(Collectors.toList()), -+ net.minecraft.world.Difficulty.class -+ ); -+ vindicatorBreakDoors = getEnumList( -+ "door-breaking-difficulty.vindicator", -+ java.util.Arrays.stream(net.minecraft.world.Difficulty.values()) -+ .filter(net.minecraft.world.entity.monster.Vindicator.DOOR_BREAKING_PREDICATE) -+ .collect(Collectors.toList()), -+ net.minecraft.world.Difficulty.class -+ ); ++ for (net.minecraft.world.entity.EntityType entityType : entitiesValidForBreakDoors) { ++ java.util.function.Predicate difficultyPredicate = net.minecraft.world.entity.monster.Zombie.DOOR_BREAKING_PREDICATE; ++ if (entityType.getBaseClass() == net.minecraft.world.entity.monster.Vindicator.class) { ++ difficultyPredicate = net.minecraft.world.entity.monster.Vindicator.DOOR_BREAKING_PREDICATE; ++ } ++ entitiesDifficultyBreakDoors.put( ++ entityType, ++ getEnumList( ++ "door-breaking-difficulty." + entityType.id, ++ java.util.Arrays.stream(net.minecraft.world.Difficulty.values()) ++ .filter(difficultyPredicate) ++ .collect(Collectors.toList()), ++ net.minecraft.world.Difficulty.class ++ ) ++ ); ++ } + } + public short keepLoadedRange; @@ -43,7 +48,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 ++ super(mob, 6, com.google.common.base.Predicates.in(mob.level.paperConfig.entitiesDifficultyBreakDoors.getOrDefault(mob.getType(), mob.level.paperConfig.entitiesDifficultyBreakDoors.get(EntityType.VINDICATOR)))); // Paper this.setFlags(EnumSet.of(Goal.Flag.MOVE)); } @@ -56,7 +61,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public Zombie(EntityType 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 ++ this.breakDoorGoal = new BreakDoorGoal(this, com.google.common.base.Predicates.in(world.paperConfig.entitiesDifficultyBreakDoors.getOrDefault(type, world.paperConfig.entitiesDifficultyBreakDoors.get(EntityType.ZOMBIE)))); // Paper } public Zombie(Level world) { diff --git a/patches/server/Entity-load-save-limit-per-chunk.patch b/patches/server/Entity-load-save-limit-per-chunk.patch index cb1873520b..e4b1d9c3a0 100644 --- a/patches/server/Entity-load-save-limit-per-chunk.patch +++ b/patches/server/Entity-load-save-limit-per-chunk.patch @@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import org.bukkit.configuration.file.YamlConfiguration; import org.spigotmc.SpigotWorldConfig; @@ -0,0 +0,0 @@ public class PaperWorldConfig { - ); + } } + public Map, Integer> entityPerChunkSaveLimits = new HashMap<>();