mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
101 lines
5.4 KiB
Diff
101 lines
5.4 KiB
Diff
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
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -0,0 +0,0 @@ import java.util.EnumMap;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
+import java.util.stream.Collectors;
|
|
|
|
import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray.EngineMode;
|
|
+import net.minecraft.server.EntityVindicator;
|
|
+import net.minecraft.server.EntityZombie;
|
|
+import net.minecraft.server.EnumDifficulty;
|
|
import org.bukkit.Bukkit;
|
|
import org.bukkit.Material;
|
|
import org.bukkit.configuration.ConfigurationSection;
|
|
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
|
return config.getString("world-settings." + worldName + "." + path, config.getString("world-settings.default." + path));
|
|
}
|
|
|
|
+ private <T extends Enum<T>> List<T> getEnumList(String path, List<T> def, Class<T> type) {
|
|
+ config.addDefault("world-settings.default." + path, def.stream().map(Enum::name).collect(Collectors.toList()));
|
|
+ return ((List<String>) (config.getList("world-settings." + worldName + "." + path, config.getList("world-settings.default." + path)))).stream().map(s -> Enum.valueOf(type, s)).collect(Collectors.toList());
|
|
+ }
|
|
+
|
|
public int cactusMaxHeight;
|
|
public int reedMaxHeight;
|
|
public int bambooMaxHeight;
|
|
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
|
private void disableMobSpawnerSpawnEggTransformation() {
|
|
disableMobSpawnerSpawnEggTransformation = getBoolean("game-mechanics.disable-mob-spawner-spawn-egg-transformation", disableMobSpawnerSpawnEggTransformation);
|
|
}
|
|
+
|
|
+ public List<EnumDifficulty> zombieBreakDoors;
|
|
+ public List<EnumDifficulty> vindicatorBreakDoors;
|
|
+ private void setupEntityBreakingDoors() {
|
|
+ zombieBreakDoors = getEnumList(
|
|
+ "door-breaking-difficulty.zombie",
|
|
+ Arrays.stream(EnumDifficulty.values())
|
|
+ .filter(EntityZombie.getDoorBreakingPredicate())
|
|
+ .collect(Collectors.toList()),
|
|
+ EnumDifficulty.class
|
|
+ );
|
|
+ vindicatorBreakDoors = getEnumList(
|
|
+ "door-breaking-difficulty.vindicator",
|
|
+ Arrays.stream(EnumDifficulty.values())
|
|
+ .filter(EntityVindicator.getDoorBreakingPredicate())
|
|
+ .collect(Collectors.toList()),
|
|
+ EnumDifficulty.class
|
|
+ );
|
|
+ }
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/EntityVindicator.java b/src/main/java/net/minecraft/server/EntityVindicator.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityVindicator.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityVindicator.java
|
|
@@ -0,0 +0,0 @@ import javax.annotation.Nullable;
|
|
|
|
public class EntityVindicator extends EntityIllagerAbstract {
|
|
|
|
+ public static final Predicate<EnumDifficulty> getDoorBreakingPredicate() { return b; } // Paper - OBFHELPER
|
|
private static final Predicate<EnumDifficulty> b = (enumdifficulty) -> {
|
|
return enumdifficulty == EnumDifficulty.NORMAL || enumdifficulty == EnumDifficulty.HARD;
|
|
};
|
|
@@ -0,0 +0,0 @@ public class EntityVindicator extends EntityIllagerAbstract {
|
|
static class a extends PathfinderGoalBreakDoor {
|
|
|
|
public a(EntityInsentient entityinsentient) {
|
|
- super(entityinsentient, 6, EntityVindicator.b);
|
|
+ super(entityinsentient, 6, com.google.common.base.Predicates.in(entityinsentient.world.paperConfig.vindicatorBreakDoors)); // Paper
|
|
this.a(EnumSet.of(PathfinderGoal.Type.MOVE));
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityZombie.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
|
|
@@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster {
|
|
private static final DataWatcherObject<Boolean> d = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i);
|
|
private static final DataWatcherObject<Integer> bo = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.b);
|
|
public static final DataWatcherObject<Boolean> DROWN_CONVERTING = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i);
|
|
+ public static final Predicate<EnumDifficulty> getDoorBreakingPredicate() { return bq; } // Paper - OBFHELPER
|
|
private static final Predicate<EnumDifficulty> bq = (enumdifficulty) -> {
|
|
return enumdifficulty == EnumDifficulty.HARD;
|
|
};
|
|
@@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster {
|
|
|
|
public EntityZombie(EntityTypes<? extends EntityZombie> entitytypes, World world) {
|
|
super(entitytypes, world);
|
|
- this.br = new PathfinderGoalBreakDoor(this, EntityZombie.bq);
|
|
+ this.br = new PathfinderGoalBreakDoor(this, com.google.common.base.Predicates.in(world.paperConfig.zombieBreakDoors)); // Paper
|
|
}
|
|
|
|
public EntityZombie(World world) {
|