Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12f555aa4d | ||
|
|
2d37d7141c | ||
|
|
363fcaec61 | ||
|
|
a7419fafc9 | ||
|
|
c06b0d77a1 | ||
|
|
f07107ec59 | ||
|
|
3ef59980e7 | ||
|
|
e2af449239 | ||
|
|
41c0116446 | ||
|
|
ffbcddccac | ||
|
|
1e2bebf45f | ||
|
|
80f5d58780 |
@@ -4,7 +4,7 @@ import io.papermc.paperweight.util.constants.*
|
||||
plugins {
|
||||
java
|
||||
id("com.github.johnrengelman.shadow") version "7.1.2"
|
||||
id("io.papermc.paperweight.patcher") version "1.4.1"
|
||||
id("io.papermc.paperweight.patcher") version "1.5.0"
|
||||
}
|
||||
|
||||
repositories {
|
||||
@@ -66,11 +66,11 @@ paperweight {
|
||||
ref.set(providers.gradleProperty("purpurRef"))
|
||||
|
||||
withStandardPatcher {
|
||||
apiSourceDirPath.set("Purpur-API")
|
||||
baseName("Purpur")
|
||||
|
||||
apiPatchDir.set(layout.projectDirectory.dir("patches/api"))
|
||||
apiOutputDir.set(layout.projectDirectory.dir("kaiiju-api"))
|
||||
|
||||
serverSourceDirPath.set("Purpur-Server")
|
||||
serverPatchDir.set(layout.projectDirectory.dir("patches/server"))
|
||||
serverOutputDir.set(layout.projectDirectory.dir("kaiiju-server"))
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
group = dev.kugge.kaiiju
|
||||
group = dev.kaiijumc.kaiiju
|
||||
version = 1.19.3-R0.1-SNAPSHOT
|
||||
mcVersion = 1.19.3
|
||||
|
||||
purpurRef = 08aa4dccaad7e5d31ca51b53489d2d413e49748d
|
||||
purpurRef = fccccfa1948408e30d51358e1906d6b8a4014cfc
|
||||
|
||||
org.gradle.caching=true
|
||||
org.gradle.parallel=true
|
||||
|
||||
BIN
logo.png
BIN
logo.png
Binary file not shown.
|
Before Width: | Height: | Size: 4.3 MiB After Width: | Height: | Size: 879 KiB |
@@ -5,7 +5,7 @@ Subject: [PATCH] Kaiiju Rebranding
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 020927dfe9624453311d1d171a10f44344ec8710..c6a4c48b14a8c927284720b79b93ee1aa9df7da6 100644
|
||||
index f25c0557cf984b97e0ab361f579eccbf46f82170..7f1f4988a25a5ebac36c25c045c51eefecab6862 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -7,7 +7,7 @@ plugins {
|
||||
@@ -17,7 +17,7 @@ index 020927dfe9624453311d1d171a10f44344ec8710..c6a4c48b14a8c927284720b79b93ee1a
|
||||
// Pufferfish start
|
||||
implementation("io.papermc.paper:paper-mojangapi:1.19.3-R0.1-SNAPSHOT") {
|
||||
exclude("io.papermc.paper", "paper-api")
|
||||
@@ -83,7 +83,7 @@ tasks.jar {
|
||||
@@ -84,7 +84,7 @@ tasks.jar {
|
||||
attributes(
|
||||
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
||||
"Implementation-Title" to "CraftBukkit",
|
||||
@@ -49,7 +49,7 @@ index 9713263c3bd34ab8a3bfc0a8797ba0b1b88ed733..0b95cd5305e4559d6dca59011869e5b2
|
||||
metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> {
|
||||
Map<String, Map<String, Integer>> map = new HashMap<>();
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||
index fba5dbdb7bcbb55400ef18342c9b54612972a718..c94e00290e21e4bcfac5b137ded704c0848463cc 100644
|
||||
index fba5dbdb7bcbb55400ef18342c9b54612972a718..8aaa2942d35d6447655f8355106841a30429b653 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||
@@ -20,7 +20,7 @@ import java.util.stream.StreamSupport;
|
||||
@@ -81,20 +81,23 @@ index fba5dbdb7bcbb55400ef18342c9b54612972a718..c94e00290e21e4bcfac5b137ded704c0
|
||||
org.bukkit.Bukkit.getLogger().warning("Pattern: " + VER_PATTERN.toString());
|
||||
org.bukkit.Bukkit.getLogger().warning("Version: " + org.bukkit.Bukkit.getBukkitVersion());
|
||||
}
|
||||
@@ -58,13 +58,15 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||
@@ -58,6 +58,8 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||
|
||||
private static Component getUpdateStatusMessage(@Nonnull String repo, @Nonnull String branch, @Nonnull String versionInfo) {
|
||||
//int distance; // Purpur - use field
|
||||
+ /* // Kaiiju
|
||||
+ // Kaiiju start - disable jenkins/api checking
|
||||
+ /*
|
||||
try {
|
||||
int jenkinsBuild = Integer.parseInt(versionInfo);
|
||||
distance = fetchDistanceFromSiteApi(jenkinsBuild, getMinecraftVersion());
|
||||
} catch (NumberFormatException ignored) {
|
||||
+ */ // Kaiiju
|
||||
@@ -65,6 +67,10 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||
versionInfo = versionInfo.replace("\"", "");
|
||||
distance = fetchDistanceFromGitHub(repo, branch, versionInfo);
|
||||
- }
|
||||
+ //} // Kaiiju
|
||||
}
|
||||
+ */
|
||||
+ versionInfo = versionInfo.replace("\"", "");
|
||||
+ distance = fetchDistanceFromGitHub(repo, branch, versionInfo);
|
||||
+ // Kaiiju end
|
||||
|
||||
switch (distance) {
|
||||
case -1:
|
||||
@@ -138,10 +141,10 @@ index cea4447aad2d64db56a76e4ba180dc7326d2e13b..40b4bd2f1a61c2d9a59c9c09b7271340
|
||||
this.getRunningThread().stop();
|
||||
try {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 4a8aafd341fdad4b5ae326c4759b3381f5061fb5..caf1237491649205f7b3c7ea4fe1d31d567bbafe 100644
|
||||
index c32e32005968b46d1f7d5162ab15c61e36f398f5..23f4edebbfa045716f956128703b58baced58f49 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -262,7 +262,7 @@ import javax.annotation.Nullable; // Paper
|
||||
@@ -261,7 +261,7 @@ import javax.annotation.Nullable; // Paper
|
||||
import javax.annotation.Nonnull; // Paper
|
||||
|
||||
public final class CraftServer implements Server {
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Kaiiju Configuration
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..da7e04a93664e20b9187292ddb7c1f935f5f2883
|
||||
index 0000000000000000000000000000000000000000..ef48d534d239fc5fcfd1b0500cc7868c1cf63142
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
@@ -0,0 +1,193 @@
|
||||
@@ -0,0 +1,194 @@
|
||||
+package dev.kaiijumc.kaiiju;
|
||||
+
|
||||
+import com.google.common.base.Throwables;
|
||||
@@ -27,6 +27,7 @@ index 0000000000000000000000000000000000000000..da7e04a93664e20b9187292ddb7c1f93
|
||||
+import java.lang.reflect.InvocationTargetException;
|
||||
+import java.lang.reflect.Method;
|
||||
+import java.lang.reflect.Modifier;
|
||||
+import java.util.Arrays;
|
||||
+import java.util.HashMap;
|
||||
+import java.util.List;
|
||||
+import java.util.Map;
|
||||
@@ -412,175 +413,58 @@ index 0000000000000000000000000000000000000000..0dde8879856f8882f2840b4b8bfb5aa0
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 46858fb57f122033a68aeb4ad3943132a677fb46..92fa3bb708ee2c965a76554268afee4db11f381d 100644
|
||||
index fd1b0564d2d2b45128e6f2556fb93ee56bd683b5..948ae5f96b1d54e69b49f6314d11078f197c946e 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -1,24 +1,21 @@
|
||||
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;
|
||||
import javax.annotation.Nullable;
|
||||
+
|
||||
+import dev.kaiijumc.kaiiju.KaiijuConfig;
|
||||
import net.minecraft.DefaultUncaughtExceptionHandler;
|
||||
import net.minecraft.DefaultUncaughtExceptionHandlerWithName;
|
||||
import net.minecraft.SharedConstants;
|
||||
@@ -58,7 +55,6 @@ 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;
|
||||
import org.bukkit.event.server.RemoteServerCommandEvent;
|
||||
@@ -227,6 +223,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -227,6 +227,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
}
|
||||
org.purpurmc.purpur.PurpurConfig.registerCommands();
|
||||
// Purpur end
|
||||
+ // Kaiiju start
|
||||
+ try {
|
||||
+ KaiijuConfig.init((java.io.File) options.valueOf("kaiiju-settings"));
|
||||
+ dev.kaiijumc.kaiiju.KaiijuConfig.init((java.io.File) options.valueOf("kaiiju-settings"));
|
||||
+ } catch (Exception e) {
|
||||
+ DedicatedServer.LOGGER.error("Unable to load server configuration", e);
|
||||
+ return false;
|
||||
+ }
|
||||
+ KaiijuConfig.registerCommands();
|
||||
+ dev.kaiijumc.kaiiju.KaiijuConfig.registerCommands();
|
||||
+ // Kaiiju end
|
||||
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now
|
||||
io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // init PaperBrigadierProvider
|
||||
// Paper end
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index a9289072b048095330ea32d7c965e8dda61a36fc..ce8873c47ec10d31d617a10128bed6ff21a24a39 100644
|
||||
index a9289072b048095330ea32d7c965e8dda61a36fc..bffd82b3d89e12f2c3d6a7e89f5a8ecd12dedc34 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -1,10 +1,7 @@
|
||||
package net.minecraft.world.level;
|
||||
|
||||
-import co.aikar.timings.Timing;
|
||||
-import co.aikar.timings.Timings;
|
||||
import com.destroystokyo.paper.event.server.ServerExceptionEvent;
|
||||
import com.destroystokyo.paper.exception.ServerInternalException;
|
||||
-import com.google.common.base.MoreObjects;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.serialization.Codec;
|
||||
import java.io.IOException;
|
||||
@@ -15,9 +12,10 @@ import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.function.Supplier;
|
||||
import javax.annotation.Nullable;
|
||||
+
|
||||
+import dev.kaiijumc.kaiiju.KaiijuWorldConfig;
|
||||
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;
|
||||
@@ -35,15 +33,12 @@ import net.minecraft.server.level.ChunkHolder;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
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;
|
||||
import net.minecraft.world.DifficultyInstance;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
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 +84,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 +166,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -174,6 +174,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 KaiijuWorldConfig kaiijuConfig; // Kaiiju
|
||||
+ public final dev.kaiijumc.kaiiju.KaiijuWorldConfig kaiijuConfig; // Kaiiju
|
||||
|
||||
public final co.aikar.timings.WorldTimingsHandler timings; // Paper
|
||||
public static BlockPos lastPhysicsProblem; // Spigot
|
||||
@@ -330,6 +323,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -330,6 +331,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
|
||||
this.purpurConfig = new org.purpurmc.purpur.PurpurWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), env); // Purpur
|
||||
+ this.kaiijuConfig = new KaiijuWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), env); // Kaiiju
|
||||
+ this.kaiijuConfig = new dev.kaiijumc.kaiiju.KaiijuWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), env); // Kaiiju
|
||||
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 caf1237491649205f7b3c7ea4fe1d31d567bbafe..eacb6fbd753b8448bc8732eec2dc3444b6e93136 100644
|
||||
index caf1237491649205f7b3c7ea4fe1d31d567bbafe..5fd8e45d9a982e4f6aad06440110bc3c9d00bd99 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -7,7 +7,6 @@ import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Iterators;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.MapMaker;
|
||||
-import com.google.gson.JsonObject;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.brigadier.StringReader;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
@@ -16,6 +15,7 @@ import com.mojang.brigadier.tree.LiteralCommandNode;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import com.mojang.serialization.DynamicOps;
|
||||
import com.mojang.serialization.Lifecycle;
|
||||
+import dev.kaiijumc.kaiiju.KaiijuConfig;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.ByteBufOutputStream;
|
||||
import io.netty.buffer.Unpooled;
|
||||
@@ -108,7 +108,6 @@ import net.minecraft.world.level.levelgen.PatrolSpawner;
|
||||
import net.minecraft.world.level.levelgen.PhantomSpawner;
|
||||
import net.minecraft.world.level.levelgen.WorldDimensions;
|
||||
import net.minecraft.world.level.levelgen.WorldOptions;
|
||||
-import net.minecraft.world.level.levelgen.presets.WorldPresets;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.saveddata.maps.MapDecoration;
|
||||
import net.minecraft.world.level.saveddata.maps.MapItemSavedData;
|
||||
@@ -1032,6 +1031,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1032,6 +1032,7 @@ public final class CraftServer implements Server {
|
||||
org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot
|
||||
this.console.paperConfigurations.reloadConfigs(this.console);
|
||||
org.purpurmc.purpur.PurpurConfig.init((File) console.options.valueOf("purpur-settings")); // Purpur
|
||||
+ KaiijuConfig.init((File) console.options.valueOf("kaiiju-settings")); // Kaiiju
|
||||
+ dev.kaiijumc.kaiiju.KaiijuConfig.init((File) console.options.valueOf("kaiiju-settings")); // Kaiiju
|
||||
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))
|
||||
@@ -1048,6 +1048,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1048,6 +1049,7 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
world.spigotConfig.init(); // Spigot
|
||||
world.purpurConfig.init(); // Purpur
|
||||
@@ -588,22 +472,22 @@ index caf1237491649205f7b3c7ea4fe1d31d567bbafe..eacb6fbd753b8448bc8732eec2dc3444
|
||||
}
|
||||
|
||||
Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper
|
||||
@@ -1064,6 +1065,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1064,6 +1066,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
|
||||
+ KaiijuConfig.registerCommands(); // Kaiiju
|
||||
+ dev.kaiijumc.kaiiju.KaiijuConfig.registerCommands(); // Kaiiju
|
||||
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
||||
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
||||
|
||||
@@ -2885,6 +2887,13 @@ public final class CraftServer implements Server {
|
||||
@@ -2885,6 +2888,13 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
// Purpur end
|
||||
|
||||
+ // Kaiiju start
|
||||
+ @Override
|
||||
+ public YamlConfiguration getKaiijuConfig() {
|
||||
+ return KaiijuConfig.config;
|
||||
+ return dev.kaiijumc.kaiiju.KaiijuConfig.config;
|
||||
+ }
|
||||
+ // Kaiiju end
|
||||
+
|
||||
|
||||
@@ -5,18 +5,10 @@ Subject: [PATCH] Kaiiju RegionFormat Configuration
|
||||
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index da7e04a93664e20b9187292ddb7c1f935f5f2883..66bbab7ebe1738cd937963b35fad9cdda763fa88 100644
|
||||
index ef48d534d239fc5fcfd1b0500cc7868c1cf63142..328fbed775c26faa9a87171bfda68d8ee977a889 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
@@ -15,6 +15,7 @@ import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
+import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -190,4 +191,15 @@ public class KaiijuConfig {
|
||||
@@ -191,4 +191,16 @@ public class KaiijuConfig {
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
@@ -27,8 +19,9 @@ index da7e04a93664e20b9187292ddb7c1f935f5f2883..66bbab7ebe1738cd937963b35fad9cdd
|
||||
+ private static void regionFormatSettings() {
|
||||
+ regionFormatName = getString("region-format.format", regionFormatName).toUpperCase();
|
||||
+ if (!regionFormatList.contains(regionFormatName)) {
|
||||
+ Bukkit.getLogger().log(Level.SEVERE, "Unknown region format in fusion.yml: " + regionFormatName);
|
||||
+ Bukkit.getLogger().log(Level.SEVERE, "Unknown region format in kaiiju.yml: " + regionFormatName);
|
||||
+ Bukkit.getLogger().log(Level.SEVERE, "Falling back to ANVIL region file format.");
|
||||
+ regionFormatName = "ANVIL";
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ Copyright xymb@endcrystal.me
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index c6a4c48b14a8c927284720b79b93ee1aa9df7da6..2ea3d2f26d4547ea5094cc63d492ea1406ffbd44 100644
|
||||
index c6a4c48b14a8c927284720b79b93ee1aa9df7da6..cc727f183e0a2058c0b785efa9a95545b5ceb32a 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -13,6 +13,10 @@ dependencies {
|
||||
@@ -16,7 +16,7 @@ index c6a4c48b14a8c927284720b79b93ee1aa9df7da6..2ea3d2f26d4547ea5094cc63d492ea14
|
||||
}
|
||||
// Pufferfish end
|
||||
+ // Kaiiju start - Linear format
|
||||
+ implementation("com.github.luben:zstd-jni:1.5.2-5")
|
||||
+ implementation("com.github.luben:zstd-jni:1.5.4-1")
|
||||
+ implementation("org.lz4:lz4-java:1.8.0")
|
||||
+ // Kaiiju end
|
||||
// Paper start
|
||||
@@ -38,18 +38,33 @@ index f2c27e0ac65be4b75c1d86ef6fd45fdb538d96ac..00724993d0448454d14a47652b039b88
|
||||
public static final class InProgressWrite {
|
||||
public long writeCounter;
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index 66bbab7ebe1738cd937963b35fad9cdda763fa88..16ebf32e0c62025958c95216531f72cc418e8d14 100644
|
||||
index 328fbed775c26faa9a87171bfda68d8ee977a889..f5c9a42b98dceda2355a28591c59c383e7906421 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
@@ -192,7 +192,7 @@ public class KaiijuConfig {
|
||||
@@ -192,8 +192,9 @@ public class KaiijuConfig {
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
- public static List<String> regionFormatList = Arrays.asList("ANVIL");
|
||||
+ public static List<String> regionFormatList = Arrays.asList("ANVIL", "LINEAR");
|
||||
public static String regionFormatName = "ANVIL";
|
||||
+ public static int regionFormatLinearCompressionLevel = 1;
|
||||
|
||||
private static void regionFormatSettings() {
|
||||
regionFormatName = getString("region-format.format", regionFormatName).toUpperCase();
|
||||
@@ -202,5 +203,11 @@ public class KaiijuConfig {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Falling back to ANVIL region file format.");
|
||||
regionFormatName = "ANVIL";
|
||||
}
|
||||
+ regionFormatLinearCompressionLevel = getInt("region-format.linear.compression-level", regionFormatLinearCompressionLevel);
|
||||
+ if (regionFormatLinearCompressionLevel > 23 || regionFormatLinearCompressionLevel < 1) {
|
||||
+ Bukkit.getLogger().log(Level.SEVERE, "Linear region compression level should be between 1 and 22 in kaiiju.yml: " + regionFormatLinearCompressionLevel);
|
||||
+ Bukkit.getLogger().log(Level.SEVERE, "Falling back to compression level 1.");
|
||||
+ regionFormatLinearCompressionLevel = 1;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/region/AbstractRegionFile.java b/src/main/java/dev/kaiijumc/kaiiju/region/AbstractRegionFile.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..70d53d80f474eb80acc93275ad6bf1da98ea8ae7
|
||||
@@ -134,15 +149,16 @@ index 0000000000000000000000000000000000000000..0b84b1aa4b822bdcb783285e8ea99a4f
|
||||
+}
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFile.java b/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFile.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ba4910d564064a1367cb9d727e8fcc52573d1944
|
||||
index 0000000000000000000000000000000000000000..5902bc0cc13d1a77eb547efc7579fd493de2fcf5
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFile.java
|
||||
@@ -0,0 +1,338 @@
|
||||
@@ -0,0 +1,339 @@
|
||||
+package dev.kaiijumc.kaiiju.region;
|
||||
+
|
||||
+import com.github.luben.zstd.ZstdInputStream;
|
||||
+import com.github.luben.zstd.ZstdOutputStream;
|
||||
+import com.mojang.logging.LogUtils;
|
||||
+import dev.kaiijumc.kaiiju.KaiijuConfig;
|
||||
+import net.jpountz.lz4.LZ4Compressor;
|
||||
+import net.jpountz.lz4.LZ4Factory;
|
||||
+import net.jpountz.lz4.LZ4FastDecompressor;
|
||||
@@ -173,7 +189,7 @@ index 0000000000000000000000000000000000000000..ba4910d564064a1367cb9d727e8fcc52
|
||||
+ private boolean close = false;
|
||||
+ public Path regionFile;
|
||||
+ public final ReentrantLock fileLock = new ReentrantLock(true);
|
||||
+ final byte COMPRESSION_LEVEL = 1;
|
||||
+ final int COMPRESSION_LEVEL = KaiijuConfig.regionFormatLinearCompressionLevel;
|
||||
+
|
||||
+ public Path getRegionFile() {
|
||||
+ return this.regionFile;
|
||||
@@ -903,7 +919,7 @@ index bd502ca721de0cab438d995efa00ad0554c0d2fe..37242c6225795271e0ba6a853252f2da
|
||||
regionfile.flush();
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index b17bc6482d2bd97d2e48d3967dea72605cf13164..2a13629ffb60dc60706da446e6dc7f3683d0410b 100644
|
||||
index 9b5323edd99848b73ea0e34230e7bec8dc23be8c..619c7713d573e8f438ea23a3fcb185a98abf5100 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -552,7 +552,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
|
||||
@@ -7,31 +7,33 @@ Inspired by "Lobotomized animals" by @KioProject123
|
||||
Checks might be a nuisance to performance.
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
index ac4440f8d2bd30e3e074ef797d5138b64996fcbb..dbbba258dbdc465b89c71508d76c5c596fd03bea 100644
|
||||
index ac4440f8d2bd30e3e074ef797d5138b64996fcbb..d28f05943ef25aad1d5a0d4d3f72b991a3caaa5f 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
@@ -123,6 +123,15 @@ public class KaiijuWorldConfig {
|
||||
@@ -123,6 +123,17 @@ public class KaiijuWorldConfig {
|
||||
return value.isEmpty() ? fallback : value;
|
||||
}
|
||||
|
||||
+ public boolean lobotomizeAnimalEnabled = false;
|
||||
+ public int lobotomizeAnimalCheckInterval = 100;
|
||||
+ public boolean lobotomizeAnimalCheckCanJump = true;
|
||||
+ public boolean lobotomizeAnimalLookAtPlayer = false;
|
||||
+ public boolean lobotomizeAnimalFloat = true;
|
||||
+
|
||||
private void lobotomizeSettings() {
|
||||
+ lobotomizeAnimalEnabled = getBoolean("lobotomize.animal.enabled", lobotomizeAnimalEnabled);
|
||||
+ lobotomizeAnimalCheckInterval = getInt("lobotomize.animal.check-interval", lobotomizeAnimalCheckInterval);
|
||||
+ lobotomizeAnimalCheckCanJump = getBoolean("lobotomize.animal.check-can-jump", lobotomizeAnimalCheckCanJump);
|
||||
+ lobotomizeAnimalLookAtPlayer = getBoolean("lobotomize.animal.look-at-player", lobotomizeAnimalLookAtPlayer);
|
||||
+ lobotomizeAnimalFloat = getBoolean("lobotomize.animal.float", lobotomizeAnimalFloat);
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/entity/Lobotomized.java b/src/main/java/dev/kaiijumc/kaiiju/entity/Lobotomized.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..8912f25e94d5e7510d965aa02b73c87e0b75fb51
|
||||
index 0000000000000000000000000000000000000000..805df3e27cfbbdf3525c96942afca12d50abc350
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/entity/Lobotomized.java
|
||||
@@ -0,0 +1,56 @@
|
||||
@@ -0,0 +1,73 @@
|
||||
+package dev.kaiijumc.kaiiju.entity;
|
||||
+
|
||||
+import net.minecraft.core.BlockPos;
|
||||
@@ -52,15 +54,15 @@ index 0000000000000000000000000000000000000000..8912f25e94d5e7510d965aa02b73c87e
|
||||
+ this.isLobotomized = b;
|
||||
+ }
|
||||
+
|
||||
+ public boolean checkLobotomized(LivingEntity livingEntity) {
|
||||
+ Level level = livingEntity.getLevel();
|
||||
+ public boolean checkLobotomized(LivingEntity entity) {
|
||||
+ Level level = entity.getLevel();
|
||||
+ int interval = level.kaiijuConfig.lobotomizeAnimalCheckInterval;
|
||||
+ if (this.notLobotomizedCount > 3) {
|
||||
+ // check half as often if not lobotomized for the last 3+ consecutive checks
|
||||
+ interval *= 2;
|
||||
+ }
|
||||
+ if ((livingEntity.getId() + livingEntity.tickCount) % interval == 0) {
|
||||
+ this.isLobotomized = livingEntity.isOnGround() && !canTravelFrom(new BlockPos(livingEntity.getX(), livingEntity.getY() + 0.5D, livingEntity.getZ()), level, livingEntity.getBbHeight() <= 1.0F);
|
||||
+ if ((entity.getId() + entity.tickCount) % interval == 0) {
|
||||
+ this.isLobotomized = entity.isOnGround() && !canTravelFrom(entity, level, entity.getBbHeight() <= 1.0F);
|
||||
+
|
||||
+ if (this.isLobotomized) {
|
||||
+ this.notLobotomizedCount = 0;
|
||||
@@ -71,21 +73,38 @@ index 0000000000000000000000000000000000000000..8912f25e94d5e7510d965aa02b73c87e
|
||||
+ return this.isLobotomized;
|
||||
+ }
|
||||
+
|
||||
+ private boolean canTravelFrom(BlockPos pos, Level level, boolean ignoreTop) {
|
||||
+ return canTravelTo(pos.east(), level, ignoreTop)
|
||||
+ || canTravelTo(pos.west(), level, ignoreTop)
|
||||
+ || canTravelTo(pos.north(), level, ignoreTop)
|
||||
+ || canTravelTo(pos.south(), level, ignoreTop);
|
||||
+ private boolean canTravelFrom(LivingEntity entity, Level level, boolean ignoreTop) {
|
||||
+ BlockPos pos = new BlockPos(entity.getX(), entity.getY() + 0.5D, entity.getZ());
|
||||
+ return canTravelTo(entity, pos.east(), level, ignoreTop)
|
||||
+ || canTravelTo(entity, pos.west(), level, ignoreTop)
|
||||
+ || canTravelTo(entity, pos.north(), level, ignoreTop)
|
||||
+ || canTravelTo(entity, pos.south(), level, ignoreTop);
|
||||
+ }
|
||||
+
|
||||
+ private boolean canTravelTo(BlockPos pos, Level level, boolean ignoreTop) {
|
||||
+ private boolean canTravelTo(LivingEntity entity, BlockPos pos, Level level, boolean ignoreTop) {
|
||||
+ BlockState top;
|
||||
+ // Check if mob can jump over block
|
||||
+ if (level.kaiijuConfig.lobotomizeAnimalCheckCanJump && canJump(entity, level, ignoreTop)) {
|
||||
+ top = level.getBlockStateIfLoaded(pos.above());
|
||||
+ if (top == null) return false;
|
||||
+ if (top.isPathfindable(level, pos, net.minecraft.world.level.pathfinder.PathComputationType.LAND)) {
|
||||
+ if (ignoreTop) return true;
|
||||
+ net.minecraft.world.level.block.state.BlockState above = level.getBlockState(pos.above(2));
|
||||
+ if (above.isPathfindable(level, pos, net.minecraft.world.level.pathfinder.PathComputationType.LAND)) return true;
|
||||
+ }
|
||||
+ }
|
||||
+ BlockState bottom = level.getBlockStateIfLoaded(pos);
|
||||
+ if (bottom == null) return false; // Chunk not loaded
|
||||
+ if (!bottom.isPathfindable(level, pos, PathComputationType.LAND)) return false;
|
||||
+ if (ignoreTop) return true;
|
||||
+ BlockState top = level.getBlockState(pos.above());
|
||||
+ if (!top.isPathfindable(level, pos, PathComputationType.LAND)) return false;
|
||||
+ return true;
|
||||
+ top = level.getBlockState(pos.above());
|
||||
+ return top.isPathfindable(level, pos, PathComputationType.LAND);
|
||||
+ }
|
||||
+
|
||||
+ private boolean canJump(LivingEntity entity, Level level, boolean ignoreTop) {
|
||||
+ BlockPos pos = new BlockPos(entity.getX(), entity.getY() + 2.5D, entity.getZ());
|
||||
+ net.minecraft.world.level.block.Block above = level.getBlockIfLoaded(pos);
|
||||
+ return !above.hasCollision;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
|
||||
@@ -5,11 +5,11 @@ Subject: [PATCH] Kaiiju Lobotomize Villager
|
||||
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
index dbbba258dbdc465b89c71508d76c5c596fd03bea..a213a3c447cd69b5dd88eefd48c2caa6d19f5abc 100644
|
||||
index d28f05943ef25aad1d5a0d4d3f72b991a3caaa5f..91034f553193381c470544ff068d4d7cfb82cc50 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
@@ -127,11 +127,21 @@ public class KaiijuWorldConfig {
|
||||
public int lobotomizeAnimalCheckInterval = 100;
|
||||
@@ -128,6 +128,11 @@ public class KaiijuWorldConfig {
|
||||
public boolean lobotomizeAnimalCheckCanJump = true;
|
||||
public boolean lobotomizeAnimalLookAtPlayer = false;
|
||||
public boolean lobotomizeAnimalFloat = true;
|
||||
+ public boolean lobotomizeVillagerEnabled = false;
|
||||
@@ -20,7 +20,8 @@ index dbbba258dbdc465b89c71508d76c5c596fd03bea..a213a3c447cd69b5dd88eefd48c2caa6
|
||||
|
||||
private void lobotomizeSettings() {
|
||||
lobotomizeAnimalEnabled = getBoolean("lobotomize.animal.enabled", lobotomizeAnimalEnabled);
|
||||
lobotomizeAnimalCheckInterval = getInt("lobotomize.animal.check-interval", lobotomizeAnimalCheckInterval);
|
||||
@@ -135,5 +140,10 @@ public class KaiijuWorldConfig {
|
||||
lobotomizeAnimalCheckCanJump = getBoolean("lobotomize.animal.check-can-jump", lobotomizeAnimalCheckCanJump);
|
||||
lobotomizeAnimalLookAtPlayer = getBoolean("lobotomize.animal.look-at-player", lobotomizeAnimalLookAtPlayer);
|
||||
lobotomizeAnimalFloat = getBoolean("lobotomize.animal.float", lobotomizeAnimalFloat);
|
||||
+ lobotomizeVillagerEnabled = getBoolean("lobotomize.villager.enabled", lobotomizeVillagerEnabled);
|
||||
|
||||
19
patches/server/0008-Kaiiju-Network-Configuration.patch
Normal file
19
patches/server/0008-Kaiiju-Network-Configuration.patch
Normal file
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
||||
Date: Thu, 16 Feb 2023 01:38:59 +0200
|
||||
Subject: [PATCH] Kaiiju Network Configuration
|
||||
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index f5c9a42b98dceda2355a28591c59c383e7906421..3756ab4acf4487972fd065fe85ef7812605fda41 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
@@ -210,4 +210,7 @@ public class KaiijuConfig {
|
||||
regionFormatLinearCompressionLevel = 1;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ private static void networkSettings() {
|
||||
+ }
|
||||
}
|
||||
\ No newline at end of file
|
||||
@@ -0,0 +1,57 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
||||
Date: Thu, 16 Feb 2023 01:49:54 +0200
|
||||
Subject: [PATCH] Purpur Network Send Null Entity Packets
|
||||
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index 3756ab4acf4487972fd065fe85ef7812605fda41..c213726efa4dd95e6e731e9c7e75fb23c3c4763f 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
@@ -211,6 +211,8 @@ public class KaiijuConfig {
|
||||
}
|
||||
}
|
||||
|
||||
+ public static boolean sendNullEntityPackets = true;
|
||||
private static void networkSettings() {
|
||||
+ sendNullEntityPackets = getBoolean("network.send-null-entity-packets", sendNullEntityPackets);
|
||||
}
|
||||
}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index 0f9a3a6c05fee59c29764f0c0d7a6cb8a2a861b1..9d0a52bf600583ecbf80c2233a01ff43e609266f 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -186,6 +186,11 @@ public class ServerEntity {
|
||||
this.teleportDelay = 0;
|
||||
packet1 = new ClientboundTeleportEntityPacket(this.entity);
|
||||
}
|
||||
+ // Kaiiju start - Don't send null move entity packets
|
||||
+ if (!dev.kaiijumc.kaiiju.KaiijuConfig.sendNullEntityPackets && isNullMovePacket(packet1)) {
|
||||
+ packet1 = null;
|
||||
+ }
|
||||
+ // Kaiiju end
|
||||
}
|
||||
|
||||
if ((this.trackDelta || this.entity.hasImpulse || this.entity instanceof LivingEntity && ((LivingEntity) this.entity).isFallFlying()) && this.tickCount > 0) {
|
||||
@@ -252,6 +257,20 @@ public class ServerEntity {
|
||||
|
||||
}
|
||||
|
||||
+ // Kaiiju start - Don't send null move entity packets
|
||||
+ private boolean isNullMovePacket(Packet<?> packet) {
|
||||
+ if (packet instanceof ClientboundMoveEntityPacket move) {
|
||||
+ if (packet instanceof ClientboundMoveEntityPacket.Pos)
|
||||
+ return move.getXa() == 0 && move.getYa() == 0 && move.getZa() == 0;
|
||||
+ if (packet instanceof ClientboundMoveEntityPacket.PosRot)
|
||||
+ return move.getXa() == 0 && move.getYa() == 0 && move.getZa() == 0 && move.getyRot() == 0 && move.getxRot() == 0;
|
||||
+ if (packet instanceof ClientboundMoveEntityPacket.Rot)
|
||||
+ return move.getyRot() == 0 && move.getxRot() == 0;
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Kaiiju end
|
||||
+
|
||||
public void removePairing(ServerPlayer player) {
|
||||
this.entity.stopSeenByPlayer(player);
|
||||
player.connection.send(new ClientboundRemoveEntitiesPacket(new int[]{this.entity.getId()}));
|
||||
21
patches/server/0010-Kaiiju-Lithium-Configuration.patch
Normal file
21
patches/server/0010-Kaiiju-Lithium-Configuration.patch
Normal file
@@ -0,0 +1,21 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
||||
Date: Thu, 16 Feb 2023 21:28:49 +0200
|
||||
Subject: [PATCH] Kaiiju Lithium Configuration
|
||||
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index c213726efa4dd95e6e731e9c7e75fb23c3c4763f..e1fc127ac3fb47f3a4ad84d4b3f3ec25f40389f8 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
@@ -215,4 +215,9 @@ public class KaiijuConfig {
|
||||
private static void networkSettings() {
|
||||
sendNullEntityPackets = getBoolean("network.send-null-entity-packets", sendNullEntityPackets);
|
||||
}
|
||||
+
|
||||
+ public static boolean lithiumEnable = true;
|
||||
+ private static void lithiumSettings() {
|
||||
+ lithiumEnable = getBoolean("lithium.enable", lithiumEnable);
|
||||
+ }
|
||||
}
|
||||
\ No newline at end of file
|
||||
126
patches/server/0011-Lithium-Math-FastUtil.patch
Normal file
126
patches/server/0011-Lithium-Math-FastUtil.patch
Normal file
@@ -0,0 +1,126 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
||||
Date: Thu, 16 Feb 2023 21:34:37 +0200
|
||||
Subject: [PATCH] Lithium Math FastUtil
|
||||
|
||||
Author: JellySquid
|
||||
Licence: LGPL-3.0
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index e1fc127ac3fb47f3a4ad84d4b3f3ec25f40389f8..ff45fefd7058673f0c79875854accd041bc0c3a1 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
@@ -217,7 +217,9 @@ public class KaiijuConfig {
|
||||
}
|
||||
|
||||
public static boolean lithiumEnable = true;
|
||||
+ public static boolean lithiumMathFastUtil = true;
|
||||
private static void lithiumSettings() {
|
||||
lithiumEnable = getBoolean("lithium.enable", lithiumEnable);
|
||||
+ lithiumMathFastUtil = getBoolean("lithium.math.fast-util", lithiumMathFastUtil) && lithiumEnable;
|
||||
}
|
||||
}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/core/AxisCycle.java b/src/main/java/net/minecraft/core/AxisCycle.java
|
||||
index b5d8a60dc78a76c0a55bfc30cc49d26857bd914a..dd8d98acf21bb676e86f9befb45fd09e1b14a01d 100644
|
||||
--- a/src/main/java/net/minecraft/core/AxisCycle.java
|
||||
+++ b/src/main/java/net/minecraft/core/AxisCycle.java
|
||||
@@ -35,6 +35,18 @@ public enum AxisCycle {
|
||||
|
||||
@Override
|
||||
public Direction.Axis cycle(Direction.Axis axis) {
|
||||
+ // Kaiiju start - Lithium
|
||||
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.lithiumMathFastUtil){
|
||||
+ switch (axis.ordinal()) {
|
||||
+ case 0: //X
|
||||
+ return Direction.Axis.Y;
|
||||
+ case 1: //Y
|
||||
+ return Direction.Axis.Z;
|
||||
+ case 2: //Z
|
||||
+ return Direction.Axis.X;
|
||||
+ }
|
||||
+ }
|
||||
+ // Kaiiju end
|
||||
return AXIS_VALUES[Math.floorMod(axis.ordinal() + 1, 3)];
|
||||
}
|
||||
|
||||
@@ -56,6 +68,18 @@ public enum AxisCycle {
|
||||
|
||||
@Override
|
||||
public Direction.Axis cycle(Direction.Axis axis) {
|
||||
+ // Kaiiju start - Lithium
|
||||
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.lithiumMathFastUtil){
|
||||
+ switch (axis.ordinal()) {
|
||||
+ case 0: //X
|
||||
+ return Direction.Axis.Z;
|
||||
+ case 1: //Y
|
||||
+ return Direction.Axis.X;
|
||||
+ case 2: //Z
|
||||
+ return Direction.Axis.Y;
|
||||
+ }
|
||||
+ }
|
||||
+ // Kaiiju end
|
||||
return AXIS_VALUES[Math.floorMod(axis.ordinal() - 1, 3)];
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/Direction.java b/src/main/java/net/minecraft/core/Direction.java
|
||||
index a4dc96b1a3bf309584657e3a1e7dfaea967f9425..09c1989dc3b12d9488b8869e71f2a4890656cc36 100644
|
||||
--- a/src/main/java/net/minecraft/core/Direction.java
|
||||
+++ b/src/main/java/net/minecraft/core/Direction.java
|
||||
@@ -191,6 +191,7 @@ public enum Direction implements StringRepresentable {
|
||||
}
|
||||
|
||||
public Direction getOpposite() {
|
||||
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.lithiumMathFastUtil) return VALUES[this.oppositeIndex]; // Kaiiju
|
||||
return from3DDataValue(this.oppositeIndex);
|
||||
}
|
||||
|
||||
@@ -453,6 +454,7 @@ public enum Direction implements StringRepresentable {
|
||||
}
|
||||
|
||||
public static Direction getRandom(RandomSource random) {
|
||||
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.lithiumMathFastUtil) return VALUES[random.nextInt(VALUES.length)]; // Kaiiju
|
||||
return Util.getRandom(VALUES, random);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/phys/AABB.java b/src/main/java/net/minecraft/world/phys/AABB.java
|
||||
index cfb2e46b34b2982d6724f18214557fc80cf4adfa..4fae201f57dc23ed0e25f17739f97133a7f7534c 100644
|
||||
--- a/src/main/java/net/minecraft/world/phys/AABB.java
|
||||
+++ b/src/main/java/net/minecraft/world/phys/AABB.java
|
||||
@@ -81,10 +81,36 @@ public class AABB {
|
||||
}
|
||||
|
||||
public double min(Direction.Axis axis) {
|
||||
+ // Kaiiju start - Lithium
|
||||
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.lithiumMathFastUtil){
|
||||
+ switch (axis.ordinal()) {
|
||||
+ case 0: //X
|
||||
+ return this.minX;
|
||||
+ case 1: //Y
|
||||
+ return this.minY;
|
||||
+ case 2: //Z
|
||||
+ return this.minZ;
|
||||
+ }
|
||||
+ throw new IllegalArgumentException();
|
||||
+ }
|
||||
+ // Kaiiju end
|
||||
return axis.choose(this.minX, this.minY, this.minZ);
|
||||
}
|
||||
|
||||
public double max(Direction.Axis axis) {
|
||||
+ // Kaiiju start - Lithium
|
||||
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.lithiumMathFastUtil){
|
||||
+ switch (axis.ordinal()) {
|
||||
+ case 0: //X
|
||||
+ return this.maxX;
|
||||
+ case 1: //Y
|
||||
+ return this.maxY;
|
||||
+ case 2: //Z
|
||||
+ return this.maxZ;
|
||||
+ }
|
||||
+ throw new IllegalArgumentException();
|
||||
+ }
|
||||
+ // Kaiiju end
|
||||
return axis.choose(this.maxX, this.maxY, this.maxZ);
|
||||
}
|
||||
|
||||
145
patches/server/0012-Lithium-Math-SineLut.patch
Normal file
145
patches/server/0012-Lithium-Math-SineLut.patch
Normal file
@@ -0,0 +1,145 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
||||
Date: Fri, 17 Feb 2023 00:34:31 +0200
|
||||
Subject: [PATCH] Lithium Math SineLut
|
||||
|
||||
Author: JellySquid
|
||||
Licence: LGPL-3.0
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index ff45fefd7058673f0c79875854accd041bc0c3a1..8105e2747ee784ba9dde2ddeb7bf7a29639337ee 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
@@ -218,8 +218,10 @@ public class KaiijuConfig {
|
||||
|
||||
public static boolean lithiumEnable = true;
|
||||
public static boolean lithiumMathFastUtil = true;
|
||||
+ public static boolean lithiumMathSineLut = true;
|
||||
private static void lithiumSettings() {
|
||||
lithiumEnable = getBoolean("lithium.enable", lithiumEnable);
|
||||
lithiumMathFastUtil = getBoolean("lithium.math.fast-util", lithiumMathFastUtil) && lithiumEnable;
|
||||
+ lithiumMathSineLut = getBoolean("lithium.math.sine-lut", lithiumMathSineLut) && lithiumEnable;
|
||||
}
|
||||
}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/me/jellysquid/mods/lithium/common/util/math/CompactSineLUT.java b/src/main/java/me/jellysquid/mods/lithium/common/util/math/CompactSineLUT.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ccb45e94ea6d1a627df786fb88baec7edd1f2427
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/jellysquid/mods/lithium/common/util/math/CompactSineLUT.java
|
||||
@@ -0,0 +1,90 @@
|
||||
+package me.jellysquid.mods.lithium.common.util.math;
|
||||
+
|
||||
+import net.minecraft.util.Mth;
|
||||
+
|
||||
+/**
|
||||
+ * A replacement for the sine angle lookup table used in {@link MathHelper}, both reducing the size of LUT and improving
|
||||
+ * the access patterns for common paired sin/cos operations.
|
||||
+ *
|
||||
+ * sin(-x) = -sin(x)
|
||||
+ * ... to eliminate negative angles from the LUT.
|
||||
+ *
|
||||
+ * sin(x) = sin(pi/2 - x)
|
||||
+ * ... to eliminate supplementary angles from the LUT.
|
||||
+ *
|
||||
+ * Using these identities allows us to reduce the LUT from 64K entries (256 KB) to just 16K entries (64 KB), enabling
|
||||
+ * it to better fit into the CPU's caches at the expense of some cycles on the fast path. The implementation has been
|
||||
+ * tightly optimized to avoid branching where possible and to use very quick integer operations.
|
||||
+ *
|
||||
+ * Generally speaking, reducing the size of a lookup table is always a good optimization, but since we need to spend
|
||||
+ * extra CPU cycles trying to maintain parity with vanilla, there is the potential risk that this implementation ends
|
||||
+ * up being slower than vanilla when the lookup table is able to be kept in cache memory.
|
||||
+ *
|
||||
+ * Unlike other "fast math" implementations, the values returned by this class are *bit-for-bit identical* with those
|
||||
+ * from {@link MathHelper}. Validation is performed during runtime to ensure that the table is correct.
|
||||
+ *
|
||||
+ * @author coderbot16 Author of the original (and very clever) implementation in Rust:
|
||||
+ * https://gitlab.com/coderbot16/i73/-/tree/master/i73-trig/src
|
||||
+ * @author jellysquid3 Additional optimizations, port to Java
|
||||
+ */
|
||||
+public class CompactSineLUT {
|
||||
+ private static final int[] SINE_TABLE_INT = new int[16384 + 1];
|
||||
+ private static final float SINE_TABLE_MIDPOINT;
|
||||
+
|
||||
+ static {
|
||||
+ final float[] SINE_TABLE = Mth.getSinTable();
|
||||
+ // Copy the sine table, covering to raw int bits
|
||||
+ for (int i = 0; i < SINE_TABLE_INT.length; i++) {
|
||||
+ SINE_TABLE_INT[i] = Float.floatToRawIntBits(SINE_TABLE[i]);
|
||||
+ }
|
||||
+
|
||||
+ SINE_TABLE_MIDPOINT = SINE_TABLE[SINE_TABLE.length / 2];
|
||||
+
|
||||
+ // Test that the lookup table is correct during runtime
|
||||
+ for (int i = 0; i < SINE_TABLE.length; i++) {
|
||||
+ float expected = SINE_TABLE[i];
|
||||
+ float value = lookup(i);
|
||||
+
|
||||
+ if (expected != value) {
|
||||
+ throw new IllegalArgumentException(String.format("LUT error at index %d (expected: %s, found: %s)", i, expected, value));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // [VanillaCopy] MathHelper#sin(float)
|
||||
+ public static float sin(float f) {
|
||||
+ return lookup((int) (f * 10430.378f) & 0xFFFF);
|
||||
+ }
|
||||
+
|
||||
+ // [VanillaCopy] MathHelper#cos(float)
|
||||
+ public static float cos(float f) {
|
||||
+ return lookup((int) (f * 10430.378f + 16384.0f) & 0xFFFF);
|
||||
+ }
|
||||
+
|
||||
+ private static float lookup(int index) {
|
||||
+ // A special case... Is there some way to eliminate this?
|
||||
+ if (index == 32768) {
|
||||
+ return SINE_TABLE_MIDPOINT;
|
||||
+ }
|
||||
+
|
||||
+ // Trigonometric identity: sin(-x) = -sin(x)
|
||||
+ // Given a domain of 0 <= x <= 2*pi, just negate the value if x > pi.
|
||||
+ // This allows the sin table size to be halved.
|
||||
+ int neg = (index & 0x8000) << 16;
|
||||
+
|
||||
+ // All bits set if (pi/2 <= x), none set otherwise
|
||||
+ // Extracts the 15th bit from 'half'
|
||||
+ int mask = (index << 17) >> 31;
|
||||
+
|
||||
+ // Trigonometric identity: sin(x) = sin(pi/2 - x)
|
||||
+ int pos = (0x8001 & mask) + (index ^ mask);
|
||||
+
|
||||
+ // Wrap the position in the table. Moving this down to immediately before the array access
|
||||
+ // seems to help the Hotspot compiler optimize the bit math better.
|
||||
+ pos &= 0x7fff;
|
||||
+
|
||||
+ // Fetch the corresponding value from the LUT and invert the sign bit as needed
|
||||
+ // This directly manipulate the sign bit on the float bits to simplify logic
|
||||
+ return Float.intBitsToFloat(SINE_TABLE_INT[pos] ^ neg);
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/util/Mth.java b/src/main/java/net/minecraft/util/Mth.java
|
||||
index 618f19d70a61062ed5989ec6cf0c036f2e047466..dd320f3a3f2b51a723a2fcc65d477a22c0901455 100644
|
||||
--- a/src/main/java/net/minecraft/util/Mth.java
|
||||
+++ b/src/main/java/net/minecraft/util/Mth.java
|
||||
@@ -45,11 +45,19 @@ public class Mth {
|
||||
return (float)((int)(value * f)) / f;
|
||||
}
|
||||
|
||||
+ // Kaiiju start
|
||||
+ public static float[] getSinTable() {
|
||||
+ return SIN;
|
||||
+ }
|
||||
+ // Kaiiju end
|
||||
+
|
||||
public static float sin(float value) {
|
||||
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.lithiumMathSineLut) return me.jellysquid.mods.lithium.common.util.math.CompactSineLUT.sin(value); // Kaiiju
|
||||
return SIN[(int)(value * 10430.378F) & '\uffff'];
|
||||
}
|
||||
|
||||
public static float cos(float value) {
|
||||
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.lithiumMathSineLut) return me.jellysquid.mods.lithium.common.util.math.CompactSineLUT.cos(value); // Kaiiju
|
||||
return SIN[(int)(value * 10430.378F + 16384.0F) & '\uffff'];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user