mirror of
https://github.com/BX-Team/DivineMC.git
synced 2026-01-04 15:31:43 +00:00
[ci-skip] starting update 1.20.6
This commit is contained in:
532
patches/unapplied/server/0002-Divine-Configuration.patch
Normal file
532
patches/unapplied/server/0002-Divine-Configuration.patch
Normal file
@@ -0,0 +1,532 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Mon, 27 Mar 2023 13:16:41 +0300
|
||||
Subject: [PATCH] Divine Configuration
|
||||
|
||||
This is modified config file by PurpurMC
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 5ca6af93362d205438f8321ee2461ae7f8160df1..41cffa00d4978f46b47ac6ede2da2a256796a0ba 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -1,20 +1,15 @@
|
||||
package net.minecraft.server.dedicated;
|
||||
|
||||
-import com.google.common.collect.Lists;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.datafixers.DataFixer;
|
||||
import com.mojang.logging.LogUtils;
|
||||
-import java.io.BufferedReader;
|
||||
+
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.IOException;
|
||||
-import java.io.InputStreamReader;
|
||||
import java.net.InetAddress;
|
||||
import java.net.Proxy;
|
||||
-import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
-import java.util.Collections;
|
||||
-import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
import java.util.function.BooleanSupplier;
|
||||
@@ -58,10 +53,10 @@ import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.io.IoBuilder;
|
||||
import org.bukkit.command.CommandSender;
|
||||
-import co.aikar.timings.MinecraftTimings; // Paper
|
||||
import org.bukkit.event.server.ServerCommandEvent;
|
||||
import org.bukkit.craftbukkit.util.Waitable; // Paper
|
||||
import org.bukkit.event.server.RemoteServerCommandEvent;
|
||||
+import space.bxteam.divinemc.configuration.DivineConfig;
|
||||
// CraftBukkit end
|
||||
|
||||
public class DedicatedServer extends MinecraftServer implements ServerInterface {
|
||||
@@ -235,6 +230,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
gg.pufferfish.pufferfish.PufferfishConfig.load(); // Pufferfish
|
||||
gg.pufferfish.pufferfish.PufferfishCommand.init(); // Pufferfish
|
||||
|
||||
+ // DivineMC start
|
||||
+ try {
|
||||
+ DivineConfig.init((java.io.File) options.valueOf("divinemc-settings"));
|
||||
+ } catch (Exception e) {
|
||||
+ DedicatedServer.LOGGER.error("Unable to load server configuration", e);
|
||||
+ return false;
|
||||
+ }
|
||||
+ DivineConfig.registerCommands();
|
||||
+ // DivineMC end
|
||||
+
|
||||
this.setPvpAllowed(dedicatedserverproperties.pvp);
|
||||
this.setFlightAllowed(dedicatedserverproperties.allowFlight);
|
||||
this.setMotd(dedicatedserverproperties.motd);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index eebe6378de52e780aabfad3c414564349196ec6e..7dc96d5fd30dc17af23157dedab4edb7caa7551e 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -10,9 +10,10 @@ import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.function.Supplier;
|
||||
import javax.annotation.Nullable;
|
||||
+
|
||||
+import space.bxteam.divinemc.configuration.DivineWorldConfig;
|
||||
import net.minecraft.CrashReport;
|
||||
import net.minecraft.CrashReportCategory;
|
||||
-import net.minecraft.ReportedException;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Holder;
|
||||
@@ -26,14 +27,12 @@ import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
-import io.papermc.paper.util.MCUtil;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.FullChunkStatus;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
-import net.minecraft.util.AbortableIterationConsumer;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.util.profiling.ProfilerFiller;
|
||||
@@ -42,8 +41,6 @@ import net.minecraft.world.TickRateManager;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.damagesource.DamageSources;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
-import net.minecraft.world.entity.boss.EnderDragonPart;
|
||||
-import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
@@ -89,17 +86,14 @@ import net.minecraft.network.protocol.game.ClientboundSetBorderSizePacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundSetBorderWarningDelayPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundSetBorderWarningDistancePacket;
|
||||
import org.bukkit.Bukkit;
|
||||
-import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.block.CapturedBlockState;
|
||||
import org.bukkit.craftbukkit.block.CraftBlockState;
|
||||
import org.bukkit.craftbukkit.block.data.CraftBlockData;
|
||||
import org.bukkit.craftbukkit.util.CraftSpawnCategory;
|
||||
-import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
import org.bukkit.entity.SpawnCategory;
|
||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||
-import org.bukkit.event.world.GenericGameEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -174,6 +168,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
|
||||
public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray
|
||||
public final org.purpurmc.purpur.PurpurWorldConfig purpurConfig; // Purpur
|
||||
+ public final DivineWorldConfig divinemcConfig; // DivineMC
|
||||
public final co.aikar.timings.WorldTimingsHandler timings; // Paper
|
||||
public static BlockPos lastPhysicsProblem; // Spigot
|
||||
private org.spigotmc.TickLimiter entityLimiter;
|
||||
@@ -266,6 +261,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
||||
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
|
||||
this.purpurConfig = new org.purpurmc.purpur.PurpurWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), env); // Purpur
|
||||
+ this.divinemcConfig = new DivineWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), env); // DivineMC
|
||||
this.playerBreedingCooldowns = this.getNewBreedingCooldownCache(); // Purpur
|
||||
this.generator = gen;
|
||||
this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 3580f6a555991702956b4dafc8ab9474817c6d94..1e3c4131e9dd155e4a0830d4c3f76f7f93146fff 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -14,6 +14,7 @@ import com.mojang.brigadier.tree.CommandNode;
|
||||
import com.mojang.brigadier.tree.LiteralCommandNode;
|
||||
import com.mojang.serialization.Dynamic;
|
||||
import com.mojang.serialization.Lifecycle;
|
||||
+import space.bxteam.divinemc.configuration.DivineConfig;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -245,7 +246,6 @@ import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.ServicesManager;
|
||||
import org.bukkit.plugin.SimplePluginManager;
|
||||
import org.bukkit.plugin.SimpleServicesManager;
|
||||
-import org.bukkit.plugin.java.JavaPluginLoader;
|
||||
import org.bukkit.plugin.messaging.Messenger;
|
||||
import org.bukkit.plugin.messaging.StandardMessenger;
|
||||
import org.bukkit.potion.Potion;
|
||||
@@ -1069,6 +1069,7 @@ public final class CraftServer implements Server {
|
||||
org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot
|
||||
this.console.paperConfigurations.reloadConfigs(this.console);
|
||||
org.purpurmc.purpur.PurpurConfig.init((File) console.options.valueOf("purpur-settings")); // Purpur
|
||||
+ DivineConfig.init((File) console.options.valueOf("divinemc-settings")); // DivineMC
|
||||
for (ServerLevel world : this.console.getAllLevels()) {
|
||||
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
|
||||
world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters, config.spawnAnimals); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean))
|
||||
@@ -1085,6 +1086,7 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
world.spigotConfig.init(); // Spigot
|
||||
world.purpurConfig.init(); // Purpur
|
||||
+ world.divinemcConfig.init(); // DivineMC
|
||||
}
|
||||
|
||||
Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper
|
||||
@@ -1101,6 +1103,7 @@ public final class CraftServer implements Server {
|
||||
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
|
||||
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
|
||||
org.purpurmc.purpur.PurpurConfig.registerCommands(); // Purpur
|
||||
+ DivineConfig.registerCommands(); // DivineMC
|
||||
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
||||
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
||||
|
||||
@@ -3111,6 +3114,13 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
// Purpur end
|
||||
|
||||
+ // DivineMC start
|
||||
+ @Override
|
||||
+ public YamlConfiguration getDivineConfig() {
|
||||
+ return DivineConfig.config;
|
||||
+ }
|
||||
+ // DivineMC end
|
||||
+
|
||||
@Override
|
||||
public void restart() {
|
||||
org.spigotmc.RestartCommand.restart();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index 146f229b8e8888e2c0256c007c71c675c27e71a5..95da71042ee22db18116860bd9a629ff4b0c81ad 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -188,6 +188,14 @@ public class Main {
|
||||
.describedAs("Yml file");
|
||||
// Purpur end
|
||||
|
||||
+ // DivineMC start
|
||||
+ acceptsAll(asList("divinemc", "divinemc-settings"), "File for divinemc settings")
|
||||
+ .withRequiredArg()
|
||||
+ .ofType(File.class)
|
||||
+ .defaultsTo(new File("divinemc.yml"))
|
||||
+ .describedAs("Yml file");
|
||||
+ // DivineMC end
|
||||
+
|
||||
// Paper start
|
||||
acceptsAll(asList("server-name"), "Name of the server")
|
||||
.withRequiredArg()
|
||||
diff --git a/src/main/java/space/bxteam/divinemc/DivineCommand.java b/src/main/java/space/bxteam/divinemc/DivineCommand.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..d81f74dd17aa3f49e28aa0b2956bcb79a4d7b379
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/space/bxteam/divinemc/DivineCommand.java
|
||||
@@ -0,0 +1,66 @@
|
||||
+package space.bxteam.divinemc;
|
||||
+
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.server.level.ServerLevel;
|
||||
+import space.bxteam.divinemc.configuration.DivineConfig;
|
||||
+import org.bukkit.ChatColor;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.command.Command;
|
||||
+import org.bukkit.command.CommandSender;
|
||||
+
|
||||
+import java.io.File;
|
||||
+import java.util.Collections;
|
||||
+import java.util.List;
|
||||
+import java.util.stream.Collectors;
|
||||
+import java.util.stream.Stream;
|
||||
+
|
||||
+public class DivineCommand extends Command {
|
||||
+ public DivineCommand(String name) {
|
||||
+ super(name);
|
||||
+ this.description = "DivineMC related commands";
|
||||
+ this.usageMessage = "/divinemc [reload | version]";
|
||||
+ this.setPermission("bukkit.command.divinemc");
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public List<String> tabComplete(CommandSender sender, String alias, String[] args, Location location) throws IllegalArgumentException {
|
||||
+ if (args.length == 1) {
|
||||
+ return Stream.of("reload", "version")
|
||||
+ .filter(arg -> arg.startsWith(args[0].toLowerCase()))
|
||||
+ .collect(Collectors.toList());
|
||||
+ }
|
||||
+ return Collections.emptyList();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean execute(CommandSender sender, String commandLabel, String[] args) {
|
||||
+ if (!testPermission(sender)) return true;
|
||||
+
|
||||
+ if (args.length != 1) {
|
||||
+ sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ if (args[0].equalsIgnoreCase("reload")) {
|
||||
+ Command.broadcastCommandMessage(sender, ChatColor.RED + "Please note that this command is not supported and may cause issues.");
|
||||
+ Command.broadcastCommandMessage(sender, ChatColor.RED + "If you encounter any issues please use the /stop command to restart your server.");
|
||||
+
|
||||
+ MinecraftServer console = MinecraftServer.getServer();
|
||||
+ DivineConfig.init((File) console.options.valueOf("divinemc-settings"));
|
||||
+ for (ServerLevel level : console.getAllLevels()) {
|
||||
+ level.divinemcConfig.init();
|
||||
+ level.resetBreedingCooldowns();
|
||||
+ }
|
||||
+ console.server.reloadCount++;
|
||||
+
|
||||
+ Command.broadcastCommandMessage(sender, ChatColor.GREEN + "DivineMC config reload complete.");
|
||||
+ } else if (args[0].equalsIgnoreCase("version")) {
|
||||
+ Command verCmd = org.bukkit.Bukkit.getServer().getCommandMap().getCommand("version");
|
||||
+ if (verCmd != null) {
|
||||
+ return verCmd.execute(sender, commandLabel, new String[0]);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return true;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java b/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c10403d781d25e4bb9e43d3f064fb1aebde00bfb
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java
|
||||
@@ -0,0 +1,155 @@
|
||||
+package space.bxteam.divinemc.configuration;
|
||||
+
|
||||
+import com.google.common.base.Throwables;
|
||||
+import com.google.common.collect.ImmutableMap;
|
||||
+import space.bxteam.divinemc.DivineCommand;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.world.level.block.Blocks;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.command.Command;
|
||||
+import org.bukkit.configuration.ConfigurationSection;
|
||||
+import org.bukkit.configuration.InvalidConfigurationException;
|
||||
+import org.bukkit.configuration.file.YamlConfiguration;
|
||||
+
|
||||
+import java.io.File;
|
||||
+import java.io.IOException;
|
||||
+import java.lang.reflect.InvocationTargetException;
|
||||
+import java.lang.reflect.Method;
|
||||
+import java.lang.reflect.Modifier;
|
||||
+import java.util.HashMap;
|
||||
+import java.util.List;
|
||||
+import java.util.Map;
|
||||
+import java.util.logging.Level;
|
||||
+
|
||||
+@SuppressWarnings("unused")
|
||||
+public class DivineConfig {
|
||||
+ private static final String HEADER = "This is the main configuration file for DivineMC.\n"
|
||||
+ + "If you need help with the configuration or have any questions related to DivineMC,\n"
|
||||
+ + "join us in our Discord server.\n"
|
||||
+ + "\n"
|
||||
+ + "Discord: https://discord.gg/p7cxhw7E2M \n"
|
||||
+ + "Docs: https://divinemc.bx-team.space/docs \n"
|
||||
+ + "New builds: https://github.com/DivineMC/DivineMC/releases/latest";
|
||||
+ private static File CONFIG_FILE;
|
||||
+ public static YamlConfiguration config;
|
||||
+
|
||||
+ private static Map<String, Command> commands;
|
||||
+
|
||||
+ public static int version;
|
||||
+ static boolean verbose;
|
||||
+
|
||||
+ public static void init(File configFile) {
|
||||
+ CONFIG_FILE = configFile;
|
||||
+ config = new YamlConfiguration();
|
||||
+ try {
|
||||
+ config.load(CONFIG_FILE);
|
||||
+ } catch (IOException ignore) {
|
||||
+ } catch (InvalidConfigurationException ex) {
|
||||
+ Bukkit.getLogger().log(Level.SEVERE, "Could not load divinemc.yml, please correct your syntax errors", ex);
|
||||
+ throw Throwables.propagate(ex);
|
||||
+ }
|
||||
+ config.options().header(HEADER);
|
||||
+ config.options().copyDefaults(true);
|
||||
+ verbose = getBoolean("verbose", false);
|
||||
+
|
||||
+ commands = new HashMap<>();
|
||||
+ commands.put("divinemc", new DivineCommand("divinemc"));
|
||||
+
|
||||
+ version = getInt("config-version", 3);
|
||||
+ set("config-version", 3);
|
||||
+
|
||||
+ readConfig(DivineConfig.class, null);
|
||||
+
|
||||
+ Blocks.rebuildCache();
|
||||
+ }
|
||||
+
|
||||
+ protected static void log(String s) {
|
||||
+ if (verbose) {
|
||||
+ log(Level.INFO, s);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ protected static void log(Level level, String s) {
|
||||
+ Bukkit.getLogger().log(level, s);
|
||||
+ }
|
||||
+
|
||||
+ public static void registerCommands() {
|
||||
+ for (Map.Entry<String, Command> entry : commands.entrySet()) {
|
||||
+ MinecraftServer.getServer().server.getCommandMap().register(entry.getKey(), "DivineMC", entry.getValue());
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ static void readConfig(Class<?> clazz, Object instance) {
|
||||
+ for (Method method : clazz.getDeclaredMethods()) {
|
||||
+ if (Modifier.isPrivate(method.getModifiers())) {
|
||||
+ if (method.getParameterTypes().length == 0 && method.getReturnType() == Void.TYPE) {
|
||||
+ try {
|
||||
+ method.setAccessible(true);
|
||||
+ method.invoke(instance);
|
||||
+ } catch (InvocationTargetException ex) {
|
||||
+ throw Throwables.propagate(ex.getCause());
|
||||
+ } catch (Exception ex) {
|
||||
+ Bukkit.getLogger().log(Level.SEVERE, "Error invoking " + method, ex);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ try {
|
||||
+ config.save(CONFIG_FILE);
|
||||
+ } catch (IOException ex) {
|
||||
+ Bukkit.getLogger().log(Level.SEVERE, "Could not save " + CONFIG_FILE, ex);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static void set(String path, Object val) {
|
||||
+ config.addDefault(path, val);
|
||||
+ config.set(path, val);
|
||||
+ }
|
||||
+
|
||||
+ private static String getString(String path, String def) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return config.getString(path, config.getString(path));
|
||||
+ }
|
||||
+
|
||||
+ private static boolean getBoolean(String path, boolean def) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return config.getBoolean(path, config.getBoolean(path));
|
||||
+ }
|
||||
+
|
||||
+ private static double getDouble(String path, double def) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return config.getDouble(path, config.getDouble(path));
|
||||
+ }
|
||||
+
|
||||
+ private static int getInt(String path, int def) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return config.getInt(path, config.getInt(path));
|
||||
+ }
|
||||
+
|
||||
+ private static <T> List getList(String path, T def) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return config.getList(path, config.getList(path));
|
||||
+ }
|
||||
+
|
||||
+ static Map<String, Object> getMap(String path, Map<String, Object> def) {
|
||||
+ if (def != null && config.getConfigurationSection(path) == null) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return def;
|
||||
+ }
|
||||
+ return toMap(config.getConfigurationSection(path));
|
||||
+ }
|
||||
+
|
||||
+ private static Map<String, Object> toMap(ConfigurationSection section) {
|
||||
+ ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder();
|
||||
+ if (section != null) {
|
||||
+ for (String key : section.getKeys(false)) {
|
||||
+ Object obj = section.get(key);
|
||||
+ if (obj != null) {
|
||||
+ builder.put(key, obj instanceof ConfigurationSection val ? toMap(val) : obj);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return builder.build();
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java b/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..3e64e0d2d925f9fca1eb38cc07c20cae785ef39f
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java
|
||||
@@ -0,0 +1,80 @@
|
||||
+package space.bxteam.divinemc.configuration;
|
||||
+
|
||||
+import org.apache.commons.lang.BooleanUtils;
|
||||
+import org.bukkit.World;
|
||||
+import org.bukkit.configuration.ConfigurationSection;
|
||||
+
|
||||
+import java.util.List;
|
||||
+import java.util.Map;
|
||||
+import java.util.function.Predicate;
|
||||
+
|
||||
+import static space.bxteam.divinemc.configuration.DivineConfig.log;
|
||||
+
|
||||
+@SuppressWarnings("unused")
|
||||
+public class DivineWorldConfig {
|
||||
+
|
||||
+ private final String worldName;
|
||||
+ private final World.Environment environment;
|
||||
+
|
||||
+ public DivineWorldConfig(String worldName, World.Environment environment) {
|
||||
+ this.worldName = worldName;
|
||||
+ this.environment = environment;
|
||||
+ init();
|
||||
+ }
|
||||
+
|
||||
+ public void init() {
|
||||
+ log("-------- World Settings For [" + worldName + "] --------");
|
||||
+ DivineConfig.readConfig(DivineWorldConfig.class, this);
|
||||
+ }
|
||||
+
|
||||
+ private void set(String path, Object val) {
|
||||
+ DivineConfig.config.addDefault("world-settings.default." + path, val);
|
||||
+ DivineConfig.config.set("world-settings.default." + path, val);
|
||||
+ if (DivineConfig.config.get("world-settings." + worldName + "." + path) != null) {
|
||||
+ DivineConfig.config.addDefault("world-settings." + worldName + "." + path, val);
|
||||
+ DivineConfig.config.set("world-settings." + worldName + "." + path, val);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private ConfigurationSection getConfigurationSection(String path) {
|
||||
+ ConfigurationSection section = DivineConfig.config.getConfigurationSection("world-settings." + worldName + "." + path);
|
||||
+ return section != null ? section : DivineConfig.config.getConfigurationSection("world-settings.default." + path);
|
||||
+ }
|
||||
+
|
||||
+ private String getString(String path, String def) {
|
||||
+ DivineConfig.config.addDefault("world-settings.default." + path, def);
|
||||
+ return DivineConfig.config.getString("world-settings." + worldName + "." + path, DivineConfig.config.getString("world-settings.default." + path));
|
||||
+ }
|
||||
+
|
||||
+ private boolean getBoolean(String path, boolean def) {
|
||||
+ DivineConfig.config.addDefault("world-settings.default." + path, def);
|
||||
+ return DivineConfig.config.getBoolean("world-settings." + worldName + "." + path, DivineConfig.config.getBoolean("world-settings.default." + path));
|
||||
+ }
|
||||
+
|
||||
+ private boolean getBoolean(String path, Predicate<Boolean> predicate) {
|
||||
+ String val = getString(path, "default").toLowerCase();
|
||||
+ Boolean bool = BooleanUtils.toBooleanObject(val, "true", "false", "default");
|
||||
+ return predicate.test(bool);
|
||||
+ }
|
||||
+
|
||||
+ private double getDouble(String path, double def) {
|
||||
+ DivineConfig.config.addDefault("world-settings.default." + path, def);
|
||||
+ return DivineConfig.config.getDouble("world-settings." + worldName + "." + path, DivineConfig.config.getDouble("world-settings.default." + path));
|
||||
+ }
|
||||
+
|
||||
+ private int getInt(String path, int def) {
|
||||
+ DivineConfig.config.addDefault("world-settings.default." + path, def);
|
||||
+ return DivineConfig.config.getInt("world-settings." + worldName + "." + path, DivineConfig.config.getInt("world-settings.default." + path));
|
||||
+ }
|
||||
+
|
||||
+ private <T> List<?> getList(String path, T def) {
|
||||
+ DivineConfig.config.addDefault("world-settings.default." + path, def);
|
||||
+ return DivineConfig.config.getList("world-settings." + worldName + "." + path, DivineConfig.config.getList("world-settings.default." + path));
|
||||
+ }
|
||||
+
|
||||
+ private Map<String, Object> getMap(String path, Map<String, Object> def) {
|
||||
+ final Map<String, Object> fallback = DivineConfig.getMap("world-settings.default." + path, def);
|
||||
+ final Map<String, Object> value = DivineConfig.getMap("world-settings." + worldName + "." + path, null);
|
||||
+ return value.isEmpty() ? fallback : value;
|
||||
+ }
|
||||
+}
|
||||
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Fri, 31 Mar 2023 00:39:40 +0300
|
||||
Subject: [PATCH] Fix MC-98160 and MC-105103
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||
index 7e9c88efd2a1edea673d1ef81635c2891a04d30e..26475c2d69537053a041ec9c2f8147842848a8fc 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||
@@ -862,7 +862,7 @@ public class Boat extends VehicleEntity implements VariantHolder<Boat.Type> {
|
||||
if (!this.isPassenger()) {
|
||||
if (onGround) {
|
||||
if (this.fallDistance > 3.0F) {
|
||||
- if (this.status != Boat.Status.ON_LAND) {
|
||||
+ if (this.status != Boat.Status.ON_LAND && this.status != Status.IN_AIR) { // DivineMC - Fix MC-98160 and MC-105103
|
||||
this.resetFallDistance();
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,408 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Mon, 27 Mar 2023 13:16:41 +0300
|
||||
Subject: [PATCH] Optimize default values for configs
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
index 30fe1c0645a07d663b08c0f988a1ab3a750bf7c4..f8ceb440d402044f3b5e7925981029c893d8c17f 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
@@ -96,9 +96,11 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
|
||||
@Deprecated(forRemoval = true)
|
||||
public class Timings extends ConfigurationPart {
|
||||
- public boolean enabled = true;
|
||||
- public boolean verbose = true;
|
||||
- public String url = "https://timings.aikar.co/";
|
||||
+ // DivineMC start - optimize default values for configs - disable default metrics
|
||||
+ public boolean enabled = false;
|
||||
+ public boolean verbose = false;
|
||||
+ public String url = "https://timin.gs/";
|
||||
+ // DivineMC end
|
||||
public boolean serverNamePrivacy = false;
|
||||
public List<String> hiddenConfigEntries = List.of(
|
||||
"database",
|
||||
@@ -330,9 +332,9 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
public boolean fixEntityPositionDesync = true;
|
||||
public boolean loadPermissionsYmlBeforePlugins = true;
|
||||
@Constraints.Min(4)
|
||||
- public int regionFileCacheSize = 256;
|
||||
+ public int regionFileCacheSize = 512; // DivineMC - optimize default values for configs
|
||||
@Comment("See https://luckformula.emc.gs")
|
||||
- public boolean useAlternativeLuckFormula = false;
|
||||
+ public boolean useAlternativeLuckFormula = true; // DivineMC - optimize default values for configs
|
||||
public boolean useDimensionTypeForCustomSpawners = false;
|
||||
public boolean strictAdvancementDimensionCheck = false;
|
||||
public IntOr.Default compressionLevel = IntOr.Default.USE_DEFAULT;
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
index d3fdf62912d190f8b468b77230a927023c361074..6117022d293c16b3794cc8c828f76be6094dedb4 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
@@ -151,9 +151,9 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
|
||||
public ArmorStands armorStands;
|
||||
|
||||
- public class ArmorStands extends ConfigurationPart {
|
||||
- public boolean doCollisionEntityLookups = true;
|
||||
- public boolean tick = true;
|
||||
+ public class ArmorStands extends ConfigurationPart { // DivineMC - optimize default values for configs
|
||||
+ public boolean doCollisionEntityLookups = false;
|
||||
+ public boolean tick = false;
|
||||
}
|
||||
|
||||
public Markers markers;
|
||||
@@ -253,8 +253,8 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
public Behavior behavior;
|
||||
|
||||
public class Behavior extends ConfigurationPart {
|
||||
- public boolean disableChestCatDetection = false;
|
||||
- public boolean spawnerNerfedMobsShouldJump = false;
|
||||
+ public boolean disableChestCatDetection = true; // DivineMC - optimize default values for configs
|
||||
+ public boolean spawnerNerfedMobsShouldJump = true; // DivineMC - optimize default values for configs
|
||||
public int experienceMergeMaxValue = -1;
|
||||
public boolean shouldRemoveDragon = false;
|
||||
public boolean zombiesTargetTurtleEggs = true;
|
||||
@@ -278,7 +278,7 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
public int playerInsomniaStartTicks = 72000;
|
||||
public int phantomsSpawnAttemptMinSeconds = 60;
|
||||
public int phantomsSpawnAttemptMaxSeconds = 119;
|
||||
- public boolean parrotsAreUnaffectedByPlayerMovement = false;
|
||||
+ public boolean parrotsAreUnaffectedByPlayerMovement = true; // DivineMC - optimize default values for configs
|
||||
@BelowZeroToEmpty
|
||||
public DoubleOr.Default zombieVillagerInfectionChance = DoubleOr.Default.USE_DEFAULT;
|
||||
public MobsCanAlwaysPickUpLoot mobsCanAlwaysPickUpLoot;
|
||||
@@ -289,7 +289,7 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
}
|
||||
|
||||
public boolean disablePlayerCrits = false;
|
||||
- public boolean nerfPigmenFromNetherPortals = false;
|
||||
+ public boolean nerfPigmenFromNetherPortals = true; // DivineMC - optimize default values for configs
|
||||
public PillagerPatrols pillagerPatrols;
|
||||
|
||||
public class PillagerPatrols extends ConfigurationPart {
|
||||
@@ -383,7 +383,7 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
public class Environment extends ConfigurationPart {
|
||||
public boolean disableThunder = false;
|
||||
public boolean disableIceAndSnow = false;
|
||||
- public boolean optimizeExplosions = false;
|
||||
+ public boolean optimizeExplosions = true; // DivineMC - optimize default values for configs
|
||||
public boolean disableExplosionKnockback = false;
|
||||
public boolean generateFlatBedrock = false;
|
||||
public FrostedIce frostedIce;
|
||||
@@ -432,7 +432,7 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
|
||||
public class Maps extends ConfigurationPart {
|
||||
public int itemFrameCursorLimit = 128;
|
||||
- public int itemFrameCursorUpdateInterval = 10;
|
||||
+ public int itemFrameCursorUpdateInterval = 20; // DivineMC - optimize default values for configs
|
||||
}
|
||||
|
||||
public Fixes fixes;
|
||||
@@ -458,7 +458,7 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
public class Hopper extends ConfigurationPart {
|
||||
public boolean cooldownWhenFull = true;
|
||||
public boolean disableMoveEvent = false;
|
||||
- public boolean ignoreOccludingBlocks = false;
|
||||
+ public boolean ignoreOccludingBlocks = true; // DivineMC - optimize default values for configs
|
||||
}
|
||||
|
||||
public Collisions collisions;
|
||||
@@ -466,9 +466,9 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
public class Collisions extends ConfigurationPart {
|
||||
public boolean onlyPlayersCollide = false;
|
||||
public boolean allowVehicleCollisions = true;
|
||||
- public boolean fixClimbingBypassingCrammingRule = false;
|
||||
+ public boolean fixClimbingBypassingCrammingRule = true; // DivineMC - optimize default values for configs
|
||||
@RequiresSpigotInitialization(MaxEntityCollisionsInitializer.class)
|
||||
- public int maxEntityCollisions = 8;
|
||||
+ public int maxEntityCollisions = 2; // DivineMC - optimize default values for configs
|
||||
public boolean allowPlayerCrammingDamage = false;
|
||||
}
|
||||
|
||||
@@ -476,18 +476,31 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
|
||||
public class Chunks extends ConfigurationPart {
|
||||
public AutosavePeriod autoSaveInterval = AutosavePeriod.def();
|
||||
- public int maxAutoSaveChunksPerTick = 24;
|
||||
+ public int maxAutoSaveChunksPerTick = 12;
|
||||
public int fixedChunkInhabitedTime = -1;
|
||||
- public boolean preventMovingIntoUnloadedChunks = false;
|
||||
- public Duration delayChunkUnloadsBy = Duration.of("10s");
|
||||
+ public boolean preventMovingIntoUnloadedChunks = true; // DivineMC - optimize default values for configs
|
||||
+ public Duration delayChunkUnloadsBy = Duration.of("5s"); // DivineMC - optimize default values for configs
|
||||
public Reference2IntMap<EntityType<?>> entityPerChunkSaveLimit = Util.make(new Reference2IntOpenHashMap<>(BuiltInRegistries.ENTITY_TYPE.size()), map -> {
|
||||
- map.defaultReturnValue(-1);
|
||||
- map.put(EntityType.EXPERIENCE_ORB, -1);
|
||||
- map.put(EntityType.SNOWBALL, -1);
|
||||
- map.put(EntityType.ENDER_PEARL, -1);
|
||||
- map.put(EntityType.ARROW, -1);
|
||||
- map.put(EntityType.FIREBALL, -1);
|
||||
- map.put(EntityType.SMALL_FIREBALL, -1);
|
||||
+ // DivineMC start - optimize default values for configs
|
||||
+ map.put(EntityType.EXPERIENCE_ORB, 16);
|
||||
+ map.put(EntityType.SNOWBALL, 8);
|
||||
+ map.put(EntityType.ENDER_PEARL, 8);
|
||||
+ map.put(EntityType.ARROW, 16);
|
||||
+ map.put(EntityType.FIREBALL, 8);
|
||||
+ map.put(EntityType.SMALL_FIREBALL, 8);
|
||||
+ map.put(EntityType.DRAGON_FIREBALL, 3);
|
||||
+ map.put(EntityType.EGG, 8);
|
||||
+ map.put(EntityType.EYE_OF_ENDER, 8);
|
||||
+ map.put(EntityType.FIREWORK_ROCKET, 8);
|
||||
+ map.put(EntityType.POTION, 8);
|
||||
+ map.put(EntityType.LLAMA_SPIT, 3);
|
||||
+ map.put(EntityType.SHULKER_BULLET, 8);
|
||||
+ map.put(EntityType.SPECTRAL_ARROW, 16);
|
||||
+ map.put(EntityType.EXPERIENCE_BOTTLE, 3);
|
||||
+ map.put(EntityType.TRIDENT, 16);
|
||||
+ map.put(EntityType.WITHER_SKULL, 4);
|
||||
+ map.put(EntityType.AREA_EFFECT_CLOUD, 8);
|
||||
+ // DivineMC end
|
||||
});
|
||||
public boolean flushRegionsOnSave = false;
|
||||
}
|
||||
@@ -502,13 +515,15 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
public TickRates tickRates;
|
||||
|
||||
public class TickRates extends ConfigurationPart {
|
||||
- public int grassSpread = 1;
|
||||
- public int containerUpdate = 1;
|
||||
- public int mobSpawner = 1;
|
||||
+ // DivineMC start - optimize default values for configs
|
||||
+ public int grassSpread = 4;
|
||||
+ public int containerUpdate = 3;
|
||||
+ public int mobSpawner = 2;
|
||||
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));
|
||||
+ public Table<EntityType<?>, String, Integer> sensor = Util.make(HashBasedTable.create(), table -> table.put(EntityType.VILLAGER, "secondarypoisensor", 80));
|
||||
+ public Table<EntityType<?>, String, Integer> behavior = Util.make(HashBasedTable.create(), table -> table.put(EntityType.VILLAGER, "validatenearbypoi", 60));
|
||||
+ // DivineMC end
|
||||
}
|
||||
|
||||
@Setting(FeatureSeedsGeneration.FEATURE_SEEDS_KEY)
|
||||
@@ -517,7 +532,7 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
public class FeatureSeeds extends ConfigurationPart {
|
||||
@SuppressWarnings("unused") // Is used in FeatureSeedsGeneration
|
||||
@Setting(FeatureSeedsGeneration.GENERATE_KEY)
|
||||
- public boolean generateRandomSeedsForAll = false;
|
||||
+ public boolean generateRandomSeedsForAll = true; // DivineMC - optimize default values for configs
|
||||
@Setting(FeatureSeedsGeneration.FEATURES_KEY)
|
||||
public Reference2LongMap<Holder<ConfiguredFeature<?, ?>>> features = new Reference2LongOpenHashMap<>();
|
||||
|
||||
@@ -538,9 +553,9 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
|
||||
public class Misc extends ConfigurationPart {
|
||||
public int lightQueueSize = 20;
|
||||
- public boolean updatePathfindingOnBlockUpdate = true;
|
||||
+ public boolean updatePathfindingOnBlockUpdate = false; // DivineMC - optimize default values for configs
|
||||
public boolean showSignClickCommandFailureMsgsToPlayer = false;
|
||||
- public RedstoneImplementation redstoneImplementation = RedstoneImplementation.VANILLA;
|
||||
+ public RedstoneImplementation redstoneImplementation = RedstoneImplementation.ALTERNATE_CURRENT; // DivineMC - optimize default values for configs
|
||||
public boolean disableEndCredits = false;
|
||||
public float maxLeashDistance = 10f;
|
||||
public boolean disableSprintInterruptionOnAttack = false;
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index 486f69a94f3a5dfd1b13a74fcf780ff8f9ab37ba..fe4c1659f0ca111db8a6d2d6b06d1783872705d6 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -241,7 +241,7 @@ public class PurpurConfig {
|
||||
laggingThreshold = getDouble("settings.lagging-threshold", laggingThreshold);
|
||||
}
|
||||
|
||||
- public static boolean useAlternateKeepAlive = false;
|
||||
+ public static boolean useAlternateKeepAlive = true;
|
||||
private static void useAlternateKeepAlive() {
|
||||
useAlternateKeepAlive = getBoolean("settings.use-alternate-keepalive", useAlternateKeepAlive);
|
||||
}
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
index 6c260403d91d640da0473a3df56e1c5582459fde..252ff4c68e8c2ce4076ce02b4a89ca8eefddba7f 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
@@ -335,7 +335,7 @@ public class SpigotConfig
|
||||
public static boolean saveUserCacheOnStopOnly;
|
||||
private static void saveUserCacheOnStopOnly()
|
||||
{
|
||||
- SpigotConfig.saveUserCacheOnStopOnly = SpigotConfig.getBoolean( "settings.save-user-cache-on-stop-only", false );
|
||||
+ SpigotConfig.saveUserCacheOnStopOnly = SpigotConfig.getBoolean( "settings.save-user-cache-on-stop-only", true ); // DivineMC - optimize default values for configs
|
||||
}
|
||||
|
||||
public static double movedWronglyThreshold;
|
||||
@@ -396,8 +396,10 @@ public class SpigotConfig
|
||||
public static boolean logVillagerDeaths;
|
||||
public static boolean logNamedDeaths;
|
||||
private static void logDeaths() {
|
||||
- SpigotConfig.logVillagerDeaths = SpigotConfig.getBoolean("settings.log-villager-deaths", true);
|
||||
- SpigotConfig.logNamedDeaths = SpigotConfig.getBoolean("settings.log-named-deaths", true);
|
||||
+ // DivineMC start - optimize default values for configs
|
||||
+ SpigotConfig.logVillagerDeaths = SpigotConfig.getBoolean("settings.log-villager-deaths", false);
|
||||
+ SpigotConfig.logNamedDeaths = SpigotConfig.getBoolean("settings.log-named-deaths", false);
|
||||
+ // DivineMC end
|
||||
}
|
||||
|
||||
public static boolean disablePlayerDataSaving;
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index 1cf6d4f854d89c515e48e1fb365eb95ff9340765..f9ba24d32f4170c641e420991e6c358f6bd91be2 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -150,14 +150,14 @@ public class SpigotWorldConfig
|
||||
public double itemMerge;
|
||||
private void itemMerge()
|
||||
{
|
||||
- this.itemMerge = this.getDouble("merge-radius.item", 2.5 );
|
||||
+ this.itemMerge = this.getDouble("merge-radius.item", 3.5 ); // DivineMC - optimize default values for configs
|
||||
this.log( "Item Merge Radius: " + this.itemMerge );
|
||||
}
|
||||
|
||||
public double expMerge;
|
||||
private void expMerge()
|
||||
{
|
||||
- this.expMerge = this.getDouble("merge-radius.exp", 3.0 );
|
||||
+ this.expMerge = this.getDouble("merge-radius.exp", 4.0 ); // DivineMC - optimize default values for configs
|
||||
this.log( "Experience Merge Radius: " + this.expMerge );
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ public class SpigotWorldConfig
|
||||
public byte mobSpawnRange;
|
||||
private void mobSpawnRange()
|
||||
{
|
||||
- this.mobSpawnRange = (byte) getInt( "mob-spawn-range", 8 ); // Paper - Vanilla
|
||||
+ this.mobSpawnRange = (byte) getInt( "mob-spawn-range", 2 ); // Paper - Vanilla // DivineMC - optimize default values for configs
|
||||
this.log( "Mob Spawn Range: " + this.mobSpawnRange );
|
||||
}
|
||||
|
||||
@@ -207,14 +207,14 @@ public class SpigotWorldConfig
|
||||
this.log( "Item Despawn Rate: " + this.itemDespawnRate );
|
||||
}
|
||||
|
||||
- public int animalActivationRange = 32;
|
||||
- public int monsterActivationRange = 32;
|
||||
+ public int animalActivationRange = 16; // DivineMC - optimize default values for configs
|
||||
+ public int monsterActivationRange = 24; // DivineMC - optimize default values for configs
|
||||
public int raiderActivationRange = 48;
|
||||
- public int miscActivationRange = 16;
|
||||
+ public int miscActivationRange = 8; // DivineMC - optimize default values for configs
|
||||
// Paper start
|
||||
public int flyingMonsterActivationRange = 32;
|
||||
- public int waterActivationRange = 16;
|
||||
- public int villagerActivationRange = 32;
|
||||
+ public int waterActivationRange = 8; // DivineMC - optimize default values for configs
|
||||
+ public int villagerActivationRange = 16; // DivineMC - optimize default values for configs
|
||||
public int wakeUpInactiveAnimals = 4;
|
||||
public int wakeUpInactiveAnimalsEvery = 60*20;
|
||||
public int wakeUpInactiveAnimalsFor = 5*20;
|
||||
@@ -231,7 +231,7 @@ public class SpigotWorldConfig
|
||||
public int villagersWorkImmunityFor = 20;
|
||||
public boolean villagersActiveForPanic = true;
|
||||
// Paper end
|
||||
- public boolean tickInactiveVillagers = true;
|
||||
+ public boolean tickInactiveVillagers = false; // DivineMC - optimize default values for configs
|
||||
public boolean ignoreSpectatorActivation = false;
|
||||
private void activationRange()
|
||||
{
|
||||
@@ -299,7 +299,7 @@ public class SpigotWorldConfig
|
||||
{
|
||||
this.set( "ticks-per.hopper-check", 1 );
|
||||
}
|
||||
- this.hopperCheck = this.getInt( "ticks-per.hopper-check", 1 );
|
||||
+ this.hopperCheck = this.getInt( "ticks-per.hopper-check", 8 ); // DivineMC - optimize default values for configs
|
||||
this.hopperAmount = this.getInt( "hopper-amount", 1 );
|
||||
this.hopperCanLoadChunks = this.getBoolean( "hopper-can-load-chunks", false );
|
||||
this.log( "Hopper Transfer: " + this.hopperTransfer + " Hopper Check: " + this.hopperCheck + " Hopper Amount: " + this.hopperAmount + " Hopper Can Load Chunks: " + this.hopperCanLoadChunks );
|
||||
@@ -309,7 +309,7 @@ public class SpigotWorldConfig
|
||||
public int tridentDespawnRate;
|
||||
private void arrowDespawnRate()
|
||||
{
|
||||
- this.arrowDespawnRate = this.getInt( "arrow-despawn-rate", 1200 );
|
||||
+ this.arrowDespawnRate = this.getInt( "arrow-despawn-rate", 300 ); // DivineMC - optimize default values for configs
|
||||
this.tridentDespawnRate = this.getInt( "trident-despawn-rate", this.arrowDespawnRate );
|
||||
this.log( "Arrow Despawn Rate: " + this.arrowDespawnRate + " Trident Respawn Rate:" + this.tridentDespawnRate );
|
||||
}
|
||||
@@ -324,14 +324,14 @@ public class SpigotWorldConfig
|
||||
public boolean nerfSpawnerMobs;
|
||||
private void nerfSpawnerMobs()
|
||||
{
|
||||
- this.nerfSpawnerMobs = this.getBoolean( "nerf-spawner-mobs", false );
|
||||
+ this.nerfSpawnerMobs = this.getBoolean( "nerf-spawner-mobs", true ); // DivineMC - optimize default values for configs
|
||||
this.log( "Nerfing mobs spawned from spawners: " + this.nerfSpawnerMobs );
|
||||
}
|
||||
|
||||
public boolean enableZombiePigmenPortalSpawns;
|
||||
private void enableZombiePigmenPortalSpawns()
|
||||
{
|
||||
- this.enableZombiePigmenPortalSpawns = this.getBoolean( "enable-zombie-pigmen-portal-spawns", true );
|
||||
+ this.enableZombiePigmenPortalSpawns = this.getBoolean( "enable-zombie-pigmen-portal-spawns", false ); // DivineMC - optimize default values for configs
|
||||
this.log( "Allow Zombie Pigmen to spawn from portal blocks: " + this.enableZombiePigmenPortalSpawns );
|
||||
}
|
||||
|
||||
@@ -449,7 +449,7 @@ public class SpigotWorldConfig
|
||||
public int hangingTickFrequency;
|
||||
private void hangingTickFrequency()
|
||||
{
|
||||
- this.hangingTickFrequency = this.getInt( "hanging-tick-frequency", 100 );
|
||||
+ this.hangingTickFrequency = this.getInt( "hanging-tick-frequency", 200 ); // DivineMC - optimize default values for configs
|
||||
}
|
||||
|
||||
public int tileMaxTickTime;
|
||||
diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml
|
||||
index eef7c125b2689f29cae5464659eacdf33f5695b2..8dbcf5f20dd99dba5d21ec6cd293a7534652c328 100644
|
||||
--- a/src/main/resources/configurations/bukkit.yml
|
||||
+++ b/src/main/resources/configurations/bukkit.yml
|
||||
@@ -18,28 +18,28 @@ settings:
|
||||
update-folder: update
|
||||
plugin-profiling: false
|
||||
connection-throttle: 4000
|
||||
- query-plugins: true
|
||||
+ query-plugins: false
|
||||
deprecated-verbose: default
|
||||
shutdown-message: Server closed
|
||||
minimum-api: none
|
||||
use-map-color-cache: true
|
||||
spawn-limits:
|
||||
- monsters: 70
|
||||
- animals: 10
|
||||
- water-animals: 5
|
||||
- water-ambient: 20
|
||||
- water-underground-creature: 5
|
||||
- axolotls: 5
|
||||
- ambient: 15
|
||||
+ monsters: 20
|
||||
+ animals: 5
|
||||
+ water-animals: 2
|
||||
+ water-ambient: 2
|
||||
+ water-underground-creature: 3
|
||||
+ axolotls: 3
|
||||
+ ambient: 1
|
||||
chunk-gc:
|
||||
- period-in-ticks: 600
|
||||
+ period-in-ticks: 400
|
||||
ticks-per:
|
||||
animal-spawns: 400
|
||||
- monster-spawns: 1
|
||||
- water-spawns: 1
|
||||
- water-ambient-spawns: 1
|
||||
- water-underground-creature-spawns: 1
|
||||
- axolotl-spawns: 1
|
||||
- ambient-spawns: 1
|
||||
+ monster-spawns: 10
|
||||
+ water-spawns: 400
|
||||
+ water-ambient-spawns: 400
|
||||
+ water-underground-creature-spawns: 400
|
||||
+ axolotl-spawns: 400
|
||||
+ ambient-spawns: 400
|
||||
autosave: 6000
|
||||
-aliases: now-in-commands.yml
|
||||
+aliases: now-in-commands.yml
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/resources/configurations/commands.yml b/src/main/resources/configurations/commands.yml
|
||||
index 18f54571200e2eca09a39b88f170fe7b99d8618f..1b57d51d92c5c69286800d10baeaa936fa208cae 100644
|
||||
--- a/src/main/resources/configurations/commands.yml
|
||||
+++ b/src/main/resources/configurations/commands.yml
|
||||
@@ -12,5 +12,3 @@
|
||||
command-block-overrides: []
|
||||
ignore-vanilla-permissions: false
|
||||
aliases:
|
||||
- icanhasbukkit:
|
||||
- - "version $1-"
|
||||
@@ -0,0 +1,324 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Mon, 12 Jun 2023 15:31:21 +0300
|
||||
Subject: [PATCH] Add missing purpur config options
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
|
||||
index c783ce59ea766e6c46a3313628b961f27e01ee8b..4f6b6967f7f632752fcc4faac47dca51cfac1b79 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
|
||||
@@ -152,6 +152,23 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
|
||||
}
|
||||
// Purpur end
|
||||
|
||||
+ // DivineMC start - Add missing purpur config options
|
||||
+ @Override
|
||||
+ public boolean isSensitiveToWater() {
|
||||
+ return level().purpurConfig.allayTakeDamageFromWater;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isAlwaysExperienceDropper() {
|
||||
+ return level().purpurConfig.allayAlwaysDropExp;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void initAttributes() {
|
||||
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(level().purpurConfig.allayMaxHealth);
|
||||
+ }
|
||||
+ // DivineMC end
|
||||
+
|
||||
@Override
|
||||
protected Brain.Provider<Allay> brainProvider() {
|
||||
return Brain.provider(Allay.MEMORY_TYPES, Allay.SENSOR_TYPES);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
||||
index 8616a8c09a21f576a07daaa93ebf64e0f03d0c88..6725e22ef763b3cd374ff38f5f36ad6ef97c8a19 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
||||
@@ -99,6 +99,18 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl
|
||||
}
|
||||
// Purpur end
|
||||
|
||||
+ // DivineMC start - Add missing purpur config options
|
||||
+ @Override
|
||||
+ public boolean isSensitiveToWater() {
|
||||
+ return level().purpurConfig.camelTakeDamageFromWater;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isAlwaysExperienceDropper() {
|
||||
+ return level().purpurConfig.camelAlwaysDropExp;
|
||||
+ }
|
||||
+ // DivineMC end
|
||||
+
|
||||
@Override
|
||||
public void addAdditionalSaveData(CompoundTag nbt) {
|
||||
super.addAdditionalSaveData(nbt);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
|
||||
index 37f1d3c656997906cef57d9dbefc226d04fc65fe..8935f17cb02ab8d38e6269608e97e0cb18b0b051 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
|
||||
@@ -167,6 +167,23 @@ public class Frog extends Animal implements VariantHolder<FrogVariant> {
|
||||
return this.level().purpurConfig.frogBreedingTicks;
|
||||
}
|
||||
|
||||
+ // DivineMC start - Add missing purpur config options
|
||||
+ @Override
|
||||
+ public boolean isSensitiveToWater() {
|
||||
+ return level().purpurConfig.frogTakeDamageFromWater;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isAlwaysExperienceDropper() {
|
||||
+ return level().purpurConfig.frogAlwaysDropExp;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void initAttributes() {
|
||||
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(level().purpurConfig.frogMaxHealth);
|
||||
+ }
|
||||
+ // DivineMC end
|
||||
+
|
||||
@Override
|
||||
protected Brain.Provider<Frog> brainProvider() {
|
||||
return Brain.provider(MEMORY_TYPES, SENSOR_TYPES);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
|
||||
index 2a9c2a69a0589e4e7b7c79d3716376b360a2eba1..b12b79765301782202abfe6b6da2b279a015e927 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
|
||||
@@ -92,6 +92,23 @@ public class Tadpole extends AbstractFish {
|
||||
}
|
||||
// Purpur end
|
||||
|
||||
+ // DivineMC start - Add missing purpur config options
|
||||
+ @Override
|
||||
+ public boolean isSensitiveToWater() {
|
||||
+ return level().purpurConfig.tadpoleTakeDamageFromWater;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isAlwaysExperienceDropper() {
|
||||
+ return level().purpurConfig.tadpoleAlwaysDropExp;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void initAttributes() {
|
||||
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(level().purpurConfig.tadpoleMaxHealth);
|
||||
+ }
|
||||
+ // DivineMC end
|
||||
+
|
||||
@Override
|
||||
protected PathNavigation createNavigation(Level world) {
|
||||
return new WaterBoundPathNavigation(this, world);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
||||
index 5e7d76dcdc170b809ab82f6e2259c9b4d3d741be..459ea45bcd23ea55da6e561216eb664f97cacfa5 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
||||
@@ -118,6 +118,18 @@ public class Sniffer extends Animal {
|
||||
return this.level().purpurConfig.snifferBreedingTicks;
|
||||
}
|
||||
|
||||
+ // DivineMC start - Add missing purpur config options
|
||||
+ @Override
|
||||
+ public boolean isSensitiveToWater() {
|
||||
+ return level().purpurConfig.snifferTakeDamageFromWater;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isAlwaysExperienceDropper() {
|
||||
+ return level().purpurConfig.snifferAlwaysDropExp;
|
||||
+ }
|
||||
+ // DivineMC end
|
||||
+
|
||||
// CraftBukkit start - SPIGOT-7295: moved from constructor to appropriate location
|
||||
@Override
|
||||
protected void defineSynchedData() {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
||||
index bf7ef72a7d92db8f11789a69583270644de0dac7..1bcdee570baf1499d660d019cf03b66dd4d05195 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
||||
@@ -149,6 +149,23 @@ public class Warden extends Monster implements VibrationSystem {
|
||||
}
|
||||
// Purpur end
|
||||
|
||||
+ // DivineMC start - Add missing purpur config options
|
||||
+ @Override
|
||||
+ public boolean isSensitiveToWater() {
|
||||
+ return level().purpurConfig.wardenTakeDamageFromWater;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isAlwaysExperienceDropper() {
|
||||
+ return level().purpurConfig.wardenAlwaysDropExp;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void initAttributes() {
|
||||
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(level().purpurConfig.wardenMaxHealth);
|
||||
+ }
|
||||
+ // DivineMC end
|
||||
+
|
||||
@Override
|
||||
public Packet<ClientGamePacketListener> getAddEntityPacket() {
|
||||
return new ClientboundAddEntityPacket(this, this.hasPose(Pose.EMERGING) ? 1 : 0);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java
|
||||
index 58af87b8faf4f8d6bdb111c49a429466acface68..bbadae5873db4b49273b054c1921a401f119fc3a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java
|
||||
@@ -32,6 +32,9 @@ import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
// CraftBukkit end
|
||||
+// DivineMC start
|
||||
+import org.purpurmc.purpur.PurpurConfig;
|
||||
+// DivineMC end
|
||||
|
||||
public class ChestBoat extends Boat implements HasCustomInventoryScreen, ContainerEntity {
|
||||
|
||||
@@ -43,7 +46,7 @@ public class ChestBoat extends Boat implements HasCustomInventoryScreen, Contain
|
||||
|
||||
public ChestBoat(EntityType<? extends Boat> type, Level world) {
|
||||
super(type, world);
|
||||
- this.itemStacks = NonNullList.withSize(27, ItemStack.EMPTY);
|
||||
+ this.itemStacks = NonNullList.withSize(PurpurConfig.chestBoatRows * 9, ItemStack.EMPTY); // DivineMC start - Add missing purpur config options
|
||||
}
|
||||
|
||||
public ChestBoat(Level world, double d0, double d1, double d2) {
|
||||
@@ -170,7 +173,7 @@ public class ChestBoat extends Boat implements HasCustomInventoryScreen, Contain
|
||||
|
||||
@Override
|
||||
public int getContainerSize() {
|
||||
- return 27;
|
||||
+ return PurpurConfig.chestBoatRows * 9; // DivineMC - Add missing purpur config options
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index fe4c1659f0ca111db8a6d2d6b06d1783872705d6..80a5df11f57fb39a71461b774f0f5bcf94cd4c5c 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -328,6 +328,7 @@ public class PurpurConfig {
|
||||
}
|
||||
|
||||
public static int barrelRows = 3;
|
||||
+ public static int chestBoatRows = 3; // DivineMC - Add missing purpur config options
|
||||
public static boolean enderChestSixRows = false;
|
||||
public static boolean enderChestPermissionRows = false;
|
||||
public static boolean cryingObsidianValidForPortalFrame = false;
|
||||
@@ -368,6 +369,7 @@ public class PurpurConfig {
|
||||
case 1 -> 9;
|
||||
default -> 27;
|
||||
});
|
||||
+ chestBoatRows = getInt("settings.blocks.chest_boat.rows", chestBoatRows); // DivineMC - Add missing purpur config options
|
||||
enderChestSixRows = getBoolean("settings.blocks.ender_chest.six-rows", enderChestSixRows);
|
||||
org.bukkit.event.inventory.InventoryType.ENDER_CHEST.setDefaultSize(enderChestSixRows ? 54 : 27);
|
||||
enderChestPermissionRows = getBoolean("settings.blocks.ender_chest.use-permissions-for-rows", enderChestPermissionRows);
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 7dc82ffccc157a17335f1bc56ab81be3813294f6..41576be4fa6c3302274a4c8f48e84c87fb01c170 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -1170,7 +1170,17 @@ public class PurpurWorldConfig {
|
||||
public boolean allayRidableInWater = true;
|
||||
public boolean allayControllable = true;
|
||||
public List<String> allayRespectNBT = new ArrayList<>();
|
||||
+ // DivineMC start - Add missing purpur config options
|
||||
+ public double allayMaxHealth = 20.0D;
|
||||
+ public boolean allayTakeDamageFromWater = false;
|
||||
+ public boolean allayAlwaysDropExp = false;
|
||||
+ // DivineMC end
|
||||
private void allaySettings() {
|
||||
+ // DivineMC start - Add missing purpur config options
|
||||
+ allayMaxHealth = getDouble("mobs.allay.max-health", allayMaxHealth);
|
||||
+ allayTakeDamageFromWater = getBoolean("mobs.allay.take-damage-from-water", allayTakeDamageFromWater);
|
||||
+ allayAlwaysDropExp = getBoolean("mobs.allay.always-drop-exp", allayAlwaysDropExp);
|
||||
+ // DivineMC end
|
||||
allayRidable = getBoolean("mobs.allay.ridable", allayRidable);
|
||||
allayRidableInWater = getBoolean("mobs.allay.ridable-in-water", allayRidableInWater);
|
||||
allayControllable = getBoolean("mobs.allay.controllable", allayControllable);
|
||||
@@ -1289,7 +1299,15 @@ public class PurpurWorldConfig {
|
||||
public double camelMovementSpeedMin = 0.09D;
|
||||
public double camelMovementSpeedMax = 0.09D;
|
||||
public int camelBreedingTicks = 6000;
|
||||
+ // DivineMC start - Add missing purpur config options
|
||||
+ public boolean camelTakeDamageFromWater = false;
|
||||
+ public boolean camelAlwaysDropExp = false;
|
||||
+ // DivineMC end
|
||||
private void camelSettings() {
|
||||
+ // DivineMC start - Add missing purpur config options
|
||||
+ camelTakeDamageFromWater = getBoolean("mobs.camel.takes-damage-from-water", camelTakeDamageFromWater);
|
||||
+ camelAlwaysDropExp = getBoolean("mobs.camel.always-drop-exp", camelAlwaysDropExp);
|
||||
+ // DivineMC end
|
||||
camelRidableInWater = getBoolean("mobs.camel.ridable-in-water", camelRidableInWater);
|
||||
camelMaxHealthMin = getDouble("mobs.camel.attributes.max_health.min", camelMaxHealthMin);
|
||||
camelMaxHealthMax = getDouble("mobs.camel.attributes.max_health.max", camelMaxHealthMax);
|
||||
@@ -1717,7 +1735,17 @@ public class PurpurWorldConfig {
|
||||
public boolean frogControllable = true;
|
||||
public float frogRidableJumpHeight = 0.65F;
|
||||
public int frogBreedingTicks = 6000;
|
||||
+ // DivineMC start - Add missing purpur config options
|
||||
+ public double frogMaxHealth = 10.0D;
|
||||
+ public boolean frogTakeDamageFromWater = false;
|
||||
+ public boolean frogAlwaysDropExp = false;
|
||||
+ // DivineMC end
|
||||
private void frogSettings() {
|
||||
+ // DivineMC start - Add missing purpur config options
|
||||
+ frogMaxHealth = getDouble("mobs.frog.attributes.max_health", frogMaxHealth);
|
||||
+ frogTakeDamageFromWater = getBoolean("mobs.frog.takes-damage-from-water", frogTakeDamageFromWater);
|
||||
+ frogAlwaysDropExp = getBoolean("mobs.frog.always-drop-exp", frogAlwaysDropExp);
|
||||
+ // DivineMC end
|
||||
frogRidable = getBoolean("mobs.frog.ridable", frogRidable);
|
||||
frogRidableInWater = getBoolean("mobs.frog.ridable-in-water", frogRidableInWater);
|
||||
frogControllable = getBoolean("mobs.frog.controllable", frogControllable);
|
||||
@@ -2668,7 +2696,15 @@ public class PurpurWorldConfig {
|
||||
public boolean snifferControllable = true;
|
||||
public double snifferMaxHealth = 14.0D;
|
||||
public int snifferBreedingTicks = 6000;
|
||||
+ // DivineMC start - Add missing purpur config options
|
||||
+ public boolean snifferTakeDamageFromWater = false;
|
||||
+ public boolean snifferAlwaysDropExp = false;
|
||||
+ // DivineMC end
|
||||
private void snifferSettings() {
|
||||
+ // DivineMC start - Add missing purpur config options
|
||||
+ snifferTakeDamageFromWater = getBoolean("mobs.sniffer.takes-damage-from-water", snifferTakeDamageFromWater);
|
||||
+ snifferAlwaysDropExp = getBoolean("mobs.sniffer.always-drop-exp", snifferAlwaysDropExp);
|
||||
+ // DivineMC end
|
||||
snifferRidable = getBoolean("mobs.sniffer.ridable", snifferRidable);
|
||||
snifferRidableInWater = getBoolean("mobs.sniffer.ridable-in-water", snifferRidableInWater);
|
||||
snifferControllable = getBoolean("mobs.sniffer.controllable", snifferControllable);
|
||||
@@ -2767,7 +2803,17 @@ public class PurpurWorldConfig {
|
||||
public boolean tadpoleRidable = false;
|
||||
public boolean tadpoleRidableInWater = true;
|
||||
public boolean tadpoleControllable = true;
|
||||
+ // DivineMC start - Add missing purpur config options
|
||||
+ public double tadpoleMaxHealth = 10.0D;
|
||||
+ public boolean tadpoleTakeDamageFromWater = false;
|
||||
+ public boolean tadpoleAlwaysDropExp = false;
|
||||
+ // DivineMC end
|
||||
private void tadpoleSettings() {
|
||||
+ // DivineMC start - Add missing purpur config options
|
||||
+ tadpoleMaxHealth = getDouble("mobs.tadpole.attributes.max_health", tadpoleMaxHealth);
|
||||
+ tadpoleTakeDamageFromWater = getBoolean("mobs.tadpole.takes-damage-from-water", tadpoleTakeDamageFromWater);
|
||||
+ tadpoleAlwaysDropExp = getBoolean("mobs.tadpole.always-drop-exp", tadpoleAlwaysDropExp);
|
||||
+ // DivineMC end
|
||||
tadpoleRidable = getBoolean("mobs.tadpole.ridable", tadpoleRidable);
|
||||
tadpoleRidableInWater = getBoolean("mobs.tadpole.ridable-in-water", tadpoleRidableInWater);
|
||||
tadpoleControllable = getBoolean("mobs.tadpole.controllable", tadpoleControllable);
|
||||
@@ -2983,7 +3029,17 @@ public class PurpurWorldConfig {
|
||||
public boolean wardenRidable = false;
|
||||
public boolean wardenRidableInWater = true;
|
||||
public boolean wardenControllable = true;
|
||||
+ // DivineMC start - Add missing purpur config options
|
||||
+ public double wardenMaxHealth = 500.0D;
|
||||
+ public boolean wardenTakeDamageFromWater = false;
|
||||
+ public boolean wardenAlwaysDropExp = false;
|
||||
+ // DivineMC end
|
||||
private void wardenSettings() {
|
||||
+ // DivineMC start - Add missing purpur config options
|
||||
+ wardenMaxHealth = getDouble("mobs.warden.attributes.max_health", wardenMaxHealth);
|
||||
+ wardenTakeDamageFromWater = getBoolean("mobs.warden.takes-damage-from-water", wardenTakeDamageFromWater);
|
||||
+ wardenAlwaysDropExp = getBoolean("mobs.warden.always-drop-exp", wardenAlwaysDropExp);
|
||||
+ // DivineMC end
|
||||
wardenRidable = getBoolean("mobs.warden.ridable", wardenRidable);
|
||||
wardenRidableInWater = getBoolean("mobs.warden.ridable-in-water", wardenRidableInWater);
|
||||
wardenControllable = getBoolean("mobs.warden.controllable", wardenControllable);
|
||||
32
patches/unapplied/server/0006-Fix-MC-93826.patch
Normal file
32
patches/unapplied/server/0006-Fix-MC-93826.patch
Normal file
@@ -0,0 +1,32 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sat, 10 Jun 2023 12:44:58 +0300
|
||||
Subject: [PATCH] Fix MC-93826
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Animal.java b/src/main/java/net/minecraft/world/entity/animal/Animal.java
|
||||
index 8773b1072016a3bbf025959e9ab827704ec17fc6..90ae72a1ccf4acbac08bba7a3c453da01d2f57b3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Animal.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Animal.java
|
||||
@@ -42,6 +42,8 @@ public abstract class Animal extends AgeableMob {
|
||||
@Nullable
|
||||
public UUID loveCause;
|
||||
public ItemStack breedItem; // CraftBukkit - Add breedItem variable
|
||||
+ private Object level;
|
||||
+
|
||||
public abstract int getPurpurBreedTime(); // Purpur
|
||||
|
||||
protected Animal(EntityType<? extends Animal> type, Level world) {
|
||||
@@ -73,7 +75,11 @@ public abstract class Animal extends AgeableMob {
|
||||
double d1 = this.random.nextGaussian() * 0.02D;
|
||||
double d2 = this.random.nextGaussian() * 0.02D;
|
||||
|
||||
- this.level().addParticle(ParticleTypes.HEART, this.getRandomX(1.0D), this.getRandomY() + 0.5D, this.getRandomZ(1.0D), d0, d1, d2);
|
||||
+ // DivineMC start - Fix MC-93826
|
||||
+ if (this.level instanceof ServerLevel serverLevel) {
|
||||
+ serverLevel.sendParticles(ParticleTypes.HEART, this.getRandomX(1.0D), this.getRandomY() + 0.5D, this.getRandomZ(1.0D), 1, d0, d1, d2, 0);
|
||||
+ }
|
||||
+ // DivineMC end
|
||||
}
|
||||
}
|
||||
|
||||
45
patches/unapplied/server/0007-Fix-entity-serialization.patch
Normal file
45
patches/unapplied/server/0007-Fix-entity-serialization.patch
Normal file
@@ -0,0 +1,45 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Fri, 31 Mar 2023 00:39:40 +0300
|
||||
Subject: [PATCH] Fix entity serialization
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index f2c6b52fe7fbb05afa0074684cd195f6ae598f1f..8f948df85246ecbbca2c3c2b99e24f847b7386c6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2356,15 +2356,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
}
|
||||
}
|
||||
|
||||
- // Paper start - Entity serialization api
|
||||
- public boolean serializeEntity(CompoundTag compound) {
|
||||
- List<Entity> pass = new java.util.ArrayList<>(this.getPassengers());
|
||||
- this.passengers = ImmutableList.of();
|
||||
- boolean result = save(compound);
|
||||
- this.passengers = ImmutableList.copyOf(pass);
|
||||
- return result;
|
||||
- }
|
||||
- // Paper end - Entity serialization api
|
||||
public boolean save(CompoundTag nbt) {
|
||||
return this.isPassenger() ? false : this.saveAsPassenger(nbt);
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index e29dc1101c7aa4b7b2a2d2e732e27a1a14a2a234..bdbf2724204cb36de171900c2a8f92097da5102d 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -528,8 +528,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
Preconditions.checkNotNull(entity, "null cannot be serialized");
|
||||
Preconditions.checkArgument(entity instanceof org.bukkit.craftbukkit.entity.CraftEntity, "only CraftEntities can be serialized");
|
||||
|
||||
+ net.minecraft.world.entity.Entity nmsEntity = ((org.bukkit.craftbukkit.entity.CraftEntity) entity).getHandle();
|
||||
CompoundTag compound = new CompoundTag();
|
||||
- ((org.bukkit.craftbukkit.entity.CraftEntity) entity).getHandle().serializeEntity(compound);
|
||||
+ compound.putString("id", net.minecraft.world.entity.EntityType.getKey(nmsEntity.getType()).toString());
|
||||
+ List<net.minecraft.world.entity.Entity> pass = new java.util.ArrayList<>(nmsEntity.getPassengers());
|
||||
+ nmsEntity.passengers = com.google.common.collect.ImmutableList.of();
|
||||
+ nmsEntity.saveWithoutId(compound);
|
||||
+ nmsEntity.passengers = com.google.common.collect.ImmutableList.copyOf(pass);
|
||||
return serializeNbtToBytes(compound);
|
||||
}
|
||||
|
||||
36
patches/unapplied/server/0008-Don-t-save-Fireworks.patch
Normal file
36
patches/unapplied/server/0008-Don-t-save-Fireworks.patch
Normal file
@@ -0,0 +1,36 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Fri, 31 Mar 2023 22:47:12 +0300
|
||||
Subject: [PATCH] Don't save Fireworks
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
|
||||
index 5b3b59057b962438c6f4fc8a1507342865b3bc11..f09388fa1fb3a84da4678ea46761a55872a03cc8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
|
||||
@@ -355,4 +355,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
|
||||
public boolean isAttackable() {
|
||||
return false;
|
||||
}
|
||||
+
|
||||
+ // DivineMC start - Don't save Fireworks
|
||||
+ @Override
|
||||
+ public boolean shouldBeSaved() {
|
||||
+ return this.level().divinemcConfig.saveFireworks;
|
||||
+ }
|
||||
+ // DivineMC end
|
||||
}
|
||||
diff --git a/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java b/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java
|
||||
index 3e64e0d2d925f9fca1eb38cc07c20cae785ef39f..243b3d4379f4f6f273222a3611d8a463053d3e70 100644
|
||||
--- a/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java
|
||||
+++ b/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java
|
||||
@@ -77,4 +77,9 @@ public class DivineWorldConfig {
|
||||
final Map<String, Object> value = DivineConfig.getMap("world-settings." + worldName + "." + path, null);
|
||||
return value.isEmpty() ? fallback : value;
|
||||
}
|
||||
+
|
||||
+ public boolean saveFireworks = false;
|
||||
+ private void saveFireworks() {
|
||||
+ saveFireworks = getBoolean("gameplay-mechanics.should-save-fireworks", saveFireworks);
|
||||
+ }
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Fri, 31 Mar 2023 23:05:12 +0300
|
||||
Subject: [PATCH] Remove Spigot tick limiter
|
||||
|
||||
Original code by Titaniumtown, modified by NONPLAYT
|
||||
You can find the original code on https://gitlab.com/Titaniumtown/JettPack
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 7683f6a99dfac07ae6ab0d9fd42598b4f57907e8..702729d610d090af934f7b95c9e0877d9441df42 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -171,8 +171,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public final DivineWorldConfig divinemcConfig; // DivineMC
|
||||
public final co.aikar.timings.WorldTimingsHandler timings; // Paper
|
||||
public static BlockPos lastPhysicsProblem; // Spigot
|
||||
- private org.spigotmc.TickLimiter entityLimiter;
|
||||
- private org.spigotmc.TickLimiter tileLimiter;
|
||||
private int tileTickPosition;
|
||||
public final Map<Explosion.CacheKey, Float> explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions
|
||||
public java.util.ArrayDeque<net.minecraft.world.level.block.RedstoneTorchBlock.Toggle> redstoneUpdateInfos; // Paper - Faster redstone torch rapid clock removal; Move from Map in BlockRedstoneTorch to here
|
||||
@@ -343,9 +341,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
});
|
||||
// CraftBukkit end
|
||||
this.timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings
|
||||
- this.keepSpawnInMemory = this.paperConfig().spawn.keepSpawnLoaded; // Paper - Option to keep spawn chunks loaded
|
||||
- this.entityLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.entityMaxTickTime);
|
||||
- this.tileLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.tileMaxTickTime);
|
||||
+ this.keepSpawnInMemory = this.paperConfig().spawn.keepSpawnLoaded; // Paper - Option to keep spawn chunks loaded // DivineMC - Remove Spigot tick limiter
|
||||
this.chunkPacketBlockController = this.paperConfig().anticheat.antiXray.enabled ? new com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray(this, executor) : com.destroystokyo.paper.antixray.ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray
|
||||
// Paper start - optimise collisions
|
||||
this.minSection = io.papermc.paper.util.WorldUtil.getMinSection(this);
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index f9ba24d32f4170c641e420991e6c358f6bd91be2..8b6de4295172dfa7eb33a20a822923e7a4954812 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -452,6 +452,7 @@ public class SpigotWorldConfig
|
||||
this.hangingTickFrequency = this.getInt( "hanging-tick-frequency", 200 ); // DivineMC - optimize default values for configs
|
||||
}
|
||||
|
||||
+ /* DivineMC - remove tick limiter
|
||||
public int tileMaxTickTime;
|
||||
public int entityMaxTickTime;
|
||||
private void maxTickTimes()
|
||||
@@ -460,6 +461,7 @@ public class SpigotWorldConfig
|
||||
this.entityMaxTickTime = this.getInt("max-tick-time.entity", 50);
|
||||
this.log("Tile Max Tick Time: " + this.tileMaxTickTime + "ms Entity max Tick Time: " + this.entityMaxTickTime + "ms");
|
||||
}
|
||||
+ */
|
||||
|
||||
public int thunderChance;
|
||||
private void thunderChance()
|
||||
diff --git a/src/main/java/org/spigotmc/TickLimiter.java b/src/main/java/org/spigotmc/TickLimiter.java
|
||||
deleted file mode 100644
|
||||
index 4074538ea6090bf99d8ab04b1e98c2832a0e9a98..0000000000000000000000000000000000000000
|
||||
--- a/src/main/java/org/spigotmc/TickLimiter.java
|
||||
+++ /dev/null
|
||||
@@ -1,20 +0,0 @@
|
||||
-package org.spigotmc;
|
||||
-
|
||||
-public class TickLimiter {
|
||||
-
|
||||
- private final int maxTime;
|
||||
- private long startTime;
|
||||
-
|
||||
- public TickLimiter(int maxtime) {
|
||||
- this.maxTime = maxtime;
|
||||
- }
|
||||
-
|
||||
- public void initTick() {
|
||||
- this.startTime = System.currentTimeMillis();
|
||||
- }
|
||||
-
|
||||
- public boolean shouldContinue() {
|
||||
- long remaining = System.currentTimeMillis() - this.startTime;
|
||||
- return remaining < this.maxTime;
|
||||
- }
|
||||
-}
|
||||
76
patches/unapplied/server/0010-Boat-Settings.patch
Normal file
76
patches/unapplied/server/0010-Boat-Settings.patch
Normal file
@@ -0,0 +1,76 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sat, 10 Jun 2023 13:01:08 +0300
|
||||
Subject: [PATCH] Boat Settings
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||
index 5036941829e4d98adbcfb0354b35244c52fc4472..76ef5000bbd805c40e0c927dc709c20c17d72f79 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||
@@ -338,7 +338,18 @@ public class Boat extends VehicleEntity implements VariantHolder<Boat.Type> {
|
||||
}
|
||||
|
||||
if (!this.level().isClientSide && this.outOfControlTicks >= 60.0F) {
|
||||
- this.ejectPassengers();
|
||||
+ // DivineMC start - Don't eject players
|
||||
+ if (this.level().divinemcConfig.dontEjectPlayerFromBoatUnderwater) {
|
||||
+ for (int i = this.passengers.size() - 1; i >= 0; --i) {
|
||||
+ Entity passenger = this.passengers.get(i);
|
||||
+ if (!(passenger instanceof Player)) {
|
||||
+ passenger.stopRiding();
|
||||
+ }
|
||||
+ }
|
||||
+ } else {
|
||||
+ this.ejectPassengers();
|
||||
+ }
|
||||
+ // DivineMC end
|
||||
}
|
||||
|
||||
if (this.getHurtTime() > 0) {
|
||||
@@ -853,7 +864,13 @@ public class Boat extends VehicleEntity implements VariantHolder<Boat.Type> {
|
||||
|
||||
@Override
|
||||
public InteractionResult interact(Player player, InteractionHand hand) {
|
||||
- return player.isSecondaryUseActive() ? InteractionResult.PASS : (this.outOfControlTicks < 60.0F ? (!this.level().isClientSide ? (player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS) : InteractionResult.SUCCESS) : InteractionResult.PASS);
|
||||
+ // DivineMC start - always allow to enter the boat
|
||||
+ if (this.level().divinemcConfig.alwaysAllowToEnterTheBoat) {
|
||||
+ return player.isSecondaryUseActive() ? InteractionResult.PASS : (true || this.outOfControlTicks < 60.0F ? (!this.level().isClientSide ? (player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS) : InteractionResult.SUCCESS) : InteractionResult.PASS);
|
||||
+ } else {
|
||||
+ return player.isSecondaryUseActive() ? InteractionResult.PASS : (this.outOfControlTicks < 60.0F ? (!this.level().isClientSide ? (player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS) : InteractionResult.SUCCESS) : InteractionResult.PASS);
|
||||
+ }
|
||||
+ // DivineMC end
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -925,7 +942,13 @@ public class Boat extends VehicleEntity implements VariantHolder<Boat.Type> {
|
||||
|
||||
@Override
|
||||
protected boolean canAddPassenger(Entity passenger) {
|
||||
- return this.getPassengers().size() < this.getMaxPassengers() && !this.isEyeInFluid(FluidTags.WATER);
|
||||
+ // DivineMC start - always allow to enter the boat
|
||||
+ if (this.level().divinemcConfig.alwaysAllowToEnterTheBoat) {
|
||||
+ return this.getPassengers().size() < this.getMaxPassengers()/* && !this.isEyeInFluid(FluidTags.WATER)*/;
|
||||
+ } else {
|
||||
+ return this.getPassengers().size() < this.getMaxPassengers() && !this.isEyeInFluid(FluidTags.WATER);
|
||||
+ }
|
||||
+ // DivineMC end
|
||||
}
|
||||
|
||||
protected int getMaxPassengers() {
|
||||
diff --git a/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java b/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java
|
||||
index 243b3d4379f4f6f273222a3611d8a463053d3e70..e1274fe3b0ff369d1f6f229026ced2e03ea335ca 100644
|
||||
--- a/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java
|
||||
+++ b/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java
|
||||
@@ -82,4 +82,11 @@ public class DivineWorldConfig {
|
||||
private void saveFireworks() {
|
||||
saveFireworks = getBoolean("gameplay-mechanics.should-save-fireworks", saveFireworks);
|
||||
}
|
||||
+
|
||||
+ public boolean dontEjectPlayerFromBoatUnderwater = true;
|
||||
+ public boolean alwaysAllowToEnterTheBoat = true;
|
||||
+ private void boatFeatures() {
|
||||
+ dontEjectPlayerFromBoatUnderwater = getBoolean("gameplay-mechanics.boat.dont-eject-players-from-boat-underwater", dontEjectPlayerFromBoatUnderwater);
|
||||
+ alwaysAllowToEnterTheBoat = getBoolean("gameplay-mechanics.boat.always-allow-to-enter-the-boat", alwaysAllowToEnterTheBoat);
|
||||
+ }
|
||||
}
|
||||
19
patches/unapplied/server/0011-Fix-MC-110386.patch
Normal file
19
patches/unapplied/server/0011-Fix-MC-110386.patch
Normal file
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sat, 1 Apr 2023 00:41:04 +0300
|
||||
Subject: [PATCH] Fix MC-110386
|
||||
|
||||
See https://bugs.mojang.com/browse/MC-110386
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java
|
||||
index 80ef4b6649da3049f21624926fa38595d76c5da5..3b7424fe3baa2d7d55d34fe7a0ebdbe11862805f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java
|
||||
@@ -114,6 +114,7 @@ public class HurtByTargetGoal extends TargetGoal {
|
||||
}
|
||||
|
||||
protected void alertOther(Mob mob, LivingEntity target) {
|
||||
+ if (mob == target) return; // DivineMC - Fix MC-110386
|
||||
mob.setTarget(target, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_NEARBY_ENTITY, true); // CraftBukkit - reason
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sat, 10 Jun 2023 13:12:59 +0300
|
||||
Subject: [PATCH] Despawn shulker bullets on owner death
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ShulkerBullet.java b/src/main/java/net/minecraft/world/entity/projectile/ShulkerBullet.java
|
||||
index 1c50c870e59c35a39c83a0f136ee5d3c70268763..51077190b147e58b547c059abf0088715b37fea8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/ShulkerBullet.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/ShulkerBullet.java
|
||||
@@ -221,6 +221,17 @@ public class ShulkerBullet extends Projectile {
|
||||
Vec3 vec3d;
|
||||
|
||||
if (!this.level().isClientSide) {
|
||||
+ // DivineMC start - despawn shulker bullets on owner death
|
||||
+ if (this.level().divinemcConfig.despawnShulkerBulletsOnOwnerDeath) {
|
||||
+ if (!isInvulnerable()) {
|
||||
+ var owner = getOwner();
|
||||
+ if (owner == null || !owner.isAlive()) {
|
||||
+ discard();
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // DivineMC end
|
||||
if (this.finalTarget == null && this.targetId != null) {
|
||||
this.finalTarget = ((ServerLevel) this.level()).getEntity(this.targetId);
|
||||
if (this.finalTarget == null) {
|
||||
diff --git a/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java b/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java
|
||||
index e1274fe3b0ff369d1f6f229026ced2e03ea335ca..7e62ee9418d5add5b0b4ddb885d3a1745ce799b2 100644
|
||||
--- a/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java
|
||||
+++ b/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java
|
||||
@@ -89,4 +89,9 @@ public class DivineWorldConfig {
|
||||
dontEjectPlayerFromBoatUnderwater = getBoolean("gameplay-mechanics.boat.dont-eject-players-from-boat-underwater", dontEjectPlayerFromBoatUnderwater);
|
||||
alwaysAllowToEnterTheBoat = getBoolean("gameplay-mechanics.boat.always-allow-to-enter-the-boat", alwaysAllowToEnterTheBoat);
|
||||
}
|
||||
+
|
||||
+ public boolean despawnShulkerBulletsOnOwnerDeath = true;
|
||||
+ private void despawnShulkerBulletsOnOwnerDeath() {
|
||||
+ despawnShulkerBulletsOnOwnerDeath = getBoolean("gameplay-mechanics.mob.shulker.despawn-bullets-on-player-death", despawnShulkerBulletsOnOwnerDeath);
|
||||
+ }
|
||||
}
|
||||
22
patches/unapplied/server/0013-Fix-MC-31819.patch
Normal file
22
patches/unapplied/server/0013-Fix-MC-31819.patch
Normal file
@@ -0,0 +1,22 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sat, 10 Jun 2023 13:17:01 +0300
|
||||
Subject: [PATCH] Fix MC-31819
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 43199815ffe3d666577390b96187aa898ceb910e..a7ea4d1bef425f43a6854e719660cda6c29cabfa 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1914,6 +1914,11 @@ public abstract class Player extends LivingEntity {
|
||||
}
|
||||
|
||||
public void causeFoodExhaustion(float f, EntityExhaustionEvent.ExhaustionReason reason) {
|
||||
+ // DivineMC start - Fix MC-31819
|
||||
+ if (this.level().getDifficulty() == Difficulty.PEACEFUL) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // DivineMC end
|
||||
// CraftBukkit end
|
||||
if (!this.abilities.invulnerable) {
|
||||
if (!this.level().isClientSide) {
|
||||
37
patches/unapplied/server/0014-Reduce-sensor-work.patch
Normal file
37
patches/unapplied/server/0014-Reduce-sensor-work.patch
Normal file
@@ -0,0 +1,37 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sat, 10 Jun 2023 19:43:52 +0300
|
||||
Subject: [PATCH] Reduce sensor work
|
||||
|
||||
Original project: Bloom-host/Petal
|
||||
Link: https://github.com/Bloom-host/Petal
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index d6705dce3bc8c1964184fe425386b3f3c0a8202e..56811b7068450a56818dcc03d1777d082df88d52 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1046,20 +1046,19 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
if (entity != null) {
|
||||
- ItemStack itemstack = this.getItemBySlot(EquipmentSlot.HEAD);
|
||||
EntityType<?> entitytypes = entity.getType();
|
||||
|
||||
// Purpur start
|
||||
- if (entitytypes == EntityType.SKELETON && itemstack.is(Items.SKELETON_SKULL)) {
|
||||
+ if (entitytypes == EntityType.SKELETON && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.SKELETON_SKULL)) { // DivineMC - Reduce sensor work
|
||||
d0 *= entity.level().purpurConfig.skeletonHeadVisibilityPercent;
|
||||
}
|
||||
- else if (entitytypes == EntityType.ZOMBIE && itemstack.is(Items.ZOMBIE_HEAD)) {
|
||||
+ else if (entitytypes == EntityType.ZOMBIE && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.ZOMBIE_HEAD)) { // DivineMC - Reduce sensor work
|
||||
d0 *= entity.level().purpurConfig.zombieHeadVisibilityPercent;
|
||||
}
|
||||
- else if (entitytypes == EntityType.CREEPER && itemstack.is(Items.CREEPER_HEAD)) {
|
||||
+ else if (entitytypes == EntityType.CREEPER && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.CREEPER_HEAD)) { // DivineMC - Reduce sensor work
|
||||
d0 *= entity.level().purpurConfig.creeperHeadVisibilityPercent;
|
||||
}
|
||||
- else if ((entitytypes == EntityType.PIGLIN || entitytypes == EntityType.PIGLIN_BRUTE) && itemstack.is(Items.PIGLIN_HEAD)) {
|
||||
+ else if ((entitytypes == EntityType.PIGLIN || entitytypes == EntityType.PIGLIN_BRUTE) && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.PIGLIN_HEAD)) { // DivineMC - Reduce sensor work
|
||||
d0 *= entity.level().purpurConfig.piglinHeadVisibilityPercent;
|
||||
}
|
||||
// Purpur end
|
||||
26
patches/unapplied/server/0015-Fix-MC-172801.patch
Normal file
26
patches/unapplied/server/0015-Fix-MC-172801.patch
Normal file
@@ -0,0 +1,26 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sat, 27 Jan 2024 16:56:27 +0300
|
||||
Subject: [PATCH] Fix MC-172801
|
||||
|
||||
Original post on Mojira: https://bugs.mojang.com/browse/MC-172801
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 56811b7068450a56818dcc03d1777d082df88d52..b48736a9f60c92d904e31f1faaacb6caf47d4070 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3094,7 +3094,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
protected float getFlyingSpeed() {
|
||||
- return this.getControllingPassenger() instanceof net.minecraft.world.entity.player.Player ? this.getSpeed() * 0.1F : 0.02F;
|
||||
+ // DivineMC start - Fix MC-172801
|
||||
+ float flyingSpeed = 0.02F;
|
||||
+ if (this.getAttributes().hasAttribute(Attributes.FLYING_SPEED)) {
|
||||
+ flyingSpeed = (float) (this.getAttribute(Attributes.FLYING_SPEED).getValue() * 0.049999999254942D);
|
||||
+ }
|
||||
+ return this.getControllingPassenger() instanceof net.minecraft.world.entity.player.Player ? this.getSpeed() * 0.1F : flyingSpeed;
|
||||
+ // DivineMC end
|
||||
}
|
||||
|
||||
public float getSpeed() {
|
||||
45
patches/unapplied/server/0016-Fix-MC-2025.patch
Normal file
45
patches/unapplied/server/0016-Fix-MC-2025.patch
Normal file
@@ -0,0 +1,45 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 11 Jun 2023 23:59:29 +0300
|
||||
Subject: [PATCH] Fix MC-2025
|
||||
|
||||
Original post on Mojira: https://bugs.mojang.com/browse/MC-2025
|
||||
Fix taken from Reddit: https://redd.it/8pgd4q
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 8f948df85246ecbbca2c3c2b99e24f847b7386c6..2702de4408df4c74fef1951add2e38d92abc144c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2522,6 +2522,17 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
nbttagcompound.putBoolean("Purpur.FireImmune", immuneToFire);
|
||||
}
|
||||
// Purpur end
|
||||
+
|
||||
+ // DivineMC start - Fix MC-2025
|
||||
+ // This fix was taken from Reddit: https://redd.it/8pgd4q
|
||||
+ AABB boundingBox = getBoundingBox();
|
||||
+ ListTag boundingBoxList = new ListTag();
|
||||
+ for (double coord : new double[]{boundingBox.minX, boundingBox.minY, boundingBox.minZ, boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ}) {
|
||||
+ boundingBoxList.add(DoubleTag.valueOf(coord));
|
||||
+ }
|
||||
+ nbttagcompound.put("DivineMC.BoundingBox", boundingBoxList);
|
||||
+ // DivineMC end
|
||||
+
|
||||
return nbttagcompound;
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
||||
@@ -2599,6 +2610,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
this.reapplyPosition();
|
||||
}
|
||||
|
||||
+ // DivineMC start - Fix MC-2025
|
||||
+ // This fix was taken from Reddit: https://redd.it/8pgd4q
|
||||
+ if (nbt.contains("DivineMC.BoundingBox", net.minecraft.nbt.Tag.TAG_LIST)) {
|
||||
+ ListTag boundingBoxList = nbt.getList("DivineMC.BoundingBox", net.minecraft.nbt.Tag.TAG_DOUBLE);
|
||||
+ setBoundingBox(new AABB(boundingBoxList.getDouble(0), boundingBoxList.getDouble(1), boundingBoxList.getDouble(2), boundingBoxList.getDouble(3), boundingBoxList.getDouble(4), boundingBoxList.getDouble(5)));
|
||||
+ }
|
||||
+ // DivineMC end
|
||||
+
|
||||
} else {
|
||||
throw new IllegalStateException("Entity has invalid rotation");
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 25 Jun 2023 13:38:03 +0300
|
||||
Subject: [PATCH] Optimize Paper Event Manager
|
||||
|
||||
Original project: lynxplay/ktp
|
||||
Link: https://github.com/lynxplay/ktp
|
||||
Modified by NONPLAYT
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
|
||||
index 7ce9ebba8ce304d1f3f21d4f15ee5f3560d7700b..0e3bed7a75f8f4611f9f44a1f78fd70cc06eaa54 100644
|
||||
--- a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
|
||||
@@ -36,14 +36,21 @@ class PaperEventManager {
|
||||
|
||||
// SimplePluginManager
|
||||
public void callEvent(@NotNull Event event) {
|
||||
- if (event.isAsynchronous() && this.server.isPrimaryThread()) {
|
||||
- throw new IllegalStateException(event.getEventName() + " may only be triggered asynchronously.");
|
||||
- } else if (!event.isAsynchronous() && !this.server.isPrimaryThread() && !this.server.isStopping()) {
|
||||
- throw new IllegalStateException(event.getEventName() + " may only be triggered synchronously.");
|
||||
- }
|
||||
-
|
||||
+ // DivineMC start - Optimize Paper Event Manager
|
||||
HandlerList handlers = event.getHandlers();
|
||||
RegisteredListener[] listeners = handlers.getRegisteredListeners();
|
||||
+ if (listeners.length == 0) return;
|
||||
+
|
||||
+ if (event.asynchronous() != net.kyori.adventure.util.TriState.NOT_SET) {
|
||||
+ final boolean onPrimaryThread = this.server.isPrimaryThread();
|
||||
+ final boolean isAsync = event.isAsynchronous();
|
||||
+ if (isAsync && onPrimaryThread) {
|
||||
+ throw new IllegalStateException(event.getEventName() + " may only be triggered asynchronously.");
|
||||
+ } else if (!isAsync && !onPrimaryThread && !this.server.isStopping()) {
|
||||
+ throw new IllegalStateException(event.getEventName() + " may only be triggered synchronously.");
|
||||
+ }
|
||||
+ }
|
||||
+ // DivineMC end
|
||||
|
||||
for (RegisteredListener registration : listeners) {
|
||||
if (!registration.getPlugin().isEnabled()) {
|
||||
62
patches/unapplied/server/0018-Fix-MC-65198.patch
Normal file
62
patches/unapplied/server/0018-Fix-MC-65198.patch
Normal file
@@ -0,0 +1,62 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 25 Jun 2023 22:54:47 +0300
|
||||
Subject: [PATCH] Fix MC-65198
|
||||
|
||||
Original post on Mojira: https://bugs.mojang.com/browse/MC-65198
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
|
||||
index 3756de835ea87e3a4fb87cbf77365ffd87957ea9..e5f40f0a8702c98914384e9ffd204da888f39262 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
|
||||
@@ -141,6 +141,7 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu {
|
||||
ItemStack itemstack1 = slot1.getItem();
|
||||
|
||||
itemstack = itemstack1.copy();
|
||||
+ ItemStack itemStack2 = itemstack.copy();
|
||||
int j = this.getInventorySlotStart();
|
||||
int k = this.getUseRowEnd();
|
||||
|
||||
@@ -179,7 +180,7 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu {
|
||||
}
|
||||
|
||||
this.activeQuickItem = itemstack; // Purpur
|
||||
- slot1.onTake(player, itemstack1);
|
||||
+ slot1.onTake(player, itemStack2); // DivineMC - Fix MC-65198
|
||||
this.activeQuickItem = null; // Purpur
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/ResultSlot.java b/src/main/java/net/minecraft/world/inventory/ResultSlot.java
|
||||
index accf752e7615f775483830f81bd0df30e40d3c7f..54f83aaa7aaca680965b7e53fd2d1660896af53e 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/ResultSlot.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/ResultSlot.java
|
||||
@@ -45,7 +45,7 @@ public class ResultSlot extends Slot {
|
||||
@Override
|
||||
protected void checkTakeAchievements(ItemStack stack) {
|
||||
if (this.removeCount > 0) {
|
||||
- stack.onCraftedBy(this.player.level(), this.player, this.removeCount);
|
||||
+ stack.onCraftedBy(this.player.level(), this.player, stack.getCount()); // DivineMC - Fix MC-65198
|
||||
}
|
||||
|
||||
if (this.container instanceof RecipeCraftingHolder recipeCraftingHolder) {
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
|
||||
index eade15820dd9db38b6af2a5c4314acfb14ca03e9..3cb6a347b3269cb8b451798c7d1606227ebca007 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
|
||||
@@ -259,6 +259,7 @@ public class StonecutterMenu extends AbstractContainerMenu {
|
||||
Item item = itemstack1.getItem();
|
||||
|
||||
itemstack = itemstack1.copy();
|
||||
+ ItemStack itemStack2 = itemstack.copy(); // DivineMC - Fix MC-65198
|
||||
if (slot == 1) {
|
||||
item.onCraftedBy(itemstack1, player.level(), player);
|
||||
if (!this.moveItemStackTo(itemstack1, 2, 38, true)) {
|
||||
@@ -291,7 +292,7 @@ public class StonecutterMenu extends AbstractContainerMenu {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
- slot1.onTake(player, itemstack1);
|
||||
+ slot1.onTake(player, itemStack2); // DivineMC - Fix MC-65198
|
||||
this.broadcastChanges();
|
||||
}
|
||||
|
||||
161
patches/unapplied/server/0019-Make-entity-goals-public.patch
Normal file
161
patches/unapplied/server/0019-Make-entity-goals-public.patch
Normal file
@@ -0,0 +1,161 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 16 Jul 2023 11:37:32 +0300
|
||||
Subject: [PATCH] Make entity goals public
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||
index 997ab942be9f742804041b07d607e7dd6473ba96..aea0b36a52b2e9794daf8043f6a4279e52fec931 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||
@@ -774,7 +774,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
return pos.closerThan(this.blockPosition(), (double) distance);
|
||||
}
|
||||
|
||||
- private class BeePollinateGoal extends Bee.BaseBeeGoal {
|
||||
+ public class BeePollinateGoal extends Bee.BaseBeeGoal { // DivineMC - private -> public
|
||||
|
||||
private static final int MIN_POLLINATION_TICKS = 400;
|
||||
private static final int MIN_FIND_FLOWER_RETRY_COOLDOWN = 20;
|
||||
@@ -963,7 +963,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
}
|
||||
}
|
||||
|
||||
- private class BeeLookControl extends org.purpurmc.purpur.controller.LookControllerWASD { // Purpur
|
||||
+ public class BeeLookControl extends org.purpurmc.purpur.controller.LookControllerWASD { // Purpur // DivineMC - private -> public
|
||||
|
||||
BeeLookControl(Mob entity) {
|
||||
super(entity);
|
||||
@@ -999,7 +999,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
}
|
||||
}
|
||||
|
||||
- private class BeeEnterHiveGoal extends Bee.BaseBeeGoal {
|
||||
+ public class BeeEnterHiveGoal extends Bee.BaseBeeGoal { // DivineMC - private -> public
|
||||
|
||||
BeeEnterHiveGoal() {
|
||||
super();
|
||||
@@ -1044,7 +1044,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
}
|
||||
}
|
||||
|
||||
- private class BeeLocateHiveGoal extends Bee.BaseBeeGoal {
|
||||
+ public class BeeLocateHiveGoal extends Bee.BaseBeeGoal { // DivineMC - private -> public
|
||||
|
||||
BeeLocateHiveGoal() {
|
||||
super();
|
||||
@@ -1276,7 +1276,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
}
|
||||
}
|
||||
|
||||
- private class BeeGrowCropGoal extends Bee.BaseBeeGoal {
|
||||
+ public class BeeGrowCropGoal extends Bee.BaseBeeGoal { // DivineMC - private -> public
|
||||
|
||||
static final int GROW_CHANCE = 30;
|
||||
|
||||
@@ -1340,7 +1340,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
}
|
||||
}
|
||||
|
||||
- private class BeeWanderGoal extends Goal {
|
||||
+ public class BeeWanderGoal extends Goal { // DivineMC - private -> public
|
||||
|
||||
private static final int WANDER_THRESHOLD = 22;
|
||||
|
||||
@@ -1387,7 +1387,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
}
|
||||
}
|
||||
|
||||
- private class BeeHurtByOtherGoal extends HurtByTargetGoal {
|
||||
+ public class BeeHurtByOtherGoal extends HurtByTargetGoal { // DivineMC - private -> public
|
||||
|
||||
BeeHurtByOtherGoal(Bee entitybee) {
|
||||
super(entitybee);
|
||||
@@ -1407,7 +1407,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
}
|
||||
}
|
||||
|
||||
- private static class BeeBecomeAngryTargetGoal extends NearestAttackableTargetGoal<Player> {
|
||||
+ public static class BeeBecomeAngryTargetGoal extends NearestAttackableTargetGoal<Player> { // DivineMC - private -> public
|
||||
|
||||
BeeBecomeAngryTargetGoal(Bee bee) {
|
||||
// Objects.requireNonNull(entitybee); // CraftBukkit - decompile error
|
||||
@@ -1438,7 +1438,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
}
|
||||
}
|
||||
|
||||
- private abstract class BaseBeeGoal extends Goal {
|
||||
+ public abstract class BaseBeeGoal extends Goal { // DivineMC - private -> public
|
||||
|
||||
BaseBeeGoal() {}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Cat.java b/src/main/java/net/minecraft/world/entity/animal/Cat.java
|
||||
index 6af5e1dfcfd739e0bc857f648c189151d5a795c8..149ff2637ca70e26cb7a36ae35ed82508183daa7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Cat.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Cat.java
|
||||
@@ -568,7 +568,7 @@ public class Cat extends TamableAnimal implements VariantHolder<CatVariant> {
|
||||
}
|
||||
}
|
||||
|
||||
- private static class CatRelaxOnOwnerGoal extends Goal {
|
||||
+ public static class CatRelaxOnOwnerGoal extends Goal { // DivineMC - private -> public
|
||||
|
||||
private final Cat cat;
|
||||
@Nullable
|
||||
@@ -714,7 +714,7 @@ public class Cat extends TamableAnimal implements VariantHolder<CatVariant> {
|
||||
}
|
||||
}
|
||||
|
||||
- private static class CatAvoidEntityGoal<T extends LivingEntity> extends AvoidEntityGoal<T> {
|
||||
+ public static class CatAvoidEntityGoal<T extends LivingEntity> extends AvoidEntityGoal<T> { // DivineMC - private -> public
|
||||
|
||||
private final Cat cat;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Pillager.java b/src/main/java/net/minecraft/world/entity/monster/Pillager.java
|
||||
index d5becd13774f9a2ead77d58e777ffc9aea10cb60..7c9ed0f28116d4aad6bbabd5d710cd4bbfbd59dd 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Pillager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Pillager.java
|
||||
@@ -103,7 +103,7 @@ public class Pillager extends AbstractIllager implements CrossbowAttackMob, Inve
|
||||
super.registerGoals();
|
||||
this.goalSelector.addGoal(0, new FloatGoal(this));
|
||||
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur
|
||||
- this.goalSelector.addGoal(2, new Raider.HoldGroundAttackGoal(this, 10.0F));
|
||||
+ this.goalSelector.addGoal(2, new HoldGroundAttackGoal(this, 10.0F));
|
||||
this.goalSelector.addGoal(3, new RangedCrossbowAttackGoal<>(this, 1.0D, 8.0F));
|
||||
this.goalSelector.addGoal(8, new RandomStrollGoal(this, 0.6D));
|
||||
this.goalSelector.addGoal(9, new LookAtPlayerGoal(this, Player.class, 15.0F, 1.0F));
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
|
||||
index 960b5e2c290f82501384f79d4653f47bedf926fb..1f382f864209a4c8f654d019b0a5907734d44d0d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
|
||||
@@ -95,7 +95,7 @@ public class Vindicator extends AbstractIllager {
|
||||
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur
|
||||
this.goalSelector.addGoal(1, new Vindicator.VindicatorBreakDoorGoal(this));
|
||||
this.goalSelector.addGoal(2, new AbstractIllager.RaiderOpenDoorGoal(this));
|
||||
- this.goalSelector.addGoal(3, new Raider.HoldGroundAttackGoal(this, 10.0F));
|
||||
+ this.goalSelector.addGoal(3, new HoldGroundAttackGoal(this, 10.0F));
|
||||
this.goalSelector.addGoal(4, new MeleeAttackGoal(this, 1.0, false));
|
||||
this.targetSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur
|
||||
this.targetSelector.addGoal(1, new HurtByTargetGoal(this, Raider.class).setAlertOthers());
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raider.java b/src/main/java/net/minecraft/world/entity/raid/Raider.java
|
||||
index b3912881892b4f1bca577761083c5da1568c8187..5e8c9177644896d8f9243c3e7ce903fcdc6e9fa2 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/raid/Raider.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/raid/Raider.java
|
||||
@@ -355,7 +355,7 @@ public abstract class Raider extends PatrollingMonster {
|
||||
}
|
||||
}
|
||||
|
||||
- private static class RaiderMoveThroughVillageGoal extends Goal {
|
||||
+ public class RaiderMoveThroughVillageGoal extends Goal { // DivineMC - private -> public
|
||||
|
||||
private final Raider raider;
|
||||
private final double speedModifier;
|
||||
@@ -503,7 +503,7 @@ public abstract class Raider extends PatrollingMonster {
|
||||
}
|
||||
}
|
||||
|
||||
- public class HoldGroundAttackGoal extends Goal {
|
||||
+ public static class HoldGroundAttackGoal extends Goal { // DivineMC - public -> public static
|
||||
|
||||
private final Raider mob;
|
||||
private final float hostileRadiusSqr;
|
||||
20
patches/unapplied/server/0020-Fix-MC-7569.patch
Normal file
20
patches/unapplied/server/0020-Fix-MC-7569.patch
Normal file
@@ -0,0 +1,20 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 16 Jul 2023 12:21:09 +0300
|
||||
Subject: [PATCH] Fix MC-7569
|
||||
|
||||
Original post on Mojira: https://bugs.mojang.com/browse/MC-7569
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/rcon/RconConsoleSource.java b/src/main/java/net/minecraft/server/rcon/RconConsoleSource.java
|
||||
index a04cf04cb694237ec77b38fc576f0dfc9264a25a..47a00e408d96fd9ade864ec4e278e1eb006722ef 100644
|
||||
--- a/src/main/java/net/minecraft/server/rcon/RconConsoleSource.java
|
||||
+++ b/src/main/java/net/minecraft/server/rcon/RconConsoleSource.java
|
||||
@@ -55,7 +55,7 @@ public class RconConsoleSource implements CommandSource {
|
||||
|
||||
@Override
|
||||
public void sendSystemMessage(Component message) {
|
||||
- this.buffer.append(message.getString());
|
||||
+ this.buffer.append(message.getString()).append(System.lineSeparator());
|
||||
}
|
||||
|
||||
@Override
|
||||
34
patches/unapplied/server/0021-Fix-MC-93018.patch
Normal file
34
patches/unapplied/server/0021-Fix-MC-93018.patch
Normal file
@@ -0,0 +1,34 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 16 Jul 2023 13:51:26 +0300
|
||||
Subject: [PATCH] Fix MC-93018
|
||||
|
||||
Original post on Mojira: https://bugs.mojang.com/browse/MC-93018
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Wolf.java b/src/main/java/net/minecraft/world/entity/animal/Wolf.java
|
||||
index a90055fe8819a32180754b6060a0f88e81d1a3b6..cf52c73dfc4d078959d618af5d0efca3801b1d99 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Wolf.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Wolf.java
|
||||
@@ -655,14 +655,17 @@ public class Wolf extends TamableAnimal implements NeutralMob {
|
||||
public boolean canMate(Animal other) {
|
||||
if (other == this) {
|
||||
return false;
|
||||
- } else if (!this.isTame()) {
|
||||
- return false;
|
||||
} else if (!(other instanceof Wolf)) {
|
||||
return false;
|
||||
} else {
|
||||
- Wolf entitywolf = (Wolf) other;
|
||||
-
|
||||
- return !entitywolf.isTame() ? false : (entitywolf.isInSittingPose() ? false : this.isInLove() && entitywolf.isInLove());
|
||||
+ // DivineMC start - Fix MC-93018
|
||||
+ Wolf wolf = (Wolf) other;
|
||||
+ if (wolf.isInSittingPose()) {
|
||||
+ return false;
|
||||
+ } else {
|
||||
+ return this.isInLove() && wolf.isInLove();
|
||||
+ }
|
||||
+ // DivineMC end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Mon, 18 Sep 2023 00:35:27 +0300
|
||||
Subject: [PATCH] Do not process chat/commands before player has joined
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 9ba9356260d54ec318f07a8af221e9567ee03b12..28c46673995549a879e222d52abb9a7d2c24d6ed 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -6,6 +6,7 @@ import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.brigadier.ParseResults;
|
||||
import com.mojang.brigadier.StringReader;
|
||||
import com.mojang.logging.LogUtils;
|
||||
+import space.bxteam.divinemc.configuration.DivineConfig;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMaps;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
@@ -2338,6 +2339,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
if (this.player.isRemoved() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) { // CraftBukkit - dead men tell no tales
|
||||
this.send(new ClientboundSystemChatPacket(Component.translatable("chat.disabled.options").withStyle(ChatFormatting.RED), false));
|
||||
return Optional.empty();
|
||||
+ } else if (player.joining && DivineConfig.doNotProcessChatCommands) { // DivineMC - EMC - do not handle chat messages before they joined
|
||||
+ return Optional.empty();
|
||||
} else {
|
||||
this.player.resetLastActionTime();
|
||||
return optional;
|
||||
diff --git a/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java b/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java
|
||||
index c10403d781d25e4bb9e43d3f064fb1aebde00bfb..ef7983863da3b4febef3da2fab93fe581fbd65af 100644
|
||||
--- a/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java
|
||||
+++ b/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java
|
||||
@@ -152,4 +152,9 @@ public class DivineConfig {
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
+
|
||||
+ public static boolean doNotProcessChatCommands = true;
|
||||
+ private static void doNotProcessChatCommands() {
|
||||
+ doNotProcessChatCommands = getBoolean("settings.do-not-process-chat-commands", doNotProcessChatCommands);
|
||||
+ }
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 7 Jan 2024 11:56:00 +0300
|
||||
Subject: [PATCH] Configurable Chat message signatures
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
|
||||
index 1d78e8beacbc93ef2cd6beb418edca843f8a5429..9d389c5a09c090750b1c17b0d162e06e6899a063 100644
|
||||
--- a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
|
||||
+++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
|
||||
@@ -317,7 +317,7 @@ public final class ChatProcessor {
|
||||
|
||||
private void sendToServer(final ChatType.Bound chatType, final @Nullable Function<Audience, net.minecraft.network.chat.Component> msgFunction) {
|
||||
final PlayerChatMessage toConsoleMessage = msgFunction == null ? ChatProcessor.this.message : ChatProcessor.this.message.withUnsignedContent(msgFunction.apply(ChatProcessor.this.server.console));
|
||||
- ChatProcessor.this.server.logChatMessage(toConsoleMessage.decoratedContent(), chatType, ChatProcessor.this.server.getPlayerList().verifyChatTrusted(toConsoleMessage) ? null : "Not Secure");
|
||||
+ ChatProcessor.this.server.logChatMessage(toConsoleMessage.decoratedContent(), chatType, ChatProcessor.this.server.getPlayerList().verifyChatTrusted(toConsoleMessage) ? null : (space.bxteam.divinemc.configuration.DivineConfig.chatMessageSignatures ? null : "Not Secure")); // DivineMC - Configurable Chat message signatures
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundChatCommandPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatCommandPacket.java
|
||||
index e62ae57532ddcf12b7ebca77220cb1f3bd603717..70201f97584442b7573a3da7b9a439117aa442ca 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ServerboundChatCommandPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatCommandPacket.java
|
||||
@@ -18,7 +18,7 @@ public record ServerboundChatCommandPacket(
|
||||
buf.writeUtf(this.command, 256);
|
||||
buf.writeInstant(this.timeStamp);
|
||||
buf.writeLong(this.salt);
|
||||
- this.argumentSignatures.write(buf);
|
||||
+ if (!space.bxteam.divinemc.configuration.DivineConfig.chatMessageSignatures) this.argumentSignatures.write(buf); // DivineMC - Configurable Chat message signatures
|
||||
this.lastSeenMessages.write(buf);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java
|
||||
index 831178218ddfaa1828c00d0662b251d11bb29ff5..10a4a52b13de38791c58f2323dffd320a789b547 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java
|
||||
@@ -18,7 +18,7 @@ public record ServerboundChatPacket(String message, Instant timeStamp, long salt
|
||||
buf.writeUtf(this.message, 256);
|
||||
buf.writeInstant(this.timeStamp);
|
||||
buf.writeLong(this.salt);
|
||||
- buf.writeNullable(this.signature, MessageSignature::write);
|
||||
+ if (!space.bxteam.divinemc.configuration.DivineConfig.chatMessageSignatures) buf.writeNullable(this.signature, MessageSignature::write); // DivineMC - Configurable Chat message signatures
|
||||
this.lastSeenMessages.write(buf);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/status/ServerStatus.java b/src/main/java/net/minecraft/network/protocol/status/ServerStatus.java
|
||||
index 5ed4a3a30657ab9e748245ad34333b915e870ae2..7b76782d7fc7bebef4248b1847ba6dd8a6c5dc8c 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/status/ServerStatus.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/status/ServerStatus.java
|
||||
@@ -23,14 +23,21 @@ public record ServerStatus(
|
||||
boolean enforcesSecureChat
|
||||
) {
|
||||
public static final Codec<ServerStatus> CODEC = RecordCodecBuilder.create(
|
||||
- instance -> instance.group(
|
||||
- ComponentSerialization.CODEC.optionalFieldOf("description", CommonComponents.EMPTY).forGetter(ServerStatus::description),
|
||||
- ServerStatus.Players.CODEC.optionalFieldOf("players").forGetter(ServerStatus::players),
|
||||
- ServerStatus.Version.CODEC.optionalFieldOf("version").forGetter(ServerStatus::version),
|
||||
- ServerStatus.Favicon.CODEC.optionalFieldOf("favicon").forGetter(ServerStatus::favicon),
|
||||
- Codec.BOOL.optionalFieldOf("enforcesSecureChat", Boolean.valueOf(false)).forGetter(ServerStatus::enforcesSecureChat)
|
||||
- )
|
||||
- .apply(instance, ServerStatus::new)
|
||||
+ instance -> space.bxteam.divinemc.configuration.DivineConfig.chatMessageSignatures ? instance.group(
|
||||
+ ComponentSerialization.CODEC.optionalFieldOf("description", CommonComponents.EMPTY).forGetter(ServerStatus::description),
|
||||
+ ServerStatus.Players.CODEC.optionalFieldOf("players").forGetter(ServerStatus::players),
|
||||
+ ServerStatus.Version.CODEC.optionalFieldOf("version").forGetter(ServerStatus::version),
|
||||
+ ServerStatus.Favicon.CODEC.optionalFieldOf("favicon").forGetter(ServerStatus::favicon),
|
||||
+ Codec.BOOL.optionalFieldOf("enforcesSecureChat", Boolean.FALSE).forGetter(x -> true)
|
||||
+ )
|
||||
+ .apply(instance, ServerStatus::new) : instance.group(
|
||||
+ ComponentSerialization.CODEC.optionalFieldOf("description", CommonComponents.EMPTY).forGetter(ServerStatus::description),
|
||||
+ ServerStatus.Players.CODEC.optionalFieldOf("players").forGetter(ServerStatus::players),
|
||||
+ ServerStatus.Version.CODEC.optionalFieldOf("version").forGetter(ServerStatus::version),
|
||||
+ ServerStatus.Favicon.CODEC.optionalFieldOf("favicon").forGetter(ServerStatus::favicon),
|
||||
+ Codec.BOOL.optionalFieldOf("enforcesSecureChat", Boolean.FALSE).forGetter(ServerStatus::enforcesSecureChat)
|
||||
+ )
|
||||
+ .apply(instance, ServerStatus::new)
|
||||
);
|
||||
|
||||
public static record Favicon(byte[] iconBytes) {
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 41cffa00d4978f46b47ac6ede2da2a256796a0ba..9fa9a1e1efab58f3133b32517bb04c2ec708816d 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -682,6 +682,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
|
||||
@Override
|
||||
public boolean enforceSecureProfile() {
|
||||
+ if (space.bxteam.divinemc.configuration.DivineConfig.chatMessageSignatures) return false; // DivineMC - Configurable Chat message signatures
|
||||
DedicatedServerProperties dedicatedserverproperties = this.getProperties();
|
||||
|
||||
// Paper start - Add setting for proxy online mode status
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 305b90d10a499e9731f5178433fb10207e428091..8206429795ec7bf81b9e628ac08ffc591ddd409a 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -2258,7 +2258,7 @@ public class ServerPlayer extends Player {
|
||||
}
|
||||
|
||||
public void sendServerStatus(ServerStatus metadata) {
|
||||
- this.connection.send(new ClientboundServerDataPacket(metadata.description(), metadata.favicon().map(ServerStatus.Favicon::iconBytes), metadata.enforcesSecureChat()));
|
||||
+ if (space.bxteam.divinemc.configuration.DivineConfig.chatMessageSignatures) this.connection.send(new ClientboundServerDataPacket(metadata.description(), metadata.favicon().map(ServerStatus.Favicon::iconBytes), true)); else this.connection.send(new ClientboundServerDataPacket(metadata.description(), metadata.favicon().map(ServerStatus.Favicon::iconBytes), metadata.enforcesSecureChat())); // DivineMC - Configurable Chat message signatures
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
index 02e65b0bd212d46855baee48fab35dc95a88b43f..9d9c1bc8bdf55998172bca5edf78d9b8b048b2c9 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
@@ -4,7 +4,7 @@ import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.logging.LogUtils;
|
||||
import java.util.Objects;
|
||||
import javax.annotation.Nullable;
|
||||
-import net.minecraft.ChatFormatting;
|
||||
+import io.papermc.paper.adventure.PaperAdventure; // DivineMC
|
||||
import net.minecraft.CrashReport;
|
||||
import net.minecraft.CrashReportCategory;
|
||||
import net.minecraft.ReportedException;
|
||||
@@ -22,6 +22,7 @@ import net.minecraft.network.protocol.common.ServerboundKeepAlivePacket;
|
||||
import net.minecraft.network.protocol.common.ServerboundPongPacket;
|
||||
import net.minecraft.network.protocol.common.ServerboundResourcePackPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundSetDefaultSpawnPositionPacket;
|
||||
+import net.minecraft.network.protocol.game.ClientboundSystemChatPacket; // DivineMC
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ClientInformation;
|
||||
@@ -34,7 +35,6 @@ import org.slf4j.Logger;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
-import org.bukkit.craftbukkit.util.CraftChatMessage;
|
||||
import org.bukkit.craftbukkit.util.CraftLocation;
|
||||
import org.bukkit.craftbukkit.util.Waitable;
|
||||
import org.bukkit.event.player.PlayerKickEvent;
|
||||
@@ -271,10 +271,31 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
}
|
||||
|
||||
public void send(Packet<?> packet) {
|
||||
+ // DivineMC start - Configurable Chat message signatures
|
||||
+ if (space.bxteam.divinemc.configuration.DivineConfig.chatMessageSignatures) {
|
||||
+ if (packet instanceof net.minecraft.network.protocol.game.ClientboundPlayerChatPacket chat) {
|
||||
+ packet = new ClientboundSystemChatPacket(PaperAdventure.asAdventure(chat.chatType().resolve(this.player.level().registryAccess())
|
||||
+ .get().decorate(chat.unsignedContent() != null ? chat.unsignedContent()
|
||||
+ : Component.literal(chat.body().content()))), false);
|
||||
+
|
||||
+ this.send(packet);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ // DivineMC end
|
||||
this.send(packet, (PacketSendListener) null);
|
||||
}
|
||||
|
||||
public void send(Packet<?> packet, @Nullable PacketSendListener callbacks) {
|
||||
+ // DivineMC start - Configurable Chat message signatures
|
||||
+ if (space.bxteam.divinemc.configuration.DivineConfig.chatMessageSignatures) {
|
||||
+ if (packet instanceof net.minecraft.network.protocol.game.ClientboundPlayerChatPacket chat && callbacks != null) {
|
||||
+ this.send(chat);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ // DivineMC end
|
||||
+
|
||||
// CraftBukkit start
|
||||
if (packet == null || this.processedDisconnect) { // Spigot
|
||||
return;
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index ac1e0c66f167218306504db6037cc1d6509072a0..7784a81f2b861e1f5c9dd7a7885e8be70b89bc8a 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -1469,7 +1469,7 @@ public abstract class PlayerList {
|
||||
// Paper end
|
||||
boolean flag = this.verifyChatTrusted(message);
|
||||
|
||||
- this.server.logChatMessage((unsignedFunction == null ? message.decoratedContent() : unsignedFunction.apply(this.server.console)), params, flag ? null : "Not Secure"); // Paper
|
||||
+ this.server.logChatMessage((unsignedFunction == null ? message.decoratedContent() : unsignedFunction.apply(this.server.console)), params, flag ? null : (space.bxteam.divinemc.configuration.DivineConfig.chatMessageSignatures ? null : "Not Secure")); // Paper // DivineMC - Configurable Chat message signatures
|
||||
OutgoingChatMessage outgoingchatmessage = OutgoingChatMessage.create(message);
|
||||
boolean flag1 = false;
|
||||
|
||||
@@ -1498,6 +1498,7 @@ public abstract class PlayerList {
|
||||
}
|
||||
|
||||
public boolean verifyChatTrusted(PlayerChatMessage message) { // Paper - private -> public
|
||||
+ if (space.bxteam.divinemc.configuration.DivineConfig.chatMessageSignatures) return true; // DivineMC - Configurable Chat message signatures
|
||||
return message.hasSignature() && !message.hasExpiredServer(Instant.now());
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java b/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java
|
||||
index ef7983863da3b4febef3da2fab93fe581fbd65af..b9223f4778de0c2ed6efed6f8c192cb0212cbda8 100644
|
||||
--- a/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java
|
||||
+++ b/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java
|
||||
@@ -157,4 +157,9 @@ public class DivineConfig {
|
||||
private static void doNotProcessChatCommands() {
|
||||
doNotProcessChatCommands = getBoolean("settings.do-not-process-chat-commands", doNotProcessChatCommands);
|
||||
}
|
||||
+
|
||||
+ public static boolean chatMessageSignatures = false;
|
||||
+ private static void chatMessageSignatures() {
|
||||
+ chatMessageSignatures = getBoolean("settings.disable-chat-reports", chatMessageSignatures);
|
||||
+ }
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sat, 13 Jan 2024 13:36:55 +0300
|
||||
Subject: [PATCH] Optimize CraftServer.getWorld(UUID)
|
||||
|
||||
Original code by MultiPaper - https://github.com/MultiPaper/MultiPaper
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 1e3c4131e9dd155e4a0830d4c3f76f7f93146fff..a59a786049bfe1ca341a6f8833163a01d51535c5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -265,6 +265,8 @@ import net.md_5.bungee.api.chat.BaseComponent; // Spigot
|
||||
import javax.annotation.Nullable; // Paper
|
||||
import javax.annotation.Nonnull; // Paper
|
||||
|
||||
+import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; // DivineMC
|
||||
+
|
||||
public final class CraftServer implements Server {
|
||||
private final String serverName = "DivineMC"; // Paper // Pufferfish // Purpur // DivineMC
|
||||
private final String serverVersion;
|
||||
@@ -281,6 +283,7 @@ public final class CraftServer implements Server {
|
||||
protected final DedicatedServer console;
|
||||
protected final DedicatedPlayerList playerList;
|
||||
private final Map<String, World> worlds = new LinkedHashMap<String, World>();
|
||||
+ private final Map<UUID, World> worldsByUUID = new Object2ObjectLinkedOpenHashMap<>(); // DivineMC - MultiPaper - optimize getWorld(UUID)
|
||||
private final Map<Class<?>, Registry<?>> registries = new HashMap<>();
|
||||
private YamlConfiguration configuration;
|
||||
private YamlConfiguration commandsConfiguration;
|
||||
@@ -1481,6 +1484,7 @@ public final class CraftServer implements Server {
|
||||
this.getLogger().log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
+ this.worldsByUUID.remove(world.getUID()); // DivineMC - MultiPaper - optimize getWorld(UUID)
|
||||
this.worlds.remove(world.getName().toLowerCase(java.util.Locale.ENGLISH));
|
||||
this.console.removeLevel(handle);
|
||||
return true;
|
||||
@@ -1499,6 +1503,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public World getWorld(UUID uid) {
|
||||
+ if (true) return this.worldsByUUID.get(uid); // DivineMC - MultiPaper - optimize getWorld(UUID)
|
||||
for (World world : this.worlds.values()) {
|
||||
if (world.getUID().equals(uid)) {
|
||||
return world;
|
||||
@@ -1522,6 +1527,7 @@ public final class CraftServer implements Server {
|
||||
System.out.println("World " + world.getName() + " is a duplicate of another world and has been prevented from loading. Please delete the uid.dat file from " + world.getName() + "'s world directory if you want to be able to load the duplicate world.");
|
||||
return;
|
||||
}
|
||||
+ this.worldsByUUID.put(world.getUID(), world); // DivineMC - MultiPaper - optimize getWorld(UUID)
|
||||
this.worlds.put(world.getName().toLowerCase(java.util.Locale.ENGLISH), world);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sat, 13 Jan 2024 18:58:14 +0300
|
||||
Subject: [PATCH] Carpet-Fixes: RecipeManager Optimize
|
||||
|
||||
Original project: https://github.com/fxmorin/carpet-fixes
|
||||
Improves: [Blast]Furnace/Campfire/Smoker/Stonecutter/Crafting/Sheep Color Choosing
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
||||
index d87124f5356180a37e581febc6141fdc5f1395a7..4ae4d1203df960c109c1b70d6d710eaa00537008 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
||||
@@ -11,14 +11,9 @@ import com.google.gson.JsonParseException;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import com.mojang.logging.LogUtils;
|
||||
import com.mojang.serialization.JsonOps;
|
||||
-import java.util.Collection;
|
||||
-import java.util.Collections;
|
||||
-import java.util.Comparator;
|
||||
-import java.util.Iterator;
|
||||
-import java.util.List;
|
||||
-import java.util.Map;
|
||||
+
|
||||
+import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
-import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -137,7 +132,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener {
|
||||
}
|
||||
|
||||
public <C extends Container, T extends Recipe<C>> List<RecipeHolder<T>> getAllRecipesFor(RecipeType<T> type) {
|
||||
- return List.copyOf(this.byType(type).values());
|
||||
+ return space.bxteam.divinemc.configuration.DivineConfig.recipeManagerOptimization ? new ArrayList<>(this.byType(type).values()) : List.copyOf(this.byType(type).values()); // DivineMC - Carpet-Fixes: RecipeManager Optimize
|
||||
}
|
||||
|
||||
public <C extends Container, T extends Recipe<C>> List<RecipeHolder<T>> getRecipesFor(RecipeType<T> type, C inventory, Level world) {
|
||||
diff --git a/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java b/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java
|
||||
index b9223f4778de0c2ed6efed6f8c192cb0212cbda8..6cf0675cf5affb989e75d6a1cbab69f0a3ce1e34 100644
|
||||
--- a/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java
|
||||
+++ b/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java
|
||||
@@ -162,4 +162,9 @@ public class DivineConfig {
|
||||
private static void chatMessageSignatures() {
|
||||
chatMessageSignatures = getBoolean("settings.disable-chat-reports", chatMessageSignatures);
|
||||
}
|
||||
+
|
||||
+ public static boolean recipeManagerOptimization = true;
|
||||
+ private static void optimizations() {
|
||||
+ recipeManagerOptimization = getBoolean("settings.optimizations.recipe-manager-optimization", recipeManagerOptimization);
|
||||
+ }
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sat, 13 Jan 2024 19:19:16 +0300
|
||||
Subject: [PATCH] Carpet-Fixes: getBiome Optimize
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/biome/BiomeManager.java b/src/main/java/net/minecraft/world/level/biome/BiomeManager.java
|
||||
index 01352cc83b25eb0e30b7e0ff521fc7c1b3d5155b..c042287e12b5ce814afe8557e4dfa8e8b16b0f5a 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/biome/BiomeManager.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/biome/BiomeManager.java
|
||||
@@ -14,6 +14,7 @@ public class BiomeManager {
|
||||
private static final int ZOOM_MASK = 3;
|
||||
private final BiomeManager.NoiseBiomeSource noiseBiomeSource;
|
||||
private final long biomeZoomSeed;
|
||||
+ private static final double maxOffset = 0.4500000001D; // DivineMC - Carpet-Fixes: getBiome Optimize
|
||||
|
||||
public BiomeManager(BiomeManager.NoiseBiomeSource storage, long seed) {
|
||||
this.noiseBiomeSource = storage;
|
||||
@@ -29,39 +30,103 @@ public class BiomeManager {
|
||||
}
|
||||
|
||||
public Holder<Biome> getBiome(BlockPos pos) {
|
||||
- int i = pos.getX() - 2;
|
||||
- int j = pos.getY() - 2;
|
||||
- int k = pos.getZ() - 2;
|
||||
- int l = i >> 2;
|
||||
- int m = j >> 2;
|
||||
- int n = k >> 2;
|
||||
- double d = (double)(i & 3) / 4.0;
|
||||
- double e = (double)(j & 3) / 4.0;
|
||||
- double f = (double)(k & 3) / 4.0;
|
||||
- int o = 0;
|
||||
- double g = Double.POSITIVE_INFINITY;
|
||||
-
|
||||
- for (int p = 0; p < 8; p++) {
|
||||
- boolean bl = (p & 4) == 0;
|
||||
- boolean bl2 = (p & 2) == 0;
|
||||
- boolean bl3 = (p & 1) == 0;
|
||||
- int q = bl ? l : l + 1;
|
||||
- int r = bl2 ? m : m + 1;
|
||||
- int s = bl3 ? n : n + 1;
|
||||
- double h = bl ? d : d - 1.0;
|
||||
- double t = bl2 ? e : e - 1.0;
|
||||
- double u = bl3 ? f : f - 1.0;
|
||||
- double v = getFiddledDistance(this.biomeZoomSeed, q, r, s, h, t, u);
|
||||
- if (g > v) {
|
||||
- o = p;
|
||||
- g = v;
|
||||
+ // DivineMC start - Carpet-Fixes: getBiome Optimize
|
||||
+ if (space.bxteam.divinemc.configuration.DivineConfig.biomeManagerOptimization) {
|
||||
+ int xMinus2 = pos.getX() - 2;
|
||||
+ int yMinus2 = pos.getY() - 2;
|
||||
+ int zMinus2 = pos.getZ() - 2;
|
||||
+ int x = xMinus2 >> 2; // BlockPos to BiomePos
|
||||
+ int y = yMinus2 >> 2;
|
||||
+ int z = zMinus2 >> 2;
|
||||
+ double quartX = (double) (xMinus2 & 3) / 4.0D; // quartLocal divided by 4
|
||||
+ double quartY = (double) (yMinus2 & 3) / 4.0D; // 0/4, 1/4, 2/4, 3/4
|
||||
+ double quartZ = (double) (zMinus2 & 3) / 4.0D; // [0, 0.25, 0.5, 0.75]
|
||||
+ int smallestX = 0;
|
||||
+ double smallestDist = Double.POSITIVE_INFINITY;
|
||||
+ for (int biomeX = 0; biomeX < 8; ++biomeX) {
|
||||
+ boolean everyOtherQuad = (biomeX & 4) == 0; // 1 1 1 1 0 0 0 0
|
||||
+ boolean everyOtherPair = (biomeX & 2) == 0; // 1 1 0 0 1 1 0 0
|
||||
+ boolean everyOther = (biomeX & 1) == 0; // 1 0 1 0 1 0 1 0
|
||||
+ double quartXX = everyOtherQuad ? quartX : quartX - 1.0D; //[-1.0,-0.75,-0.5,-0.25,0.0,0.25,0.5,0.75]
|
||||
+ double quartYY = everyOtherPair ? quartY : quartY - 1.0D;
|
||||
+ double quartZZ = everyOther ? quartZ : quartZ - 1.0D;
|
||||
+
|
||||
+ double maxQuartYY = 0.0D, maxQuartZZ = 0.0D;
|
||||
+ if (biomeX != 0) {
|
||||
+ maxQuartYY = Mth.square(Math.max(quartYY + maxOffset, Math.abs(quartYY - maxOffset)));
|
||||
+ maxQuartZZ = Mth.square(Math.max(quartZZ + maxOffset, Math.abs(quartZZ - maxOffset)));
|
||||
+ double maxQuartXX = Mth.square(Math.max(quartXX + maxOffset, Math.abs(quartXX - maxOffset)));
|
||||
+ if (smallestDist < maxQuartXX + maxQuartYY + maxQuartZZ) continue;
|
||||
+ }
|
||||
+
|
||||
+ int xx = everyOtherQuad ? x : x + 1;
|
||||
+ int yy = everyOtherPair ? y : y + 1;
|
||||
+ int zz = everyOther ? z : z + 1;
|
||||
+
|
||||
+ //I transferred the code from method_38106 to here, so I could call continue halfway through
|
||||
+ long seed = LinearCongruentialGenerator.next(this.biomeZoomSeed, xx);
|
||||
+ seed = LinearCongruentialGenerator.next(seed, yy);
|
||||
+ seed = LinearCongruentialGenerator.next(seed, zz);
|
||||
+ seed = LinearCongruentialGenerator.next(seed, xx);
|
||||
+ seed = LinearCongruentialGenerator.next(seed, yy);
|
||||
+ seed = LinearCongruentialGenerator.next(seed, zz);
|
||||
+ double offsetX = getFiddle(seed);
|
||||
+ double sqrX = Mth.square(quartXX + offsetX);
|
||||
+ if (biomeX != 0 && smallestDist < sqrX + maxQuartYY + maxQuartZZ) continue; //skip the rest of the loop
|
||||
+ seed = LinearCongruentialGenerator.next(seed, this.biomeZoomSeed);
|
||||
+ double offsetY = getFiddle(seed);
|
||||
+ double sqrY = Mth.square(quartYY + offsetY);
|
||||
+ if (biomeX != 0 && smallestDist < sqrX + sqrY + maxQuartZZ) continue; // skip the rest of the loop
|
||||
+ seed = LinearCongruentialGenerator.next(seed, this.biomeZoomSeed);
|
||||
+ double offsetZ = getFiddle(seed);
|
||||
+ double biomeDist = sqrX + sqrY + Mth.square(quartZZ + offsetZ);
|
||||
+
|
||||
+ if (smallestDist > biomeDist) {
|
||||
+ smallestX = biomeX;
|
||||
+ smallestDist = biomeDist;
|
||||
+ }
|
||||
+ }
|
||||
+ return this.noiseBiomeSource.getNoiseBiome(
|
||||
+ (smallestX & 4) == 0 ? x : x + 1,
|
||||
+ (smallestX & 2) == 0 ? y : y + 1,
|
||||
+ (smallestX & 1) == 0 ? z : z + 1
|
||||
+ );
|
||||
+ } else {
|
||||
+ int i = pos.getX() - 2;
|
||||
+ int j = pos.getY() - 2;
|
||||
+ int k = pos.getZ() - 2;
|
||||
+ int l = i >> 2;
|
||||
+ int m = j >> 2;
|
||||
+ int n = k >> 2;
|
||||
+ double d = (double)(i & 3) / 4.0;
|
||||
+ double e = (double)(j & 3) / 4.0;
|
||||
+ double f = (double)(k & 3) / 4.0;
|
||||
+ int o = 0;
|
||||
+ double g = Double.POSITIVE_INFINITY;
|
||||
+
|
||||
+ for (int p = 0; p < 8; p++) {
|
||||
+ boolean bl = (p & 4) == 0;
|
||||
+ boolean bl2 = (p & 2) == 0;
|
||||
+ boolean bl3 = (p & 1) == 0;
|
||||
+ int q = bl ? l : l + 1;
|
||||
+ int r = bl2 ? m : m + 1;
|
||||
+ int s = bl3 ? n : n + 1;
|
||||
+ double h = bl ? d : d - 1.0;
|
||||
+ double t = bl2 ? e : e - 1.0;
|
||||
+ double u = bl3 ? f : f - 1.0;
|
||||
+ double v = getFiddledDistance(this.biomeZoomSeed, q, r, s, h, t, u);
|
||||
+ if (g > v) {
|
||||
+ o = p;
|
||||
+ g = v;
|
||||
+ }
|
||||
}
|
||||
- }
|
||||
|
||||
- int w = (o & 4) == 0 ? l : l + 1;
|
||||
- int x = (o & 2) == 0 ? m : m + 1;
|
||||
- int y = (o & 1) == 0 ? n : n + 1;
|
||||
- return this.noiseBiomeSource.getNoiseBiome(w, x, y);
|
||||
+ int w = (o & 4) == 0 ? l : l + 1;
|
||||
+ int x = (o & 2) == 0 ? m : m + 1;
|
||||
+ int y = (o & 1) == 0 ? n : n + 1;
|
||||
+ return this.noiseBiomeSource.getNoiseBiome(w, x, y);
|
||||
+ }
|
||||
+ // DivineMC end
|
||||
}
|
||||
|
||||
public Holder<Biome> getNoiseBiomeAtPosition(double x, double y, double z) {
|
||||
diff --git a/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java b/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java
|
||||
index 6cf0675cf5affb989e75d6a1cbab69f0a3ce1e34..50db7431ec4a05a73ba3a5fb04b4c68427628982 100644
|
||||
--- a/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java
|
||||
+++ b/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java
|
||||
@@ -164,7 +164,9 @@ public class DivineConfig {
|
||||
}
|
||||
|
||||
public static boolean recipeManagerOptimization = true;
|
||||
+ public static boolean biomeManagerOptimization = true;
|
||||
private static void optimizations() {
|
||||
recipeManagerOptimization = getBoolean("settings.optimizations.recipe-manager-optimization", recipeManagerOptimization);
|
||||
+ biomeManagerOptimization = getBoolean("settings.optimizations.biome-manager-optimization", biomeManagerOptimization);
|
||||
}
|
||||
}
|
||||
52
patches/unapplied/server/0027-lithium-ai.raid.patch
Normal file
52
patches/unapplied/server/0027-lithium-ai.raid.patch
Normal file
@@ -0,0 +1,52 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sat, 8 Apr 2023 23:45:11 +0300
|
||||
Subject: [PATCH] lithium: ai.raid
|
||||
|
||||
This patch is based on the following mixin:
|
||||
"me/jellysquid/mods/lithium/mixin/ai/raid/RaidMixin.java"
|
||||
By: Angeline <jellysquid3@users.noreply.github.com>
|
||||
As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric)
|
||||
Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raid.java b/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
||||
index bf2c23fad919820512ce031cf28a000b249b2876..85f56c79d60fa5b5a269b044c5b3710ef30a827d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
||||
@@ -106,6 +106,7 @@ public class Raid {
|
||||
private Raid.RaidStatus status;
|
||||
private int celebrationTicks;
|
||||
private Optional<BlockPos> waveSpawnPos;
|
||||
+ private boolean isBarDirty; // DivineMC - lithium: ai.raid
|
||||
// Paper start
|
||||
private static final String PDC_NBT_KEY = "BukkitValues";
|
||||
private static final org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry PDC_TYPE_REGISTRY = new org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry();
|
||||
@@ -283,6 +284,12 @@ public class Raid {
|
||||
|
||||
public void tick() {
|
||||
if (!this.isStopped()) {
|
||||
+ // DivineMC start - lithium: ai.raid
|
||||
+ if (this.isBarDirty) {
|
||||
+ this.updateBossbarInternal();
|
||||
+ this.isBarDirty = false;
|
||||
+ }
|
||||
+ // DivineMC end
|
||||
if (this.status == Raid.RaidStatus.ONGOING) {
|
||||
boolean flag = this.active;
|
||||
|
||||
@@ -651,9 +658,15 @@ public class Raid {
|
||||
|
||||
}
|
||||
|
||||
+ // DivineMC start - lithium: ai.raid
|
||||
public void updateBossbar() {
|
||||
+ this.isBarDirty = true;
|
||||
+ }
|
||||
+
|
||||
+ private void updateBossbarInternal() {
|
||||
this.raidEvent.setProgress(Mth.clamp(this.getHealthOfLivingRaiders() / this.totalHealth, 0.0F, 1.0F));
|
||||
}
|
||||
+ // DivineMC end
|
||||
|
||||
public float getHealthOfLivingRaiders() {
|
||||
float f = 0.0F;
|
||||
@@ -0,0 +1,29 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sat, 8 Apr 2023 01:22:35 +0300
|
||||
Subject: [PATCH] lithium: collections.goals
|
||||
|
||||
Original code by CaffeineMC, licensed under LGPL v3
|
||||
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
|
||||
index a2cca3d528625d49411a94e2b6ec578fec9b10da..e5c8b62cd431a86d9f1e5e4f1e48adfef81518c8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
|
||||
@@ -14,6 +14,7 @@ import java.util.function.Supplier;
|
||||
import java.util.stream.Stream;
|
||||
import net.minecraft.util.profiling.ProfilerFiller;
|
||||
import org.slf4j.Logger;
|
||||
+import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet;
|
||||
|
||||
public class GoalSelector {
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -29,7 +30,7 @@ public class GoalSelector {
|
||||
}
|
||||
};
|
||||
private final Map<Goal.Flag, WrappedGoal> lockedFlags = new EnumMap<>(Goal.Flag.class);
|
||||
- private final Set<WrappedGoal> availableGoals = Sets.newLinkedHashSet();
|
||||
+ private final Set<WrappedGoal> availableGoals = new ObjectLinkedOpenHashSet<>(); // DivineMC - lithium: collections.goals
|
||||
private final Supplier<ProfilerFiller> profiler;
|
||||
private final EnumSet<Goal.Flag> disabledFlags = EnumSet.noneOf(Goal.Flag.class); // Paper unused, but dummy to prevent plugins from crashing as hard. Theyll need to support paper in a special case if this is super important, but really doesn't seem like it would be.
|
||||
private final com.destroystokyo.paper.util.set.OptimizedSmallEnumSet<net.minecraft.world.entity.ai.goal.Goal.Flag> goalTypes = new com.destroystokyo.paper.util.set.OptimizedSmallEnumSet<>(Goal.Flag.class); // Paper - remove streams from pathfindergoalselector
|
||||
@@ -0,0 +1,29 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sat, 8 Apr 2023 01:28:01 +0300
|
||||
Subject: [PATCH] lithium: collections.gamerules
|
||||
|
||||
Original code by CaffeineMC, licensed under LGPL v3
|
||||
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/GameRules.java b/src/main/java/net/minecraft/world/level/GameRules.java
|
||||
index 4a340bd1f1859e43bb58e68aee4018fdb4ca7a5a..7f9345b195fe34129b28dd6c486abe9a1582364c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/GameRules.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/GameRules.java
|
||||
@@ -28,6 +28,7 @@ import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import org.slf4j.Logger;
|
||||
+import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
|
||||
public class GameRules {
|
||||
|
||||
@@ -142,7 +143,7 @@ public class GameRules {
|
||||
}
|
||||
|
||||
private GameRules(Map<GameRules.Key<?>, GameRules.Value<?>> rules) {
|
||||
- this.rules = rules;
|
||||
+ this.rules = new Object2ObjectOpenHashMap<>(rules); // DivineMC - lithium: collections.gamerules
|
||||
|
||||
// Paper start - Perf: Use array for gamerule storage
|
||||
int arraySize = rules.keySet().stream().mapToInt(key -> key.gameRuleIndex).max().orElse(-1) + 1;
|
||||
@@ -0,0 +1,28 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sat, 13 Jan 2024 20:04:54 +0300
|
||||
Subject: [PATCH] lithium: collections.attributes
|
||||
|
||||
Original code by CaffeineMC, licensed under LGPL v3
|
||||
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
||||
index 74d4f017484f13754a1f266625331a4124976afe..ce48d8a8382b78262d20151ba721ca1c99a9e189 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
||||
@@ -17,11 +17,13 @@ import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import org.slf4j.Logger;
|
||||
+import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap; // DivineMC
|
||||
+import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet; // DivineMC
|
||||
|
||||
public class AttributeMap {
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
- private final Map<Attribute, AttributeInstance> attributes = Maps.newHashMap();
|
||||
- private final Set<AttributeInstance> dirtyAttributes = Sets.newHashSet();
|
||||
+ private final Map<Attribute, AttributeInstance> attributes = new Reference2ReferenceOpenHashMap<>(0); // DivineMC
|
||||
+ private final Set<AttributeInstance> dirtyAttributes = new ReferenceOpenHashSet<>(0); // DivineMC
|
||||
private final AttributeSupplier supplier;
|
||||
private final java.util.function.Function<Attribute, AttributeInstance> createInstance; // Pufferfish
|
||||
private final net.minecraft.world.entity.LivingEntity entity; // Purpur
|
||||
@@ -0,0 +1,32 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sat, 13 Jan 2024 20:12:23 +0300
|
||||
Subject: [PATCH] lithium: collections.entity_by_type
|
||||
|
||||
Original code by CaffeineMC, licensed under LGPL v3
|
||||
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/util/ClassInstanceMultiMap.java b/src/main/java/net/minecraft/util/ClassInstanceMultiMap.java
|
||||
index ebad17e6ec90a7f385cd38c5ec6c2772798d4562..535359546393de76b86fd4e66fc5d9faebb5c854 100644
|
||||
--- a/src/main/java/net/minecraft/util/ClassInstanceMultiMap.java
|
||||
+++ b/src/main/java/net/minecraft/util/ClassInstanceMultiMap.java
|
||||
@@ -3,7 +3,6 @@ package net.minecraft.util;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Iterators;
|
||||
import com.google.common.collect.Lists;
|
||||
-import com.google.common.collect.Maps;
|
||||
import java.util.AbstractCollection;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@@ -12,9 +11,10 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.stream.Collectors;
|
||||
+import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap; // DivineMC
|
||||
|
||||
public class ClassInstanceMultiMap<T> extends AbstractCollection<T> {
|
||||
- private final Map<Class<?>, List<T>> byClass = Maps.newHashMap();
|
||||
+ private final Map<Class<?>, List<T>> byClass = new Reference2ReferenceOpenHashMap<>(); // DivineMC
|
||||
private final Class<T> baseClass;
|
||||
private final List<T> allInstances = Lists.newArrayList();
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sat, 13 Jan 2024 20:37:54 +0300
|
||||
Subject: [PATCH] lithium: entity.fast_elytra_check + entity.fast_hand_swing
|
||||
|
||||
Original code by CaffeineMC, licensed under LGPL v3
|
||||
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index b48736a9f60c92d904e31f1faaacb6caf47d4070..45b51affcdafc6afb5cf6fd043310c85eb3fb7d1 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -2623,6 +2623,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
protected void updateSwingTime() {
|
||||
+ if (!this.swinging && this.swingTime == 0) return; // DivineMC - lithium: entity.fast_hand_swing
|
||||
int i = this.getCurrentSwingDuration();
|
||||
|
||||
if (this.swinging) {
|
||||
@@ -3660,6 +3661,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
private void updateFallFlying() {
|
||||
+ if (!this.isFallFlying()) return; // DivineMC - lithium: entity.fast_elytra_check
|
||||
boolean flag = this.getSharedFlag(7);
|
||||
|
||||
if (flag && !this.onGround() && !this.isPassenger() && !this.hasEffect(MobEffects.LEVITATION)) {
|
||||
@@ -0,0 +1,130 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sat, 13 Jan 2024 20:59:28 +0300
|
||||
Subject: [PATCH] Carpet-Fixes: Sheep Optimization
|
||||
|
||||
Original project: https://github.com/fxmorin/carpet-fixes
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Sheep.java b/src/main/java/net/minecraft/world/entity/animal/Sheep.java
|
||||
index 658f7943d275267d3fc556572831cc095259d12e..5ee9005f65edcfc3e3d20198ec1f69108a6f8205 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Sheep.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Sheep.java
|
||||
@@ -70,6 +70,7 @@ import net.minecraft.world.item.Item;
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
import org.bukkit.event.entity.SheepRegrowWoolEvent;
|
||||
import org.bukkit.inventory.InventoryView;
|
||||
+import space.bxteam.divinemc.util.carpetfixes.ProperDyeMixin;
|
||||
// CraftBukkit end
|
||||
|
||||
public class Sheep extends Animal implements Shearable {
|
||||
@@ -457,21 +458,30 @@ public class Sheep extends Animal implements Shearable {
|
||||
return super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityNbt);
|
||||
}
|
||||
|
||||
+ // DivineMC start - Carpet-Fixes: Sheep Optimization
|
||||
private DyeColor getOffspringColor(Animal firstParent, Animal secondParent) {
|
||||
- DyeColor enumcolor = ((Sheep) firstParent).getColor();
|
||||
- DyeColor enumcolor1 = ((Sheep) secondParent).getColor();
|
||||
- CraftingContainer inventorycrafting = Sheep.makeContainer(enumcolor, enumcolor1);
|
||||
- Optional<Item> optional = this.level().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, inventorycrafting, this.level()).map((recipeholder) -> { // CraftBukkit - decompile error
|
||||
- return ((CraftingRecipe) recipeholder.value()).assemble(inventorycrafting, this.level().registryAccess());
|
||||
- }).map(ItemStack::getItem);
|
||||
-
|
||||
- Objects.requireNonNull(DyeItem.class);
|
||||
- optional = optional.filter(DyeItem.class::isInstance);
|
||||
- Objects.requireNonNull(DyeItem.class);
|
||||
- return (DyeColor) optional.map(DyeItem.class::cast).map(DyeItem::getDyeColor).orElseGet(() -> {
|
||||
- return this.level().random.nextBoolean() ? enumcolor : enumcolor1;
|
||||
- });
|
||||
+ DyeColor firstColor = ((Sheep) firstParent).getColor();
|
||||
+ DyeColor secondColor = ((Sheep) secondParent).getColor();
|
||||
+
|
||||
+ if (space.bxteam.divinemc.configuration.DivineConfig.sheepOptimization) {
|
||||
+ DyeColor col = ProperDyeMixin.properDye(firstColor, secondColor);
|
||||
+ if (col == null) col = this.level().random.nextBoolean() ? firstColor : secondColor;
|
||||
+ return col;
|
||||
+ } else {
|
||||
+ CraftingContainer inventorycrafting = Sheep.makeContainer(firstColor, secondColor);
|
||||
+ Optional<Item> optional = this.level().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, inventorycrafting, this.level()).map((recipeholder) -> { // CraftBukkit - decompile error
|
||||
+ return ((CraftingRecipe) recipeholder.value()).assemble(inventorycrafting, this.level().registryAccess());
|
||||
+ }).map(ItemStack::getItem);
|
||||
+
|
||||
+ Objects.requireNonNull(DyeItem.class);
|
||||
+ optional = optional.filter(DyeItem.class::isInstance);
|
||||
+ Objects.requireNonNull(DyeItem.class);
|
||||
+ return (DyeColor) optional.map(DyeItem.class::cast).map(DyeItem::getDyeColor).orElseGet(() -> {
|
||||
+ return this.level().random.nextBoolean() ? firstColor : secondColor;
|
||||
+ });
|
||||
+ }
|
||||
}
|
||||
+ // DivineMC end
|
||||
|
||||
private static CraftingContainer makeContainer(DyeColor firstColor, DyeColor secondColor) {
|
||||
TransientCraftingContainer transientcraftingcontainer = new TransientCraftingContainer(new AbstractContainerMenu((MenuType) null, -1) {
|
||||
diff --git a/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java b/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java
|
||||
index 50db7431ec4a05a73ba3a5fb04b4c68427628982..15e0aa2a82a0be51ef04736ec636932092b34b32 100644
|
||||
--- a/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java
|
||||
+++ b/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java
|
||||
@@ -165,8 +165,10 @@ public class DivineConfig {
|
||||
|
||||
public static boolean recipeManagerOptimization = true;
|
||||
public static boolean biomeManagerOptimization = true;
|
||||
+ public static boolean sheepOptimization = true;
|
||||
private static void optimizations() {
|
||||
recipeManagerOptimization = getBoolean("settings.optimizations.recipe-manager-optimization", recipeManagerOptimization);
|
||||
biomeManagerOptimization = getBoolean("settings.optimizations.biome-manager-optimization", biomeManagerOptimization);
|
||||
+ sheepOptimization = getBoolean("settings.optimizations.sheep-optimization", sheepOptimization);
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/space/bxteam/divinemc/util/carpetfixes/ProperDyeMixin.java b/src/main/java/space/bxteam/divinemc/util/carpetfixes/ProperDyeMixin.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..6cbcf1580312a9275e41813a26b36e42a2481a2c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/space/bxteam/divinemc/util/carpetfixes/ProperDyeMixin.java
|
||||
@@ -0,0 +1,46 @@
|
||||
+package space.bxteam.divinemc.util.carpetfixes;
|
||||
+
|
||||
+import net.minecraft.world.item.DyeColor;
|
||||
+
|
||||
+public class ProperDyeMixin {
|
||||
+ public static DyeColor properDye(DyeColor firstColor, DyeColor secondColor) {
|
||||
+ if (firstColor.equals(secondColor)) return firstColor;
|
||||
+ switch (firstColor) {
|
||||
+ case WHITE -> {
|
||||
+ switch (secondColor) {
|
||||
+ case BLUE -> {return DyeColor.LIGHT_BLUE;}
|
||||
+ case GRAY -> {return DyeColor.LIGHT_GRAY;}
|
||||
+ case BLACK -> {return DyeColor.GRAY;}
|
||||
+ case GREEN -> {return DyeColor.LIME;}
|
||||
+ case RED -> {return DyeColor.PINK;}
|
||||
+ }
|
||||
+ }
|
||||
+ case BLUE -> {
|
||||
+ switch (secondColor) {
|
||||
+ case WHITE -> {return DyeColor.LIGHT_BLUE;}
|
||||
+ case GREEN -> {return DyeColor.CYAN;}
|
||||
+ case RED -> {return DyeColor.PURPLE;}
|
||||
+ }
|
||||
+ }
|
||||
+ case RED -> {
|
||||
+ switch (secondColor) {
|
||||
+ case YELLOW -> {return DyeColor.ORANGE;}
|
||||
+ case WHITE -> {return DyeColor.PINK;}
|
||||
+ case BLUE -> {return DyeColor.PURPLE;}
|
||||
+ }
|
||||
+ }
|
||||
+ case GREEN -> {
|
||||
+ switch (secondColor) {
|
||||
+ case BLUE -> {return DyeColor.CYAN;}
|
||||
+ case WHITE -> {return DyeColor.LIME;}
|
||||
+ }
|
||||
+ }
|
||||
+ case YELLOW -> {if (secondColor.equals(DyeColor.RED)) return DyeColor.ORANGE;}
|
||||
+ case PURPLE -> {if (secondColor.equals(DyeColor.PINK)) return DyeColor.MAGENTA;}
|
||||
+ case PINK -> {if (secondColor.equals(DyeColor.PURPLE)) return DyeColor.MAGENTA;}
|
||||
+ case GRAY -> {if (secondColor.equals(DyeColor.WHITE)) return DyeColor.LIGHT_GRAY;}
|
||||
+ case BLACK -> {if (secondColor.equals(DyeColor.WHITE)) return DyeColor.GRAY;}
|
||||
+ }
|
||||
+ return null;
|
||||
+ }
|
||||
+}
|
||||
@@ -0,0 +1,30 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 14 Jan 2024 14:50:10 +0300
|
||||
Subject: [PATCH] vmp: use linked map for entity trackers for faster iteration
|
||||
|
||||
Original code by RelativityMC, licensed under MIT
|
||||
You can find the original code on https://github.com/RelativityMC/VMP-fabric (Yarn mappings)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index bb412ca874b85d777c0e3565fcefcee15b23182b..e0a52d5b74754a5b30a1fc250b5a2200682b748b 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -107,6 +107,8 @@ import org.slf4j.Logger;
|
||||
import org.bukkit.craftbukkit.generator.CustomChunkGenerator;
|
||||
// CraftBukkit end
|
||||
|
||||
+import it.unimi.dsi.fastutil.ints.Int2ObjectLinkedOpenHashMap; // DivineMC - vmp: use linked map for entity trackers for faster iteration
|
||||
+
|
||||
public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider {
|
||||
|
||||
private static final byte CHUNK_TYPE_REPLACEABLE = -1;
|
||||
@@ -251,7 +253,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
// Paper - rewrite chunk system
|
||||
this.tickingGenerated = new AtomicInteger();
|
||||
this.playerMap = new PlayerMap();
|
||||
- this.entityMap = new Int2ObjectOpenHashMap();
|
||||
+ this.entityMap = new Int2ObjectLinkedOpenHashMap<>(); // DivineMC - vmp: use linked map for entity trackers for faster iteration
|
||||
this.chunkTypeCache = new Long2ByteOpenHashMap();
|
||||
this.chunkSaveCooldowns = new Long2LongOpenHashMap();
|
||||
this.unloadQueue = Queues.newConcurrentLinkedQueue();
|
||||
@@ -0,0 +1,28 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 14 Jan 2024 22:54:49 +0300
|
||||
Subject: [PATCH] Improve biome temperature cache
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/biome/Biome.java b/src/main/java/net/minecraft/world/level/biome/Biome.java
|
||||
index 42af3888a155f114901a90d4028bafed5789f58f..25e44dbab2d758682ad89ed0038fd0ad055d3097 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/biome/Biome.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/biome/Biome.java
|
||||
@@ -64,7 +64,7 @@ public final class Biome {
|
||||
private final MobSpawnSettings mobSettings;
|
||||
private final BiomeSpecialEffects specialEffects;
|
||||
// Pufferfish start - use our cache
|
||||
- private final ThreadLocal<gg.airplane.structs.Long2FloatAgingCache> temperatureCache = ThreadLocal.withInitial(() -> Util.make(() -> {
|
||||
+ private static final ThreadLocal<gg.airplane.structs.Long2FloatAgingCache> temperatureCache = ThreadLocal.withInitial(() -> Util.make(() -> {
|
||||
/*
|
||||
Long2FloatLinkedOpenHashMap long2FloatLinkedOpenHashMap = new Long2FloatLinkedOpenHashMap(1024, 0.25F) {
|
||||
protected void rehash(int i) {
|
||||
@@ -118,7 +118,7 @@ public final class Biome {
|
||||
public float getTemperature(BlockPos blockPos) {
|
||||
long l = blockPos.asLong();
|
||||
// Pufferfish start
|
||||
- gg.airplane.structs.Long2FloatAgingCache cache = this.temperatureCache.get();
|
||||
+ gg.airplane.structs.Long2FloatAgingCache cache = temperatureCache.get(); // DivineMC - Improve biome temperature cache
|
||||
float f = cache.getValue(l);
|
||||
if (!Float.isNaN(f)) {
|
||||
return f;
|
||||
@@ -0,0 +1,45 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 14 Jan 2024 22:58:43 +0300
|
||||
Subject: [PATCH] Suppress errors from dirty attributes
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index 04b98e23eed926d8473cc2464e04a5b9f18f1140..68463f809aea61d818fc428f1c8b80682b05538b 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -386,7 +386,10 @@ public class ServerEntity {
|
||||
}
|
||||
|
||||
if (this.entity instanceof LivingEntity) {
|
||||
- Set<AttributeInstance> set = ((LivingEntity) this.entity).getAttributes().getDirtyAttributes();
|
||||
+ // DivineMC start - Suppress errors from dirty attributes
|
||||
+ Set<AttributeInstance> attributes = ((LivingEntity) this.entity).getAttributes().getDirtyAttributes();
|
||||
+ final Set<AttributeInstance> set = this.level.divinemcConfig.suppressErrorsFromDirtyAttributes ? Collections.synchronizedSet(attributes) : attributes;
|
||||
+ // DivineMC end
|
||||
|
||||
if (!set.isEmpty()) {
|
||||
// CraftBukkit start - Send scaled max health
|
||||
@@ -397,7 +400,7 @@ public class ServerEntity {
|
||||
this.broadcastAndSend(new ClientboundUpdateAttributesPacket(this.entity.getId(), set));
|
||||
}
|
||||
|
||||
- set.clear();
|
||||
+ attributes.clear(); // DivineMC
|
||||
}
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java b/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java
|
||||
index 7e62ee9418d5add5b0b4ddb885d3a1745ce799b2..53082033dfb58b8097ac326025472ef64358b890 100644
|
||||
--- a/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java
|
||||
+++ b/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java
|
||||
@@ -94,4 +94,9 @@ public class DivineWorldConfig {
|
||||
private void despawnShulkerBulletsOnOwnerDeath() {
|
||||
despawnShulkerBulletsOnOwnerDeath = getBoolean("gameplay-mechanics.mob.shulker.despawn-bullets-on-player-death", despawnShulkerBulletsOnOwnerDeath);
|
||||
}
|
||||
+
|
||||
+ public boolean suppressErrorsFromDirtyAttributes = true;
|
||||
+ private void suppressErrorsFromDirtyAttributes() {
|
||||
+ suppressErrorsFromDirtyAttributes = getBoolean("suppress-errors-from-dirty-attributes", suppressErrorsFromDirtyAttributes);
|
||||
+ }
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Fri, 26 Jan 2024 17:42:42 +0300
|
||||
Subject: [PATCH] vmp: skip entity move if movement is zero
|
||||
|
||||
Original code by RelativityMC, licensed under MIT
|
||||
You can find the original code on https://github.com/RelativityMC/VMP-fabric (Yarn mappings)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 2702de4408df4c74fef1951add2e38d92abc144c..30b72f4434b9fe9e490890c30400d058ecf3fa13 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -317,6 +317,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
public float yRotO;
|
||||
public float xRotO;
|
||||
private AABB bb;
|
||||
+ private boolean boundingBoxChanged = false; // DivineMC - vmp: skip entity move if movement is zero
|
||||
public boolean onGround;
|
||||
public boolean horizontalCollision;
|
||||
public boolean verticalCollision;
|
||||
@@ -1119,6 +1120,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
// Paper end - detailed watchdog information
|
||||
|
||||
public void move(MoverType movementType, Vec3 movement) {
|
||||
+ // DivineMC start - vmp: skip entity move if movement is zero
|
||||
+ if (!boundingBoxChanged && movement.equals(Vec3.ZERO)) {
|
||||
+ boundingBoxChanged = false;
|
||||
+ return;
|
||||
+ }
|
||||
+ // DivineMC end
|
||||
final Vec3 originalMovement = movement; // Paper - Expose pre-collision velocity
|
||||
// Paper start - detailed watchdog information
|
||||
io.papermc.paper.util.TickThread.ensureTickThread("Cannot move an entity off-main");
|
||||
@@ -4165,6 +4172,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
}
|
||||
|
||||
public final void setBoundingBox(AABB boundingBox) {
|
||||
+ if (!this.bb.equals(boundingBox)) boundingBoxChanged = true; // DivineMC - vmp: skip entity move if movement is zero
|
||||
// CraftBukkit start - block invalid bounding boxes
|
||||
double minX = boundingBox.minX,
|
||||
minY = boundingBox.minY,
|
||||
@@ -0,0 +1,28 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Tue, 16 Apr 2024 01:20:51 +0300
|
||||
Subject: [PATCH] Add Higher Java Version for Pufferfish SIMD
|
||||
|
||||
|
||||
diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
|
||||
index 8afc58f35deb49084a20b803e91ce4692ce6e4d6..581eb4ca8d7a09729ad9194d35f3cceeb291ecf7 100644
|
||||
--- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
|
||||
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
|
||||
@@ -87,7 +87,7 @@ public class PufferfishConfig {
|
||||
// Attempt to detect vectorization
|
||||
try {
|
||||
SIMDDetection.isEnabled = SIMDDetection.canEnable(PufferfishLogger.LOGGER);
|
||||
- SIMDDetection.versionLimited = SIMDDetection.getJavaVersion() < 17 || SIMDDetection.getJavaVersion() > 21;
|
||||
+ SIMDDetection.versionLimited = SIMDDetection.getJavaVersion() < 17; // DivineMC - Add Higher Java Version for Pufferfish SIMD
|
||||
} catch (NoClassDefFoundError | Exception ignored) {
|
||||
ignored.printStackTrace();
|
||||
}
|
||||
@@ -95,7 +95,7 @@ public class PufferfishConfig {
|
||||
if (SIMDDetection.isEnabled) {
|
||||
PufferfishLogger.LOGGER.info("SIMD operations detected as functional. Will replace some operations with faster versions.");
|
||||
} else if (SIMDDetection.versionLimited) {
|
||||
- PufferfishLogger.LOGGER.warning("Will not enable SIMD! These optimizations are only safely supported on Java 17 through Java 21.");
|
||||
+ PufferfishLogger.LOGGER.warning("Will not enable SIMD! These optimizations are only safely supported on Java 17 and higher.");
|
||||
} else {
|
||||
PufferfishLogger.LOGGER.warning("SIMD operations are available for your server, but are not configured!");
|
||||
PufferfishLogger.LOGGER.warning("To enable additional optimizations, add \"--add-modules=jdk.incubator.vector\" to your startup flags, BEFORE the \"-jar\".");
|
||||
28
patches/unapplied/server/0039-Fix-chat-signing.patch
Normal file
28
patches/unapplied/server/0039-Fix-chat-signing.patch
Normal file
@@ -0,0 +1,28 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Tue, 16 Apr 2024 01:26:18 +0300
|
||||
Subject: [PATCH] Fix chat signing
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
|
||||
index 67eeb39aede6908d2756e49821ca350ebe916902..740d3bd228eed7b322d98ac77c15429c3f2e3d68 100644
|
||||
--- a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
|
||||
+++ b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
|
||||
@@ -41,16 +41,7 @@ public class SignedMessageChain {
|
||||
throw new SignedMessageChain.DecodeException(Component.translatable("multiplayer.disconnect.out_of_order_chat"), true, org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event causes
|
||||
} else {
|
||||
this.lastTimeStamp = body.timeStamp();
|
||||
- PlayerChatMessage playerChatMessage = new PlayerChatMessage(signedMessageLink, signature, body, null, FilterMask.PASS_THROUGH);
|
||||
- if (!playerChatMessage.verify(signatureValidator)) {
|
||||
- throw new SignedMessageChain.DecodeException(Component.translatable("multiplayer.disconnect.unsigned_chat"), true, org.bukkit.event.player.PlayerKickEvent.Cause.UNSIGNED_CHAT); // Paper - kick event causes
|
||||
- } else {
|
||||
- if (playerChatMessage.hasExpiredServer(Instant.now())) {
|
||||
- LOGGER.warn("Received expired chat: '{}'. Is the client/server system time unsynchronized?", body.content());
|
||||
- }
|
||||
-
|
||||
- return playerChatMessage;
|
||||
- }
|
||||
+ return new PlayerChatMessage(signedMessageLink, signature, body, null, FilterMask.PASS_THROUGH); // DivineMC - Fix chat signing
|
||||
}
|
||||
};
|
||||
}
|
||||
1185
patches/unapplied/server/0040-Implement-Linear-region-format.patch
Normal file
1185
patches/unapplied/server/0040-Implement-Linear-region-format.patch
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,68 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Wed, 17 Apr 2024 02:02:02 +0300
|
||||
Subject: [PATCH] Snowball and Egg knockback
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Snowball.java b/src/main/java/net/minecraft/world/entity/projectile/Snowball.java
|
||||
index bb61e1132c28274175215a679befdcfa2496b099..8598b0ea5f4f847fa14ac5c3b32ba010bf909d6e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/Snowball.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/Snowball.java
|
||||
@@ -3,6 +3,7 @@ package net.minecraft.world.entity.projectile;
|
||||
import net.minecraft.core.particles.ItemParticleOption;
|
||||
import net.minecraft.core.particles.ParticleOptions;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
@@ -61,6 +62,13 @@ public class Snowball extends ThrowableItemProjectile {
|
||||
int i = entity.level().purpurConfig.snowballDamage >= 0 ? entity.level().purpurConfig.snowballDamage : entity instanceof Blaze ? 3 : 0; // Purpur
|
||||
|
||||
entity.hurt(this.damageSources().thrown(this, this.getOwner()), (float) i);
|
||||
+
|
||||
+ // DivineMC start - Snowball and Egg knockback
|
||||
+ if (this.level().divinemcConfig.snowballCanKnockback && entity instanceof ServerPlayer) {
|
||||
+ entity.hurt(this.damageSources().thrown(this, this.getOwner()), 0.0000001F);
|
||||
+ ((ServerPlayer) entity).knockback(0.4000000059604645D, this.getX() - entity.getX(), this.getZ() - entity.getZ(), this, org.bukkit.event.entity.EntityKnockbackEvent.KnockbackCause.DAMAGE);
|
||||
+ }
|
||||
+ // DivineMC end
|
||||
}
|
||||
|
||||
// Purpur start - borrowed and modified code from ThrownPotion#onHitBlock and ThrownPotion#dowseFire
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java
|
||||
index 82bb8004635865f5202578d5a6f520048e7269d5..f1ac568258170d76c242d4083c080ae5080cc368 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java
|
||||
@@ -46,7 +46,15 @@ public class ThrownEgg extends ThrowableItemProjectile {
|
||||
@Override
|
||||
protected void onHitEntity(EntityHitResult entityHitResult) {
|
||||
super.onHitEntity(entityHitResult);
|
||||
+ Entity entity = entityHitResult.getEntity(); // DivineMC
|
||||
entityHitResult.getEntity().hurt(this.damageSources().thrown(this, this.getOwner()), 0.0F);
|
||||
+
|
||||
+ // DivineMC start - Snowball and Egg knockback
|
||||
+ if (this.level().divinemcConfig.eggCanKnockback && entity instanceof ServerPlayer) {
|
||||
+ entity.hurt(this.damageSources().thrown(this, this.getOwner()), 0.0000001F);
|
||||
+ ((ServerPlayer) entity).knockback(0.4000000059604645D, this.getX() - entity.getX(), this.getZ() - entity.getZ(), this, org.bukkit.event.entity.EntityKnockbackEvent.KnockbackCause.DAMAGE);
|
||||
+ }
|
||||
+ // DivineMC end
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java b/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java
|
||||
index 8b65a405a9a1f03c4df78aed5a587fe5eb7fd54a..7b3e5f1c8d917e42944639795dd260ae8674ab96 100644
|
||||
--- a/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java
|
||||
+++ b/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java
|
||||
@@ -120,4 +120,11 @@ public class DivineWorldConfig {
|
||||
}
|
||||
linearCrashOnBrokenSymlink = getBoolean("region-format.linear.crash-on-broken-symlink", linearCrashOnBrokenSymlink);
|
||||
}
|
||||
+
|
||||
+ public boolean snowballCanKnockback = true;
|
||||
+ public boolean eggCanKnockback = true;
|
||||
+ private void setSnowballAndEggKnockback() {
|
||||
+ snowballCanKnockback = getBoolean("gameplay-mechanics.projectiles.snowball.knockback", snowballCanKnockback);
|
||||
+ eggCanKnockback = getBoolean("gameplay-mechanics.projectiles.egg.knockback", eggCanKnockback);
|
||||
+ }
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Wed, 17 Apr 2024 02:08:02 +0300
|
||||
Subject: [PATCH] lithium: precompute shape arrays
|
||||
|
||||
Original code by CaffeineMC, licensed under LGPL v3
|
||||
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/Direction.java b/src/main/java/net/minecraft/core/Direction.java
|
||||
index 84a760fdc50bdafc9150f977e9c5d557a30ee220..8bfe5c8c559d5e68f5b95bea37f63363b343e9b1 100644
|
||||
--- a/src/main/java/net/minecraft/core/Direction.java
|
||||
+++ b/src/main/java/net/minecraft/core/Direction.java
|
||||
@@ -39,7 +39,7 @@ public enum Direction implements StringRepresentable {
|
||||
private final Direction.Axis axis;
|
||||
private final Direction.AxisDirection axisDirection;
|
||||
private final Vec3i normal;
|
||||
- private static final Direction[] VALUES = values();
|
||||
+ public static final Direction[] VALUES = values(); // DivineMC - lithium: precompute shape arrays
|
||||
private static final Direction[] BY_3D_DATA = Arrays.stream(VALUES)
|
||||
.sorted(Comparator.comparingInt(direction -> direction.data3d))
|
||||
.toArray(Direction[]::new);
|
||||
diff --git a/src/main/java/net/minecraft/world/phys/shapes/CubePointRange.java b/src/main/java/net/minecraft/world/phys/shapes/CubePointRange.java
|
||||
index a544db042c8d2ecec8d323770552c4f10ca758a6..fc6a8b1cf33427320a60e3f2d9894ed2f0177bf7 100644
|
||||
--- a/src/main/java/net/minecraft/world/phys/shapes/CubePointRange.java
|
||||
+++ b/src/main/java/net/minecraft/world/phys/shapes/CubePointRange.java
|
||||
@@ -4,6 +4,7 @@ import it.unimi.dsi.fastutil.doubles.AbstractDoubleList;
|
||||
|
||||
public class CubePointRange extends AbstractDoubleList {
|
||||
private final int parts;
|
||||
+ private double scale; // DivineMC - lithium: precompute shape arrays
|
||||
|
||||
CubePointRange(int sectionCount) {
|
||||
if (sectionCount <= 0) {
|
||||
@@ -11,10 +12,11 @@ public class CubePointRange extends AbstractDoubleList {
|
||||
} else {
|
||||
this.parts = sectionCount;
|
||||
}
|
||||
+ this.scale = 1.0D / sectionCount; // DivineMC - lithium: precompute shape arrays
|
||||
}
|
||||
|
||||
public double getDouble(int i) {
|
||||
- return (double)i / (double)this.parts;
|
||||
+ return i * this.scale; // DivineMC - lithium: precompute shape arrays
|
||||
}
|
||||
|
||||
public int size() {
|
||||
diff --git a/src/main/java/net/minecraft/world/phys/shapes/CubeVoxelShape.java b/src/main/java/net/minecraft/world/phys/shapes/CubeVoxelShape.java
|
||||
index b9af1d14c7815c99273bce8165cf384d669c1a75..16bf73856465c10e1ab84c17e7b317ef9081704d 100644
|
||||
--- a/src/main/java/net/minecraft/world/phys/shapes/CubeVoxelShape.java
|
||||
+++ b/src/main/java/net/minecraft/world/phys/shapes/CubeVoxelShape.java
|
||||
@@ -5,6 +5,8 @@ import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.Mth;
|
||||
|
||||
public final class CubeVoxelShape extends VoxelShape {
|
||||
+ private DoubleList[] list; // DivineMC - lithium: precompute shape arrays
|
||||
+
|
||||
protected CubeVoxelShape(DiscreteVoxelShape voxels) {
|
||||
super(voxels);
|
||||
this.initCache(); // Paper - optimise collisions
|
||||
@@ -12,7 +14,15 @@ public final class CubeVoxelShape extends VoxelShape {
|
||||
|
||||
@Override
|
||||
protected DoubleList getCoords(Direction.Axis axis) {
|
||||
- return new CubePointRange(this.shape.getSize(axis));
|
||||
+ // DivineMC start - lithium: precompute shape arrays
|
||||
+ if (this.list == null) {
|
||||
+ this.list = new DoubleList[Direction.Axis.VALUES.length];
|
||||
+ for (Direction.Axis existingAxis : Direction.Axis.VALUES) {
|
||||
+ this.list[existingAxis.ordinal()] = new CubePointRange(this.shape.getSize(axis));
|
||||
+ }
|
||||
+ }
|
||||
+ return this.list[axis.ordinal()];
|
||||
+ // DivineMC end
|
||||
}
|
||||
|
||||
@Override
|
||||
Reference in New Issue
Block a user