geforkt von Mirrors/Paper
Improve configurable door difficulty (#6985)
Dieser Commit ist enthalten in:
Ursprung
9434fcde82
Commit
2b68eb27b1
@ -3,6 +3,7 @@ From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sun, 3 Jan 2021 22:27:43 -0800
|
||||
Subject: [PATCH] Configurable door breaking difficulty
|
||||
|
||||
Co-authored-by: Doc <nachito94@msn.com>
|
||||
|
||||
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<net.minecraft.world.Difficulty> zombieBreakDoors;
|
||||
+ public List<net.minecraft.world.Difficulty> vindicatorBreakDoors;
|
||||
+ private final List<net.minecraft.world.entity.EntityType<?>> 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<net.minecraft.world.entity.EntityType<?>, java.util.List<net.minecraft.world.Difficulty>> 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<net.minecraft.world.Difficulty> 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<? 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
|
||||
+ 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) {
|
||||
|
@ -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<net.minecraft.world.entity.EntityType<?>, Integer> entityPerChunkSaveLimits = new HashMap<>();
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren