Port Anti-Xray to 1.18 (#6947)
This commit is contained in:
@@ -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;
|
||||
+ }
|
||||
|
||||
Reference in New Issue
Block a user