Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Commit

Permalink
Update Configuration
Browse files Browse the repository at this point in the history
The old configuration files should be deleted
  • Loading branch information
404Setup committed Aug 1, 2024
1 parent 4ea52ad commit 8db2192
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 92 deletions.
116 changes: 57 additions & 59 deletions patches/server/0002-Vine-Config.patch
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ index efed51a692d94acd9126f6eb2866755567c2e636..fd308bb5dc3f90d7b76240dd0d5026b7

}
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index a7ffbbfd2a9fdeae0953ec8753ce48e93ccce086..d7891588cd7dbc9e5f9921cc2f5bf5145678f27e 100644
index a7ffbbfd2a9fdeae0953ec8753ce48e93ccce086..32d9eba81500be7ab64bd027499c96f6804a68cd 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -58,6 +58,7 @@ import net.minecraft.world.level.storage.LevelResource;
import net.minecraft.world.level.storage.LevelStorageSource;
import net.minecraft.world.level.storage.LevelSummary;
import net.minecraft.world.level.storage.PrimaryLevelData;
+import one.tranic.levelpowered.vine.config.VineConfig;
+import one.tranic.vine.config.VineConfig;
import org.slf4j.Logger;

// CraftBukkit start
Expand All @@ -45,7 +45,7 @@ index a7ffbbfd2a9fdeae0953ec8753ce48e93ccce086..d7891588cd7dbc9e5f9921cc2f5bf514

// Purpur start - load config files early
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index d281fe5f75f6f99f869fa3cc8da4f1ff9f96a7bf..a7c3e628762a93803418f462ef57741183345ebc 100644
index d281fe5f75f6f99f869fa3cc8da4f1ff9f96a7bf..09c17974579797588d5fbd290bc2ce9b3ebab89b 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -1,20 +1,14 @@
Expand Down Expand Up @@ -73,7 +73,7 @@ index d281fe5f75f6f99f869fa3cc8da4f1ff9f96a7bf..a7c3e628762a93803418f462ef577411
import net.minecraft.world.level.GameType;
import net.minecraft.world.level.block.entity.SkullBlockEntity;
import net.minecraft.world.level.storage.LevelStorageSource;
+import one.tranic.levelpowered.vine.config.VineConfig;
+import one.tranic.vine.config.VineConfig;
import org.slf4j.Logger;

// CraftBukkit start
Expand All @@ -97,15 +97,15 @@ index d281fe5f75f6f99f869fa3cc8da4f1ff9f96a7bf..a7c3e628762a93803418f462ef577411
// Paper start - fix converting txt to json file; convert old users earlier after PlayerList creation but before file load/save
if (this.convertOldUsers()) {
this.getProfileCache().save(false); // Paper
diff --git a/src/main/kotlin/one/tranic/levelpowered/vine/commands/VineCfgCommand.kt b/src/main/kotlin/one/tranic/levelpowered/vine/commands/VineCfgCommand.kt
diff --git a/src/main/kotlin/one/tranic/vine/commands/VineCfgCommand.kt b/src/main/kotlin/one/tranic/vine/commands/VineCfgCommand.kt
new file mode 100644
index 0000000000000000000000000000000000000000..dd96b107b3208707958735ef059c6b20115cdcad
index 0000000000000000000000000000000000000000..6feb7269907d2c88a9eb5b52204e55c10a8b7262
--- /dev/null
+++ b/src/main/kotlin/one/tranic/levelpowered/vine/commands/VineCfgCommand.kt
+++ b/src/main/kotlin/one/tranic/vine/commands/VineCfgCommand.kt
@@ -0,0 +1,34 @@
+package one.tranic.levelpowered.vine.commands
+package one.tranic.vine.commands
+
+import one.tranic.levelpowered.vine.config.VineConfig
+import one.tranic.vine.config.VineConfig
+import org.bukkit.command.Command
+import org.bukkit.command.CommandSender
+import net.kyori.adventure.text.Component
Expand Down Expand Up @@ -138,23 +138,24 @@ index 0000000000000000000000000000000000000000..dd96b107b3208707958735ef059c6b20
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/one/tranic/levelpowered/vine/config/VineConfig.kt b/src/main/kotlin/one/tranic/levelpowered/vine/config/VineConfig.kt
diff --git a/src/main/kotlin/one/tranic/vine/config/VineConfig.kt b/src/main/kotlin/one/tranic/vine/config/VineConfig.kt
new file mode 100644
index 0000000000000000000000000000000000000000..960b0d79a27c111d2d9750c05e04f8a0f216b7b0
index 0000000000000000000000000000000000000000..c0f0466810dc9764b69dda0aeae3fae53054dcd8
--- /dev/null
+++ b/src/main/kotlin/one/tranic/levelpowered/vine/config/VineConfig.kt
@@ -0,0 +1,225 @@
+package one.tranic.levelpowered.vine.config
+++ b/src/main/kotlin/one/tranic/vine/config/VineConfig.kt
@@ -0,0 +1,223 @@
+package one.tranic.vine.config
+
+import gg.pufferfish.pufferfish.simd.SIMDDetection
+import net.minecraft.server.MinecraftServer
+import one.tranic.levelpowered.vine.commands.VineCfgCommand
+import one.tranic.vine.commands.VineCfgCommand
+import org.bukkit.Bukkit
+import org.bukkit.configuration.file.YamlConfiguration
+import java.io.File
+
+object VineConfig {
+ var logger: org.slf4j.Logger = MinecraftServer.LOGGER
+ val logger: org.slf4j.Logger = MinecraftServer.LOGGER
+ private const val CONFIG_VERSION = "2.0"
+ private lateinit var configuration: YamlConfiguration
+
+ @JvmStatic
Expand All @@ -180,6 +181,7 @@ index 0000000000000000000000000000000000000000..960b0d79a27c111d2d9750c05e04f8a0
+ @JvmStatic
+ fun load() {
+ reload()
+ reload()
+ // Pufferfish start
+ // Attempt to detect vectorization
+ runCatching {
Expand All @@ -205,20 +207,20 @@ index 0000000000000000000000000000000000000000..960b0d79a27c111d2d9750c05e04f8a0
+ private fun addDefault(configFile: File) {
+ addDefault(
+ "info",
+ "1.0",
+ CONFIG_VERSION,
+ listOf("Vine Abstract Configuration", "Vine Github: https://github.com/LevelTranic/Vine")
+ )
+
+ addDefault(
+ "vine.fix.incorrect-bounce-logic",
+ "fix.incorrect-bounce-logic",
+ false,
+ listOf(
+ "Fixes some entities not bouncing on slime blocks and getting stuck",
+ "Fixes: https://bugs.mojang.com/browse/MC-216985"
+ )
+ )
+ addDefault(
+ "vine.fix.explosion-breaks-item-frame-in-water",
+ "fix.explosion-breaks-item-frame-in-water",
+ false,
+ listOf(
+ "Fixes Explosions being able to destroy item frames in water",
Expand All @@ -227,66 +229,66 @@ index 0000000000000000000000000000000000000000..960b0d79a27c111d2d9750c05e04f8a0
+ )
+
+ addDefault(
+ "levelbukkit.try-fix-anvil-drop.enabled",
+ "fix.anvil-drop.enabled",
+ true,
+ listOf(
+ "This fix will attempt to prevent the bug in https://github.com/PaperMC/Folia/issues/217, ",
+ "it may cause some unexpected effects but should be harmless."
+ )
+ )
+ addDefault(
+ "levelbukkit.try-fix-anvil-drop.debug", false,
+ "fix.anvil-drop.debug", false,
+ "Whether to print detailed information to the console when this issue is triggered"
+ )
+
+ addDefault(
+ "leaf.optimize-minecart.enabled", true,
+ "optimize.minecart.enabled", true,
+ listOf(
+ "Enable this feature to handle large amount of stacked Minecart better.",
+ "By skipping tick collisions to reduce expense getting entities list",
+ "and bukkit event calls, useful for the anarchy server."
+ )
+ )
+ addDefault("leaf.optimize-minecart.skipTickCount", 30)
+ addDefault("optimize.optimize-minecart.skipTickCount", 30)
+
+ addDefault(
+ "mobtimizations.optimizationMobRePathfinding",
+ "optimize.mob-re-pathfinding",
+ true,
+ "If true, disables the frequent pathfinds done while already following a path"
+ )
+ addDefault(
+ "mobtimizations.optimizationZombieSearchAndDestroyTurtleEgg",
+ "optimize.zombie-search-and-destroy-turtle-egg.enabled",
+ false,
+ "If true, optimizes the expensive searching done to find a turtle egg to crush, for zombies/husks, by default fully disabling it"
+ )
+ addDefault(
+ "mobtimizations.zombieSearchAndDestroyTurtleEggPercentChance",
+ "optimize.zombie-search-and-destroy-turtle-egg.percent-chance",
+ 40,
+ "Percent chance to run for task: zombie seeking turtle eggs to destroy"
+ )
+
+ addDefault("divine.optimize-noise-generation", true)
+ addDefault("optimize.noise-generation", true)
+
+ configuration.options().copyDefaults(true)
+ configuration.save(configFile)
+ }
+
+ private fun loadConfigValue() {
+ Fix.incorrectBounceLogic = getBoolean("vine.fix.incorrect-bounce-logic")
+ Fix.explosionBreaksItemFrameInWater = getBoolean("vine.fix.explosion-breaks-item-frame-in-water")
+ Fix.incorrectBounceLogic = getBoolean("fix.incorrect-bounce-logic")
+ Fix.explosionBreaksItemFrameInWater = getBoolean("fix.explosion-breaks-item-frame-in-water")
+
+ LevelBukkit.tryFixAnvilDrop = getBoolean("levelbukkit.try-fix-anvil-drop.enabled")
+ LevelBukkit.tryFixAnvilDropLogger = getBoolean("levelbukkit.try-fix-anvil-drop.debug")
+ Leaf.OptimizeMinecart.enabled = getBoolean("leaf.optimize-minecart.enabled")
+ Leaf.OptimizeMinecart.skipTickCount = getInt("leaf.optimize-minecart.skipTickCount")
+ Fix.anvilDrop = getBoolean("fix.anvil-drop.enabled")
+ Fix.anvilDropLogger = getBoolean("fix.anvil-drop.debug")
+ Optimize.Minecart.enabled = getBoolean("optimize.minecart.enabled")
+ Optimize.Minecart.skipTickCount = getInt("optimize.minecart.skipTickCount")
+
+ Mobtimizations.optimizationMobRePathfinding = getBoolean("mobtimizations.optimizationMobRePathfinding")
+ Mobtimizations.optimizationZombieSearchAndDestroyTurtleEgg =
+ getBoolean("mobtimizations.optimizationZombieSearchAndDestroyTurtleEgg")
+ Mobtimizations.zombieSearchAndDestroyTurtleEggPercentChance =
+ getInt("mobtimizations.zombieSearchAndDestroyTurtleEggPercentChance")
+ Optimize.mobRePathfinding = getBoolean("optimize.mob-re-pathfinding")
+ Optimize.TurtleEggSearch.enabled =
+ getBoolean("optimize.zombie-search-and-destroy-turtle-egg.enabled")
+ Optimize.TurtleEggSearch.percentChance =
+ getInt("optimize.zombie-search-and-destroy-turtle-egg.percent-chance")
+
+ Divine.optimizeNoiseGeneration = getBoolean("divine.optimize-noise-generation")
+ Optimize.noiseGeneration = getBoolean("optimize.noise-generation")
+ }
+
+ private fun addDefault(path: String, value: Any) {
Expand Down Expand Up @@ -329,44 +331,40 @@ index 0000000000000000000000000000000000000000..960b0d79a27c111d2d9750c05e04f8a0
+
+ object Fix {
+ @JvmField
+ var incorrectBounceLogic = false
+ var anvilDrop = true
+
+ @JvmField
+ var explosionBreaksItemFrameInWater = false
+ }
+ var anvilDropLogger = false
+
+ object LevelBukkit {
+ @JvmField
+ var tryFixAnvilDrop = true
+ var explosionBreaksItemFrameInWater = false
+
+ @JvmField
+ var tryFixAnvilDropLogger = false
+ var incorrectBounceLogic = false
+ }
+
+ object Leaf {
+ object OptimizeMinecart {
+ object Optimize {
+ @JvmField
+ var noiseGeneration = true
+
+ object Minecart {
+ @JvmField
+ var enabled = true
+
+ @JvmField
+ var skipTickCount = 30
+ }
+ }
+
+ object Mobtimizations {
+ @JvmField
+ var optimizationMobRePathfinding = true
+ var mobRePathfinding = true
+
+ @JvmField
+ var optimizationZombieSearchAndDestroyTurtleEgg = false
+
+ @JvmField
+ var zombieSearchAndDestroyTurtleEggPercentChance = 40
+ }
+ object TurtleEggSearch {
+ @JvmField
+ var enabled = false
+
+ object Divine {
+ @JvmField
+ var optimizeNoiseGeneration = true
+ @JvmField
+ var percentChance = 40
+ }
+ }
+}
\ No newline at end of file
6 changes: 3 additions & 3 deletions patches/server/0003-Leaf-Optimize-Minecart-collisions.patch
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ index f1b9e83206cc67e6ef29ebe088351b0aaa5eb349..e0a51e269aa076def275710174d3654d
Team.CollisionRule scoreboardteambase_enumteampush = scoreboardteam == null ? Team.CollisionRule.ALWAYS : scoreboardteam.getCollisionRule();

diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
index de2ea35a226c5f595a2ab53beda8238a806c2bad..66d98dbec18f1d497151a5678b08320e0511da4e 100644
index de2ea35a226c5f595a2ab53beda8238a806c2bad..30d756aee64e0215540f27b6d75d29ca03d6823a 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
@@ -3,9 +3,8 @@ package net.minecraft.world.entity.vehicle;
Expand Down Expand Up @@ -127,8 +127,8 @@ index de2ea35a226c5f595a2ab53beda8238a806c2bad..66d98dbec18f1d497151a5678b08320e
+ // Leaf start - Optimize Minecart collision handling
+ // The logic below is used to get list of entities around Minecart
+ // and handle behaviors for their collisions with each other
+ if (!one.tranic.levelpowered.vine.config.VineConfig.Leaf.OptimizeMinecart.enabled || this.tickCount % one.tranic.levelpowered.vine.config.VineConfig.Leaf.OptimizeMinecart.skipTickCount == 0) {
+ if (this.getMinecartType() == AbstractMinecart.Type.RIDEABLE && (one.tranic.levelpowered.vine.config.VineConfig.Leaf.OptimizeMinecart.enabled || this.getDeltaMovement().horizontalDistanceSqr() > 0.01D)) {
+ if (!one.tranic.vine.config.VineConfig.Optimize.Minecart.enabled || this.tickCount % one.tranic.vine.config.VineConfig.Optimize.Minecart.skipTickCount == 0) {
+ if (this.getMinecartType() == AbstractMinecart.Type.RIDEABLE && (one.tranic.vine.config.VineConfig.Optimize.Minecart.enabled || this.getDeltaMovement().horizontalDistanceSqr() > 0.01D)) {
List<Entity> list = this.level().getEntities((Entity) this, this.getBoundingBox().inflate(0.20000000298023224D, 0.0D, 0.20000000298023224D), EntitySelector.pushableBy(this));

if (!list.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ You can find the original code on https://github.com/Corosauce/mobtimizations
disables the frequent pathfinds done while already following a path

diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
index 544920a31b649985333f82beafa94a3392f5853e..fe3e39b4526ee1cfb9d426df8bc81a62a1c044b8 100644
index 544920a31b649985333f82beafa94a3392f5853e..f014649faee00cbacf6a92cf327d71a7c53c1ac4 100644
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
@@ -80,6 +80,7 @@ public abstract class PathNavigation {
}

public void recomputePath() {
+ if (one.tranic.levelpowered.vine.config.VineConfig.Mobtimizations.optimizationMobRePathfinding) return; // Vine
+ if (one.tranic.vine.config.VineConfig.Optimize.mobRePathfinding) return; // Vine
if (this.level.getGameTime() - this.timeLastRecompute > 20L) {
if (this.targetPos != null) {
this.path = null;
@@ -437,6 +438,7 @@ public abstract class PathNavigation {
}

public boolean shouldRecomputePath(BlockPos pos) {
+ if (one.tranic.levelpowered.vine.config.VineConfig.Mobtimizations.optimizationMobRePathfinding) return false; // Vine
+ if (one.tranic.vine.config.VineConfig.Optimize.mobRePathfinding) return false; // Vine
if (this.hasDelayedRecomputation) {
return false;
} else if (this.path != null && !this.path.isDone() && this.path.getNodeCount() != 0) {
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,18 @@ Original code by Corosauce
You can find the original code on https://github.com/Corosauce/mobtimizations

diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
index a61abba840a55fb4fbc9716a5e05eb2778068785..a8e364aa57cd31c94f8bb585a89d07463386f3d3 100644
index a61abba840a55fb4fbc9716a5e05eb2778068785..3ad6c7bec14b2d02d0f109101b5d68972f619fa2 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
@@ -17,10 +17,13 @@ import net.minecraft.world.level.Level;
@@ -2,7 +2,6 @@ package net.minecraft.world.entity.ai.goal;

import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
-import net.minecraft.core.SectionPos;
import net.minecraft.core.particles.ItemParticleOption;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.server.level.ServerLevel;
@@ -17,10 +16,12 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
Expand All @@ -20,26 +28,25 @@ index a61abba840a55fb4fbc9716a5e05eb2778068785..a8e364aa57cd31c94f8bb585a89d0746
import net.minecraft.world.level.chunk.status.ChunkStatus;
import net.minecraft.world.phys.Vec3;
// CraftBukkit start
+import one.tranic.levelpowered.vine.config.VineConfig;
+import one.tranic.levelpowered.vine.util.VineUtils;
+import one.tranic.vine.util.VineUtils;
import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.craftbukkit.event.CraftEventFactory;
// CraftBukkit end
@@ -40,6 +43,7 @@ public class RemoveBlockGoal extends MoveToBlockGoal {
@@ -40,6 +41,7 @@ public class RemoveBlockGoal extends MoveToBlockGoal {

@Override
public boolean canUse() {
+ if (VineConfig.Mobtimizations.optimizationZombieSearchAndDestroyTurtleEgg && blockToRemove == Blocks.TURTLE_EGG && !VineUtils.rollPercentChance(VineConfig.Mobtimizations.zombieSearchAndDestroyTurtleEggPercentChance)) return false;
+ if (one.tranic.vine.config.VineConfig.Optimize.TurtleEggSearch.enabled && blockToRemove == Blocks.TURTLE_EGG && !VineUtils.rollPercentChance(one.tranic.vine.config.VineConfig.Optimize.TurtleEggSearch.percentChance)) return false;
if (!this.removerMob.level().purpurConfig.zombieBypassMobGriefing && !this.removerMob.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur
return false;
} else if (this.nextStartTick > 0) {
diff --git a/src/main/kotlin/one/tranic/levelpowered/vine/util/VineUtils.kt b/src/main/kotlin/one/tranic/levelpowered/vine/util/VineUtils.kt
diff --git a/src/main/kotlin/one/tranic/vine/util/VineUtils.kt b/src/main/kotlin/one/tranic/vine/util/VineUtils.kt
new file mode 100644
index 0000000000000000000000000000000000000000..b8d791bd93c649c0a75ce6e0f9baa8d7963b970c
index 0000000000000000000000000000000000000000..808ae0c4afea99a5f76a5acb76e3096e83b19771
--- /dev/null
+++ b/src/main/kotlin/one/tranic/levelpowered/vine/util/VineUtils.kt
+++ b/src/main/kotlin/one/tranic/vine/util/VineUtils.kt
@@ -0,0 +1,12 @@
+package one.tranic.levelpowered.vine.util
+package one.tranic.vine.util
+
+import io.netty.util.internal.ThreadLocalRandom
+
Expand Down
Loading

0 comments on commit 8db2192

Please sign in to comment.