mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-28 03:01:31 +01:00
Port Anti-Xray to 1.18 (#6947)
This commit is contained in:
parent
9403115c81
commit
0f6ca558f1
@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
expMergeMaxValue = getInt("experience-merge-max-value", -1);
|
||||
log("Experience Merge Max Value: " + expMergeMaxValue);
|
||||
delayChunkUnloadsBy *= 20;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ public boolean allowUsingSignsInsideSpawnProtection = false;
|
||||
|
1638
patches/server/Anti-Xray.patch
Normal file
1638
patches/server/Anti-Xray.patch
Normal file
File diff suppressed because it is too large
Load Diff
@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
public static final Codec<PalettedContainer<BlockState>> BLOCK_STATE_CODEC = PalettedContainer.codec(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState());
|
||||
public static final Codec<PalettedContainer<BlockState>> BLOCK_STATE_CODEC = PalettedContainer.codec(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState(), null); // Paper - Anti-Xray - Add preset block states
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -0,0 +0,0 @@ public class ChunkSerializer {
|
||||
nbttagcompound.putInt("xPos", chunkcoordintpair.x);
|
||||
|
@ -8,36 +8,26 @@ diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/m
|
||||
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.stream.Collectors;
|
||||
import it.unimi.dsi.fastutil.objects.Reference2IntMap;
|
||||
import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap;
|
||||
import net.minecraft.world.entity.MobCategory;
|
||||
+import net.minecraft.world.Difficulty;
|
||||
+import net.minecraft.world.entity.monster.Vindicator;
|
||||
+import net.minecraft.world.entity.monster.Zombie;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.spigotmc.SpigotWorldConfig;
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
disableMobSpawnerSpawnEggTransformation = getBoolean("game-mechanics.disable-mob-spawner-spawn-egg-transformation", disableMobSpawnerSpawnEggTransformation);
|
||||
}
|
||||
|
||||
+ public List<Difficulty> zombieBreakDoors;
|
||||
+ public List<Difficulty> vindicatorBreakDoors;
|
||||
+ public List<net.minecraft.world.Difficulty> zombieBreakDoors;
|
||||
+ public List<net.minecraft.world.Difficulty> vindicatorBreakDoors;
|
||||
+ private void setupEntityBreakingDoors() {
|
||||
+ zombieBreakDoors = getEnumList(
|
||||
+ "door-breaking-difficulty.zombie",
|
||||
+ java.util.Arrays.stream(Difficulty.values())
|
||||
+ .filter(Zombie.DOOR_BREAKING_PREDICATE)
|
||||
+ java.util.Arrays.stream(net.minecraft.world.Difficulty.values())
|
||||
+ .filter(net.minecraft.world.entity.monster.Zombie.DOOR_BREAKING_PREDICATE)
|
||||
+ .collect(Collectors.toList()),
|
||||
+ Difficulty.class
|
||||
+ net.minecraft.world.Difficulty.class
|
||||
+ );
|
||||
+ vindicatorBreakDoors = getEnumList(
|
||||
+ "door-breaking-difficulty.vindicator",
|
||||
+ java.util.Arrays.stream(Difficulty.values())
|
||||
+ .filter(Vindicator.DOOR_BREAKING_PREDICATE)
|
||||
+ java.util.Arrays.stream(net.minecraft.world.Difficulty.values())
|
||||
+ .filter(net.minecraft.world.entity.monster.Vindicator.DOOR_BREAKING_PREDICATE)
|
||||
+ .collect(Collectors.toList()),
|
||||
+ Difficulty.class
|
||||
+ net.minecraft.world.Difficulty.class
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
|
@ -21,9 +21,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
lightQueueSize = getInt("light-queue-size", lightQueueSize);
|
||||
expMergeMaxValue = getInt("experience-merge-max-value", -1);
|
||||
log("Experience Merge Max Value: " + expMergeMaxValue);
|
||||
}
|
||||
|
||||
+
|
||||
+ public long delayChunkUnloadsBy;
|
||||
+ private void delayChunkUnloadsBy() {
|
||||
+ delayChunkUnloadsBy = PaperConfig.getSeconds(getString("delay-chunk-unloads-by", "10s"));
|
||||
@ -32,10 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ delayChunkUnloadsBy *= 20;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
public boolean altItemDespawnRateEnabled;
|
||||
public java.util.Map<org.bukkit.Material, Integer> altItemDespawnRateMap;
|
||||
private void altItemDespawnRate() {
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/DistanceManager.java
|
||||
|
@ -12,22 +12,20 @@ diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/m
|
||||
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.stream.Collectors;
|
||||
import it.unimi.dsi.fastutil.objects.Reference2IntMap;
|
||||
@@ -0,0 +0,0 @@ import it.unimi.dsi.fastutil.objects.Reference2IntMap;
|
||||
import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap;
|
||||
import net.minecraft.world.entity.MobCategory;
|
||||
import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray.EngineMode;
|
||||
+import java.util.HashMap;
|
||||
+import java.util.Map;
|
||||
import net.minecraft.world.Difficulty;
|
||||
+import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.monster.Vindicator;
|
||||
import net.minecraft.world.entity.monster.Zombie;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.spigotmc.SpigotWorldConfig;
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
);
|
||||
}
|
||||
|
||||
+ public Map<EntityType<?>, Integer> entityPerChunkSaveLimits = new HashMap<>();
|
||||
+ public Map<net.minecraft.world.entity.EntityType<?>, Integer> entityPerChunkSaveLimits = new HashMap<>();
|
||||
+ private void entityPerChunkSaveLimits() {
|
||||
+ getInt("entity-per-chunk-save-limit.experience_orb", -1);
|
||||
+ getInt("entity-per-chunk-save-limit.snowball", -1);
|
||||
@ -40,13 +38,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ addEntityPerChunkSaveLimitsFromSection(config.getConfigurationSection("world-settings." + worldName + ".entity-per-chunk-save-limit"), entityPerChunkSaveLimits);
|
||||
+ }
|
||||
+
|
||||
+ private static void addEntityPerChunkSaveLimitsFromSection(final org.bukkit.configuration.ConfigurationSection section, final Map<EntityType<?>, Integer> limitMap) {
|
||||
+ private static void addEntityPerChunkSaveLimitsFromSection(final org.bukkit.configuration.ConfigurationSection section, final Map<net.minecraft.world.entity.EntityType<?>, Integer> limitMap) {
|
||||
+ if (section == null) {
|
||||
+ return;
|
||||
+ }
|
||||
+ for (final String key : section.getKeys(false)) {
|
||||
+ final int value = section.getInt(key);
|
||||
+ final EntityType<?> type = EntityType.byString(key).orElse(null);
|
||||
+ final net.minecraft.world.entity.EntityType<?> type = net.minecraft.world.entity.EntityType.byString(key).orElse(null);
|
||||
+ if (type == null) {
|
||||
+ logError("Invalid entity-per-chunk-save-limit config, '" + key+ "' is not a valid entity type. Correct this in paper.yml.");
|
||||
+ continue;
|
||||
|
@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
private void lightQueueSize() {
|
||||
lightQueueSize = getInt("light-queue-size", lightQueueSize);
|
||||
Bukkit.getLogger().warning("You have enabled permission-based Anti-Xray checking - depending on your permission plugin, this may cause performance issues");
|
||||
}
|
||||
}
|
||||
-}
|
||||
|
||||
|
@ -284,7 +284,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ // Paper end - optimise checkDespawn
|
||||
|
||||
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, final DimensionType dimensionmanager, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env) {
|
||||
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, final DimensionType dimensionmanager, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor
|
||||
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
||||
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
|
@ -22,8 +22,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ splitOverstackedLoot = getBoolean("split-overstacked-loot", splitOverstackedLoot);
|
||||
+ }
|
||||
+
|
||||
private Table<String, String, Integer> sensorTickRates;
|
||||
private Table<String, String, Integer> behaviorTickRates;
|
||||
private com.google.common.collect.Table<String, String, Integer> sensorTickRates;
|
||||
private com.google.common.collect.Table<String, String, Integer> behaviorTickRates;
|
||||
private void tickRates() {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
|
@ -31,20 +31,12 @@ diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/m
|
||||
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 it.unimi.dsi.fastutil.objects.Reference2IntMap;
|
||||
import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap;
|
||||
@@ -0,0 +0,0 @@ import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap;
|
||||
import net.minecraft.world.entity.MobCategory;
|
||||
import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray.EngineMode;
|
||||
import java.util.HashMap;
|
||||
+import java.util.Locale;
|
||||
import java.util.Map;
|
||||
+
|
||||
+import com.google.common.collect.HashBasedTable;
|
||||
+import com.google.common.collect.Table;
|
||||
import net.minecraft.world.Difficulty;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.monster.Vindicator;
|
||||
import net.minecraft.world.entity.monster.Zombie;
|
||||
import net.minecraft.world.level.NaturalSpawner;
|
||||
import org.bukkit.Bukkit;
|
||||
+import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
@ -55,8 +47,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
allowPlayerCrammingDamage = getBoolean("allow-player-cramming-damage", allowPlayerCrammingDamage);
|
||||
}
|
||||
+
|
||||
+ private Table<String, String, Integer> sensorTickRates;
|
||||
+ private Table<String, String, Integer> behaviorTickRates;
|
||||
+ private com.google.common.collect.Table<String, String, Integer> sensorTickRates;
|
||||
+ private com.google.common.collect.Table<String, String, Integer> behaviorTickRates;
|
||||
+ private void tickRates() {
|
||||
+ config.addDefault("world-settings.default.tick-rates.sensor.villager.secondarypoisensor", 40);
|
||||
+ config.addDefault("world-settings.default.tick-rates.behavior.villager.validatenearbypoi", -1); // Example
|
||||
@ -65,9 +57,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ behaviorTickRates = loadTickRates("behavior");
|
||||
+ }
|
||||
+
|
||||
+ private Table<String, String, Integer> loadTickRates(String type) {
|
||||
+ private com.google.common.collect.Table<String, String, Integer> loadTickRates(String type) {
|
||||
+ log(" " + type + ":");
|
||||
+ Table<String, String, Integer> table = HashBasedTable.create();
|
||||
+ com.google.common.collect.Table<String, String, Integer> table = com.google.common.collect.HashBasedTable.create();
|
||||
+
|
||||
+ ConfigurationSection typeSection = config.getConfigurationSection("world-settings." + worldName + ".tick-rates." + type);
|
||||
+ if (typeSection == null) {
|
||||
@ -103,7 +95,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ return getIntOrDefault(sensorTickRates, typeName, entityType, def);
|
||||
+ }
|
||||
+
|
||||
+ private int getIntOrDefault(Table<String, String, Integer> table, String rowKey, String columnKey, int def) {
|
||||
+ private int getIntOrDefault(com.google.common.collect.Table<String, String, Integer> table, String rowKey, String columnKey, int def) {
|
||||
+ Integer rate = table.get(columnKey, rowKey);
|
||||
+ return rate != null && rate > -1 ? rate : def;
|
||||
+ }
|
||||
|
@ -1100,13 +1100,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, final DimensionType dimensionmanager, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env) {
|
||||
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, final DimensionType dimensionmanager, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor
|
||||
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
||||
this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), this.spigotConfig); // Paper
|
||||
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
this.keepSpawnInMemory = this.paperConfig.keepSpawnInMemory; // Paper
|
||||
this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime);
|
||||
this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime);
|
||||
this.chunkPacketBlockController = this.paperConfig.antiXray ? new com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray(this, executor) : com.destroystokyo.paper.antixray.ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray
|
||||
+ this.entitySliceManager = new io.papermc.paper.world.EntitySliceManager((ServerLevel)this); // Paper
|
||||
}
|
||||
|
||||
|
@ -4951,7 +4951,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ public class LevelChunk extends ChunkAccess {
|
||||
|
||||
public LevelChunk(Level world, ChunkPos pos, UpgradeData upgradeData, LevelChunkTicks<Block> blockTickScheduler, LevelChunkTicks<Fluid> fluidTickScheduler, long inhabitedTime, @Nullable LevelChunkSection[] sectionArrayInitializer, @Nullable LevelChunk.PostLoadProcessor entityLoader, @Nullable BlendingData blendingData) {
|
||||
super(pos, upgradeData, world, world.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), inhabitedTime, sectionArrayInitializer, blendingData);
|
||||
super(pos, upgradeData, world, net.minecraft.server.MinecraftServer.getServer().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), inhabitedTime, sectionArrayInitializer, blendingData); // Paper - Anti-Xray - The world isnt ready yet, use server singleton for registry
|
||||
+ // Paper start - rewrite light engine
|
||||
+ this.setBlockNibbles(ca.spottedleaf.starlight.common.light.StarLightEngine.getFilledEmptyLight(world));
|
||||
+ this.setSkyNibbles(ca.spottedleaf.starlight.common.light.StarLightEngine.getFilledEmptyLight(world));
|
||||
|
@ -29,15 +29,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // this.threadingDetector.checkAndUnlock(); // Paper - disable this
|
||||
}
|
||||
|
||||
public static <T> Codec<PalettedContainer<T>> codec(IdMap<T> idList, Codec<T> entryCodec, PalettedContainer.Strategy provider, T object) {
|
||||
// Paper start - Anti-Xray - Add preset values
|
||||
@Deprecated public static <T> Codec<PalettedContainer<T>> codec(IdMap<T> idList, Codec<T> entryCodec, PalettedContainer.Strategy provider, T object) { return PalettedContainer.codec(idList, entryCodec, provider, object, null); } // Notice for updates: Please make sure this function isn't used anywhere
|
||||
public static <T> Codec<PalettedContainer<T>> codec(IdMap<T> idList, Codec<T> entryCodec, PalettedContainer.Strategy provider, T object, T[] presetValues) {
|
||||
- return RecordCodecBuilder.create((instance) -> {
|
||||
+ return RecordCodecBuilder.<DiscData<T>>create((instance) -> { // Paper - decompile fixes
|
||||
return instance.group(entryCodec.mapResult(ExtraCodecs.orElsePartial(object)).listOf().fieldOf("palette").forGetter(PalettedContainer.DiscData::paletteEntries), Codec.LONG_STREAM.optionalFieldOf("data").forGetter(PalettedContainer.DiscData::storage)).apply(instance, PalettedContainer.DiscData::new);
|
||||
}).comapFlatMap((serialized) -> {
|
||||
return read(idList, provider, serialized);
|
||||
return read(idList, provider, serialized, object, presetValues);
|
||||
@@ -0,0 +0,0 @@ public class PalettedContainer<T> implements PaletteResize<T> {
|
||||
return data2.palette.idFor(object);
|
||||
}
|
||||
// Paper end
|
||||
|
||||
- public T getAndSet(int x, int y, int z, T value) {
|
||||
+ public synchronized T getAndSet(int x, int y, int z, T value) { // Paper - synchronize
|
||||
@ -64,10 +66,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
try {
|
||||
@@ -0,0 +0,0 @@ public class PalettedContainer<T> implements PaletteResize<T> {
|
||||
|
||||
}
|
||||
|
||||
- public void write(FriendlyByteBuf buf) {
|
||||
+ public synchronized void write(FriendlyByteBuf buf) { // Paper - synchronize
|
||||
// Paper start - Anti-Xray - Add chunk packet info
|
||||
@Deprecated public void write(FriendlyByteBuf buf) { this.write(buf, null, 0); } // Notice for updates: Please make sure this method isn't used anywhere
|
||||
- public void write(FriendlyByteBuf buf, com.destroystokyo.paper.antixray.ChunkPacketInfo<T> chunkPacketInfo, int bottomBlockY) {
|
||||
+ public synchronized void write(FriendlyByteBuf buf, com.destroystokyo.paper.antixray.ChunkPacketInfo<T> chunkPacketInfo, int bottomBlockY) { // Paper - synchronize
|
||||
this.acquire();
|
||||
|
||||
try {
|
||||
@ -75,13 +77,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
}
|
||||
|
||||
- private static <T> DataResult<PalettedContainer<T>> read(IdMap<T> idList, PalettedContainer.Strategy provider, PalettedContainer.DiscData<T> serialized) {
|
||||
+ private static synchronized <T> DataResult<PalettedContainer<T>> read(IdMap<T> idList, PalettedContainer.Strategy provider, PalettedContainer.DiscData<T> serialized) { // Paper - synchronize
|
||||
- private static <T> DataResult<PalettedContainer<T>> read(IdMap<T> idList, PalettedContainer.Strategy provider, PalettedContainer.DiscData<T> serialized, T defaultValue, T[] presetValues) { // Paper - Anti-Xray - Add preset values
|
||||
+ private synchronized static <T> DataResult<PalettedContainer<T>> read(IdMap<T> idList, PalettedContainer.Strategy provider, PalettedContainer.DiscData<T> serialized, T defaultValue, T[] presetValues) { // Paper - Anti-Xray - Add preset values // Paper - synchronize
|
||||
List<T> list = serialized.paletteEntries();
|
||||
int i = provider.size();
|
||||
int j = provider.calculateBitsForSerialization(idList, list.size());
|
||||
@@ -0,0 +0,0 @@ public class PalettedContainer<T> implements PaletteResize<T> {
|
||||
return DataResult.success(new PalettedContainer<>(idList, provider, configuration, bitStorage, list));
|
||||
return DataResult.success(new PalettedContainer<>(idList, provider, configuration, bitStorage, list, defaultValue, presetValues)); // Paper - Anti-Xray - Add preset values
|
||||
}
|
||||
|
||||
- private PalettedContainer.DiscData<T> write(IdMap<T> idList, PalettedContainer.Strategy provider) {
|
||||
|
@ -50,7 +50,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
public abstract ResourceKey<LevelStem> getTypeKey();
|
||||
|
||||
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, final DimensionType dimensionmanager, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env) {
|
||||
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, final DimensionType dimensionmanager, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor
|
||||
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
|
||||
for (int l1 = j; l1 <= l; ++l1) {
|
||||
|
@ -9,14 +9,6 @@ diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/m
|
||||
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 net.minecraft.world.Difficulty;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.monster.Vindicator;
|
||||
import net.minecraft.world.entity.monster.Zombie;
|
||||
+import net.minecraft.world.level.NaturalSpawner;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.spigotmc.SpigotWorldConfig;
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
|
||||
set("despawn-ranges.soft", null);
|
||||
@ -33,7 +25,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
zombieVillagerInfectionChance = getDouble("zombie-villager-infection-chance", zombieVillagerInfectionChance);
|
||||
}
|
||||
|
||||
+ public Reference2IntMap<MobCategory> perWorldSpawnLimits = new Reference2IntOpenHashMap<>(NaturalSpawner.SPAWNING_CATEGORIES.length);
|
||||
+ public Reference2IntMap<MobCategory> perWorldSpawnLimits = new Reference2IntOpenHashMap<>(net.minecraft.world.level.NaturalSpawner.SPAWNING_CATEGORIES.length);
|
||||
+ private void perWorldSpawnLimits() {
|
||||
+ perWorldSpawnLimits.defaultReturnValue(-1);
|
||||
+ if (PaperConfig.version < 24) {
|
||||
@ -43,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ perWorldSpawnLimits.put(MobCategory.WATER_CREATURE, getInt("spawn-limits.water-animals", -1, false));
|
||||
+ perWorldSpawnLimits.put(MobCategory.WATER_AMBIENT, getInt("spawn-limits.water-ambient", -1, false));
|
||||
+ }
|
||||
+ for (MobCategory value : NaturalSpawner.SPAWNING_CATEGORIES) {
|
||||
+ for (MobCategory value : net.minecraft.world.level.NaturalSpawner.SPAWNING_CATEGORIES) {
|
||||
+ perWorldSpawnLimits.put(value, getInt("spawn-limits." + value.getName(), perWorldSpawnLimits.getInt(value)));
|
||||
+ }
|
||||
+ }
|
||||
|
Loading…
Reference in New Issue
Block a user