Skip to content

Commit

Permalink
more work
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphaKR93 committed Dec 3, 2023
1 parent 95227f1 commit 9e2407d
Show file tree
Hide file tree
Showing 21 changed files with 67 additions and 43 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,10 @@ index a6f58b3457b7477015c5c6d969e7d83017dd3fa1..28acc9a7f9defdddb2d5c28e2d1e4598

public SpamLimiter spamLimiter;
diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
index ed79d30f33b2674863b2d73b1abdb48433c33412..11856e9cbb56869eba10ed25e72be8b32d245cb1 100644
index 071d3877e..1f0540adf 100644
--- a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
@@ -32,6 +32,7 @@ import net.minecraft.commands.arguments.NbtPathArgument;
import net.minecraft.core.Holder;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
+import net.minecraft.server.MinecraftServer;
import net.minecraft.world.Difficulty;
import net.minecraft.world.entity.Display;
import net.minecraft.world.entity.Entity;
@@ -96,15 +97,27 @@ public class WorldConfiguration extends ConfigurationPart {
@@ -96,12 +96,32 @@ public class WorldConfiguration extends ConfigurationPart {

public class AntiXray extends ConfigurationPart {
public boolean enabled = false;
Expand All @@ -80,39 +72,71 @@ index ed79d30f33b2674863b2d73b1abdb48433c33412..11856e9cbb56869eba10ed25e72be8b3
public int updateRadius = 2;
public boolean lavaObscures = false;
public boolean usePermission = false;
- public List<String> hiddenBlocks = List.of("copper_ore", "deepslate_copper_ore", "raw_copper_block", "gold_ore", "deepslate_gold_ore", "iron_ore", "deepslate_iron_ore", "raw_iron_block",
- "coal_ore", "deepslate_coal_ore", "lapis_ore", "deepslate_lapis_ore", "mossy_cobblestone", "obsidian", "chest", "diamond_ore", "deepslate_diamond_ore",
- "redstone_ore", "deepslate_redstone_ore", "clay", "emerald_ore", "deepslate_emerald_ore", "ender_chest"); // TODO update type to List<Block>
- public List<String> replacementBlocks = List.of("stone", "oak_planks", "deepslate"); // TODO update type to List<Block>
- public List<Block> hiddenBlocks = List.of(
+ // Plazma start - Optimize default configurations
+ public List<String> hiddenBlocks = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ?
+ List.of("air", "copper_ore", "deepslate_copper_ore", "raw_copper_block", "iron_ore",
+ "deepslate_iron_ore", "raw_iron_block", "gold_ore", "deepslate_gold_ore", "raw_gold_block",
+ "lapis_ore", "deepslate_lapis_ore", "redstone_ore", "deepslate_redstone_ore", "diamond_ore",
+ "deepslate_diamond_ore") :
+ List.of("copper_ore", "deepslate_copper_ore","gold_ore", "deepslate_gold_ore",
+ "iron_ore", "deepslate_iron_ore", "coal_ore", "deepslate_coal_ore", "lapis_ore",
+ "deepslate_lapis_ore", "mossy_cobblestone", "obsidian", "chest", "diamond_ore",
+ "deepslate_diamond_ore", "redstone_ore", "deepslate_redstone_ore", "clay", "emerald_ore",
+ "deepslate_emerald_ore", "ender_chest"); // TODO update type to List<Block>
+ public List<String> replacementBlocks = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ?
+ List.of("chest", "amethyst_block", "andesite", "budding_amethyst", "calcite", "coal_ore",
+ "deepslate_coal_ore", "deepslate", "diorite", "dirt", "emerald_ore", "granite", "gravel",
+ "oak_planks", "smooth_basalt", "stone", "tuff") : List.of("stone", "oak_planks", "deepslate"); // TODO update type to List<Block>
+ public List<Block> hiddenBlocks = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? List.of(
+ //<editor-fold desc="Anti-Xray Hidden Blocks" defaultstate="collapsed">
+ Blocks.AIR,
+ Blocks.COPPER_ORE,
+ Blocks.DEEPSLATE_COPPER_ORE,
+ Blocks.RAW_COPPER_BLOCK,
+ Blocks.IRON_ORE,
+ Blocks.DEEPSLATE_IRON_ORE,
+ Blocks.RAW_IRON_BLOCK,
+ Blocks.GOLD_ORE,
+ Blocks.DEEPSLATE_GOLD_ORE,
+ Blocks.RAW_GOLD_BLOCK,
+ Blocks.REDSTONE_ORE,
+ Blocks.DEEPSLATE_REDSTONE_ORE,
+ Blocks.LAPIS_ORE,
+ Blocks.DEEPSLATE_LAPIS_ORE,
+ Blocks.DIAMOND_ORE,
+ Blocks.DEEPSLATE_DIAMOND_ORE
+ //</editor-fold>
+ ) : List.of(
//<editor-fold desc="Anti-Xray Hidden Blocks" defaultstate="collapsed">
Blocks.COPPER_ORE,
Blocks.DEEPSLATE_COPPER_ORE,
@@ -128,7 +148,28 @@ public class WorldConfiguration extends ConfigurationPart {
Blocks.ENDER_CHEST
//</editor-fold>
);
- public List<Block> replacementBlocks = List.of(Blocks.STONE, Blocks.OAK_PLANKS, Blocks.DEEPSLATE);
+ public List<Block> replacementBlocks = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? List.of(
+ //<editor-fold desc="Anti-Xray Hidden Blocks" defaultstate="collapsed">
+ Blocks.CHEST,
+ Blocks.AMETHYST_BLOCK,
+ Blocks.ANDESITE,
+ Blocks.BUDDING_AMETHYST,
+ Blocks.CALCITE,
+ Blocks.COAL_ORE,
+ Blocks.DEEPSLATE_COAL_ORE,
+ Blocks.DEEPSLATE,
+ Blocks.DIORITE,
+ Blocks.DIRT,
+ Blocks.EMERALD_ORE,
+ Blocks.GRANITE,
+ Blocks.GRAVEL,
+ Blocks.OAK_PLANKS,
+ Blocks.SMOOTH_BASALT,
+ Blocks.STONE,
+ Blocks.TUFF
+ //</editor-fold>
+ ) : List.of(Blocks.STONE, Blocks.OAK_PLANKS, Blocks.DEEPSLATE);
+ // Plazma end
}
}

@@ -158,7 +171,7 @@ public class WorldConfiguration extends ConfigurationPart {
@@ -182,7 +223,7 @@ public class WorldConfiguration extends ConfigurationPart {
@MergeMap
public Reference2IntMap<MobCategory> spawnLimits = Util.make(new Reference2IntOpenHashMap<>(NaturalSpawner.SPAWNING_CATEGORIES.length), map -> Arrays.stream(NaturalSpawner.SPAWNING_CATEGORIES).forEach(mobCategory -> map.put(mobCategory, -1)));
@MergeMap
- public Map<MobCategory, DespawnRange> despawnRanges = Arrays.stream(MobCategory.values()).collect(Collectors.toMap(Function.identity(), category -> new DespawnRange(category.getNoDespawnDistance(), category.getDespawnDistance())));
+ public Map<MobCategory, DespawnRange> despawnRanges = Arrays.stream(MobCategory.values()).collect(Collectors.toMap(Function.identity(), category -> new DespawnRange(category.getNoDespawnDistance(), org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? (MinecraftServer.getServer().server.getSimulationDistance() * 16) + 8 : category.getDespawnDistance()))); // Plazma - Optimize default configurations
+ public Map<MobCategory, DespawnRange> despawnRanges = Arrays.stream(MobCategory.values()).collect(Collectors.toMap(Function.identity(), category -> new DespawnRange(category.getNoDespawnDistance(), org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? (net.minecraft.server.MinecraftServer.getServer().server.getSimulationDistance() * 16) + 8 : category.getDespawnDistance()))); // Plazma - Optimize default configurations

@ConfigSerializable
public record DespawnRange(@Required int soft, @Required int hard) {
@@ -380,7 +393,7 @@ public class WorldConfiguration extends ConfigurationPart {
@@ -381,7 +422,7 @@ public class WorldConfiguration extends ConfigurationPart {
public class Environment extends ConfigurationPart {
public boolean disableThunder = false;
public boolean disableIceAndSnow = false;
Expand All @@ -121,7 +145,7 @@ index ed79d30f33b2674863b2d73b1abdb48433c33412..11856e9cbb56869eba10ed25e72be8b3
public boolean disableExplosionKnockback = false;
public boolean generateFlatBedrock = false;
public FrostedIce frostedIce;
@@ -432,7 +445,7 @@ public class WorldConfiguration extends ConfigurationPart {
@@ -433,7 +474,7 @@ public class WorldConfiguration extends ConfigurationPart {
public Fixes fixes;

public class Fixes extends ConfigurationPart {
Expand All @@ -130,7 +154,7 @@ index ed79d30f33b2674863b2d73b1abdb48433c33412..11856e9cbb56869eba10ed25e72be8b3
public boolean disableUnloadedChunkEnderpearlExploit = true;
public boolean preventTntFromMovingInWater = false;
public boolean splitOverstackedLoot = true;
@@ -459,9 +472,9 @@ public class WorldConfiguration extends ConfigurationPart {
@@ -460,9 +501,9 @@ public class WorldConfiguration extends ConfigurationPart {
public class Collisions extends ConfigurationPart {
public boolean onlyPlayersCollide = false;
public boolean allowVehicleCollisions = true;
Expand All @@ -142,7 +166,7 @@ index ed79d30f33b2674863b2d73b1abdb48433c33412..11856e9cbb56869eba10ed25e72be8b3
public boolean allowPlayerCrammingDamage = false;
}

@@ -469,18 +482,40 @@ public class WorldConfiguration extends ConfigurationPart {
@@ -470,18 +511,41 @@ public class WorldConfiguration extends ConfigurationPart {

public class Chunks extends ConfigurationPart {
public AutosavePeriod autoSaveInterval = AutosavePeriod.def();
Expand All @@ -153,7 +177,7 @@ index ed79d30f33b2674863b2d73b1abdb48433c33412..11856e9cbb56869eba10ed25e72be8b3
+ public boolean preventMovingIntoUnloadedChunks = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize(); // Plazma - Optimize default configurations
public Duration delayChunkUnloadsBy = Duration.of("10s");
public Reference2IntMap<EntityType<?>> entityPerChunkSaveLimit = Util.make(new Reference2IntOpenHashMap<>(BuiltInRegistries.ENTITY_TYPE.size()), map -> {
- map.defaultReturnValue(-1);
map.defaultReturnValue(-1);
- map.put(EntityType.EXPERIENCE_ORB, -1);
- map.put(EntityType.SNOWBALL, -1);
- map.put(EntityType.ENDER_PEARL, -1);
Expand Down Expand Up @@ -192,7 +216,7 @@ index ed79d30f33b2674863b2d73b1abdb48433c33412..11856e9cbb56869eba10ed25e72be8b3
});
public boolean flushRegionsOnSave = false;
}
@@ -495,9 +530,9 @@ public class WorldConfiguration extends ConfigurationPart {
@@ -496,9 +560,9 @@ public class WorldConfiguration extends ConfigurationPart {
public TickRates tickRates;

public class TickRates extends ConfigurationPart {
Expand All @@ -201,10 +225,10 @@ index ed79d30f33b2674863b2d73b1abdb48433c33412..11856e9cbb56869eba10ed25e72be8b3
public int containerUpdate = 1;
- public int mobSpawner = 1;
+ public int mobSpawner = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 2 : 1; // Plazma - Optimize default configurations
public int wetFarmland = 1;
public int dryFarmland = 1;
public Table<EntityType<?>, String, Integer> sensor = Util.make(HashBasedTable.create(), table -> table.put(EntityType.VILLAGER, "secondarypoisensor", 40));
public Table<EntityType<?>, String, Integer> behavior = Util.make(HashBasedTable.create(), table -> table.put(EntityType.VILLAGER, "validatenearbypoi", -1));
}
@@ -522,9 +557,9 @@ public class WorldConfiguration extends ConfigurationPart {
@@ -525,9 +589,9 @@ public class WorldConfiguration extends ConfigurationPart {

public class Misc extends ConfigurationPart {
public int lightQueueSize = 20;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ index 097ac55028d66ef9ab430ff5dd103db6e3b99fc7..2993e9f326c43ef3f06d5e332899f9fa

public class ServerFunctionManager {
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 8f8f6b409ad28f0fe577f274abbd9e99112bdec4..d54cb1883b9621438cbabae713d46467e76e19ec 100644
index 3771caa73..a88f6bbed 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -68,7 +68,7 @@ import net.minecraft.server.level.progress.ChunkProgressListener;
Expand All @@ -162,7 +162,7 @@ index 43a46feb5fb4bf23d71bc4f6c08caa93b1959ffc..16c2db8fbfcaf15efb94c04e1bb2508e
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.ai.village.poi.PoiManager;
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index aa0dd89ce7e36a4102c52eaa4d34f403bd0fd8b6..30436e0afe8d396903ff4ff6711ffcb979966ab0 100644
index e46207a25..9301ec814 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -77,7 +77,7 @@ import net.minecraft.util.Mth;
Expand All @@ -178,8 +178,8 @@ index aa0dd89ce7e36a4102c52eaa4d34f403bd0fd8b6..30436e0afe8d396903ff4ff6711ffcb9
// Holder holder = worlddimension.type(); // CraftBukkit - decompile error

// Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
- super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig)), spigotConfig -> minecraftserver.plazmaConfigurations.createWorldConfig(org.plazmamc.plazma.configurations.PlazmaConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig)), executor); // Paper - Async-Anti-Xray - Pass executor // Plazma
+ super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), /*minecraftserver::getProfiler,*/ false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig)), spigotConfig -> minecraftserver.plazmaConfigurations.createWorldConfig(org.plazmamc.plazma.configurations.PlazmaConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig)), executor); // Paper - Async-Anti-Xray - Pass executor // Plazma - Completely remove profiler
- super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig, minecraftserver.registryAccess())), spigotConfig -> minecraftserver.plazmaConfigurations.createWorldConfig(org.plazmamc.plazma.configurations.PlazmaConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig, minecraftserver.registryAccess())), executor); // Paper - Async-Anti-Xray - Pass executor // Plazma
+ super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), /*minecraftserver::getProfiler,*/ false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig, minecraftserver.registryAccess())), spigotConfig -> minecraftserver.plazmaConfigurations.createWorldConfig(org.plazmamc.plazma.configurations.PlazmaConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig, minecraftserver.registryAccess())), executor); // Paper - Async-Anti-Xray - Pass executor // Plazma // Plazma - Completely remove profiler
this.pvpMode = minecraftserver.isPvpAllowed();
this.convertable = convertable_conversionsession;
this.uuid = WorldUUID.getUUID(convertable_conversionsession.levelDirectory.path().toFile());
Expand Down

0 comments on commit 9e2407d

Please sign in to comment.