9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2025-12-22 00:09:15 +00:00

add some patches

This commit is contained in:
NONPLAYT
2025-02-23 01:18:17 +03:00
parent 61cfe231ec
commit 48f4dcad02
10 changed files with 252 additions and 8 deletions

View File

@@ -2,8 +2,6 @@ package org.bxteam.divinemc;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableMap;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.configuration.ConfigurationSection;
@@ -23,7 +21,7 @@ import java.util.logging.Level;
@SuppressWarnings("unused")
@NullMarked
public final class DivineConfig {
public final class DivineConfig { // TODO: Remake config system
private DivineConfig() {
throw new IllegalStateException("Utility class");
}
@@ -194,6 +192,7 @@ public final class DivineConfig {
public static long chunkDataCacheLimit = 32678L;
public static int maxViewDistance = 32;
public static ChunkSystemAlgorithms chunkWorkerAlgorithm = ChunkSystemAlgorithms.C2ME;
public static int threadPoolPriority = Thread.NORM_PRIORITY + 1;
public static boolean enableSecureSeed = false;
public static boolean enableDensityFunctionCompiler = false;
public static boolean enableStructureLayoutOptimizer = true;
@@ -203,9 +202,7 @@ public final class DivineConfig {
nativeAccelerationEnabled = getBoolean(config, "settings.chunk-generation.native-acceleration-enabled", nativeAccelerationEnabled);
allowAVX512 = getBoolean(config, "settings.chunk-generation.allow-avx512", allowAVX512,
"Enables AVX512 support for natives-math optimizations",
"",
"Read more about AVX512: https://en.wikipedia.org/wiki/AVX-512");
"Enables AVX512 support for natives-math optimizations");
isaTargetLevelOverride = getInt(config, "settings.chunk-generation.isa-target-level-override", isaTargetLevelOverride,
"Overrides the ISA target located by the native loader, which allows forcing AVX512 (must be a value between 6-9 for AVX512 support).",
"Value must be between 1-9, and -1 to disable override");
@@ -222,6 +219,8 @@ public final class DivineConfig {
chunkWorkerAlgorithm = ChunkSystemAlgorithms.valueOf(getString(config, "settings.chunk-generation.chunk-worker-algorithm", chunkWorkerAlgorithm.name(),
"Modifies what algorithm the chunk system will use to define thread counts. values: MOONRISE, C2ME, C2ME_AGGRESSIVE"));
threadPoolPriority = getInt(config, "settings.chunk-generation.thread-pool-priority", threadPoolPriority,
"Sets the priority of the thread pool used for chunk generation");
enableSecureSeed = getBoolean(config, "settings.misc.enable-secure-seed", enableSecureSeed,
"This feature is based on Secure Seed mod by Earthcomputer.",
@@ -258,6 +257,7 @@ public final class DivineConfig {
public static boolean clumpOrbs = true;
public static boolean ignoreMovedTooQuicklyWhenLagging = true;
public static boolean alwaysAllowWeirdMovement = true;
public static boolean updateSuppressionCrashFix = true;
private static void miscSettings() {
skipUselessSecondaryPoiSensor = getBoolean(config, "settings.misc.skip-useless-secondary-poi-sensor", skipUselessSecondaryPoiSensor);
@@ -267,6 +267,7 @@ public final class DivineConfig {
"Improves general gameplay experience of the player when the server is lagging, as they won't get lagged back (message 'moved too quickly')");
alwaysAllowWeirdMovement = getBoolean(config, "settings.misc.always-allow-weird-movement", alwaysAllowWeirdMovement,
"Means ignoring messages like 'moved too quickly' and 'moved wrongly'");
updateSuppressionCrashFix = getBoolean(config, "settings.misc.update-suppression-crash-fix", updateSuppressionCrashFix);
}
public static boolean enableFasterTntOptimization = true;

View File

@@ -10,6 +10,7 @@ import java.util.Map;
import static org.bxteam.divinemc.DivineConfig.log;
@SuppressWarnings("unused")
@NullMarked
public final class DivineWorldConfig {
private final YamlConfiguration config;
@@ -74,9 +75,18 @@ public final class DivineWorldConfig {
}
public boolean snowballCanKnockback = true;
public boolean disableSnowballSaving = false;
public boolean eggCanKnockback = true;
private void setSnowballAndEggKnockback() {
public boolean disableFireworkSaving = false;
private void projectilesSettings() {
snowballCanKnockback = getBoolean("gameplay-mechanics.projectiles.snowball.knockback", snowballCanKnockback);
disableSnowballSaving = getBoolean("gameplay-mechanics.projectiles.snowball.disable-saving", disableSnowballSaving);
eggCanKnockback = getBoolean("gameplay-mechanics.projectiles.egg.knockback", eggCanKnockback);
disableFireworkSaving = getBoolean("gameplay-mechanics.projectiles.firework.disable-saving", disableFireworkSaving);
}
public boolean allowEntityPortalWithPassenger = true;
private void unsupportedFeatures() {
allowEntityPortalWithPassenger = getBoolean("unsupported-features.allow-entity-portal-with-passenger", allowEntityPortalWithPassenger);
}
}

View File

@@ -0,0 +1,31 @@
package org.bxteam.divinemc.util.exception;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.Block;
public class UpdateSuppressorException extends RuntimeException {
private final BlockPos pos;
private final Block source;
public UpdateSuppressorException(BlockPos pos, Block source) {
super("Update suppression");
this.pos = pos;
this.source = source;
}
public BlockPos getPos() {
return pos;
}
public Block getSource() {
return source;
}
public String getMessage() {
if (pos != null) {
return "An update suppression processed, form [%s] to [x:%d,y:%d,z:%d]".formatted(source.getName(), pos.getX(), pos.getY(), pos.getZ());
} else {
return "An update suppression processed, form [%s]".formatted(source.getName());
}
}
}