diff --git a/patches/server/0001-Kaiiju-Rebranding.patch b/patches/server/0001-Kaiiju-Rebranding.patch index 2d24152..594ed00 100644 --- a/patches/server/0001-Kaiiju-Rebranding.patch +++ b/patches/server/0001-Kaiiju-Rebranding.patch @@ -48,25 +48,25 @@ index 58dc84b7b3b04c2d0b00fc5fac5303d3378b3467..a128b1fabd4aadfe26a8375903c0451d metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> { Map> map = new HashMap<>(); diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java -index 719b0e318a85d4a1fb8f616deeb31193495b462e..7a7b70b29c2e88706beb7274bf58ee22b90dd09a 100644 +index 719b0e318a85d4a1fb8f616deeb31193495b462e..751b2bc79d29cb21c38cf5d35e3711149ec7b011 100644 --- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java +++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java -@@ -19,10 +19,10 @@ import java.util.stream.StreamSupport; +@@ -19,10 +19,11 @@ import java.util.stream.StreamSupport; public class PaperVersionFetcher implements VersionFetcher { private static final java.util.regex.Pattern VER_PATTERN = java.util.regex.Pattern.compile("^([0-9\\.]*)\\-.*R"); // R is an anchor, will always give '-R' at end - private static final String GITHUB_BRANCH_NAME = "master"; - private static final String DOWNLOAD_PAGE = "https://papermc.io/downloads"; -- private static @Nullable String mcVer; -- + // Kaiiju start + private static final String DOWNLOAD_PAGE = "https://github.com/KaiijuMC/Kaiiju/releases"; + private static int distance = -2; public int distance() { return distance; } + // Kaiiju end + private static @Nullable String mcVer; +- @Override public long getCacheTime() { return 720000; -@@ -31,8 +31,8 @@ public class PaperVersionFetcher implements VersionFetcher { +@@ -31,8 +32,8 @@ public class PaperVersionFetcher implements VersionFetcher { @Nonnull @Override public Component getVersionMessage(@Nonnull String serverVersion) { @@ -77,7 +77,7 @@ index 719b0e318a85d4a1fb8f616deeb31193495b462e..7a7b70b29c2e88706beb7274bf58ee22 final Component history = getHistory(); return history != null ? TextComponent.ofChildren(updateMessage, Component.newline(), history) : updateMessage; -@@ -45,7 +45,7 @@ public class PaperVersionFetcher implements VersionFetcher { +@@ -45,7 +46,7 @@ public class PaperVersionFetcher implements VersionFetcher { String result = matcher.group(); mcVer = result.substring(0, result.length() - 2); // strip 'R' anchor and trailing '-' } else { @@ -86,7 +86,7 @@ index 719b0e318a85d4a1fb8f616deeb31193495b462e..7a7b70b29c2e88706beb7274bf58ee22 org.bukkit.Bukkit.getLogger().warning("Pattern: " + VER_PATTERN.toString()); org.bukkit.Bukkit.getLogger().warning("Version: " + org.bukkit.Bukkit.getBukkitVersion()); } -@@ -56,6 +56,8 @@ public class PaperVersionFetcher implements VersionFetcher { +@@ -56,6 +57,8 @@ public class PaperVersionFetcher implements VersionFetcher { private static Component getUpdateStatusMessage(@Nonnull String repo, @Nonnull String branch, @Nonnull String versionInfo) { int distance; @@ -95,7 +95,7 @@ index 719b0e318a85d4a1fb8f616deeb31193495b462e..7a7b70b29c2e88706beb7274bf58ee22 try { int jenkinsBuild = Integer.parseInt(versionInfo); distance = fetchDistanceFromSiteApi(jenkinsBuild, getMinecraftVersion()); -@@ -63,6 +65,10 @@ public class PaperVersionFetcher implements VersionFetcher { +@@ -63,6 +66,10 @@ public class PaperVersionFetcher implements VersionFetcher { versionInfo = versionInfo.replace("\"", ""); distance = fetchDistanceFromGitHub(repo, branch, versionInfo); } diff --git a/patches/server/0002-Kaiiju-Configuration.patch b/patches/server/0002-Kaiiju-Configuration.patch index 831f8ba..1673997 100644 --- a/patches/server/0002-Kaiiju-Configuration.patch +++ b/patches/server/0002-Kaiiju-Configuration.patch @@ -339,10 +339,10 @@ index 0000000000000000000000000000000000000000..dd4c3ca77acb3aeefc69b8eb948b8b20 \ No newline at end of file diff --git a/src/main/java/dev/kaiijumc/kaiiju/command/KaiijuCommand.java b/src/main/java/dev/kaiijumc/kaiiju/command/KaiijuCommand.java new file mode 100644 -index 0000000000000000000000000000000000000000..0dde8879856f8882f2840b4b8bfb5aa0b3f06b91 +index 0000000000000000000000000000000000000000..08a2375b90a2088e2bdfb3e316144677346a3dd6 --- /dev/null +++ b/src/main/java/dev/kaiijumc/kaiiju/command/KaiijuCommand.java -@@ -0,0 +1,68 @@ +@@ -0,0 +1,67 @@ +package dev.kaiijumc.kaiiju.command; + +import dev.kaiijumc.kaiiju.KaiijuConfig; @@ -396,7 +396,6 @@ index 0000000000000000000000000000000000000000..0dde8879856f8882f2840b4b8bfb5aa0 + KaiijuConfig.reload((File) console.options.valueOf("kaiiju-settings")); + for (ServerLevel level : console.getAllLevels()) { + level.kaiijuConfig.reload(); -+ level.resetBreedingCooldowns(); + } + console.server.reloadCount++; + diff --git a/patches/server/0004-Kaiiju-RegionFormat-Linear.patch b/patches/server/0004-Kaiiju-RegionFormat-Linear.patch index ac68320..fea47c6 100644 --- a/patches/server/0004-Kaiiju-RegionFormat-Linear.patch +++ b/patches/server/0004-Kaiiju-RegionFormat-Linear.patch @@ -754,7 +754,7 @@ index dcfe090c269d4cbcc2eb1b6f85392848bb34656c..d42c320179ae055b8675d1ce6ce1788e try (DataInputStream out = new DataInputStream(new java.io.BufferedInputStream(new InflaterInputStream(Files.newInputStream(file))))) { return NbtIo.read((java.io.DataInput) out); diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -index 9633b01d2d961fd1403e353484d336376ef009eb..0046809490f871f8a1797284307d9d8a98c73726 100644 +index 9633b01d2d961fd1403e353484d336376ef009eb..e417076cda326a24148ad77ff7cbaf1a92d2163e 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java @@ -22,9 +22,13 @@ public class RegionFileStorage implements AutoCloseable { @@ -836,7 +836,7 @@ index 9633b01d2d961fd1403e353484d336376ef009eb..0046809490f871f8a1797284307d9d8a } // Paper end return regionfile; -@@ -124,14 +132,31 @@ public class RegionFileStorage implements AutoCloseable { +@@ -124,28 +132,46 @@ public class RegionFileStorage implements AutoCloseable { } // Paper end - cache regionfile does not exist state if (this.regionCache.size() >= io.papermc.paper.configuration.GlobalConfiguration.get().misc.regionFileCacheSize) { // Paper - configurable @@ -849,6 +849,8 @@ index 9633b01d2d961fd1403e353484d336376ef009eb..0046809490f871f8a1797284307d9d8a int j = chunkcoordintpair.getRegionX(); - Path path1 = path.resolve("r." + j + "." + chunkcoordintpair.getRegionZ() + ".mca"); // Paper - diff on change - if (existingOnly && !java.nio.file.Files.exists(path1)) { // Paper start - cache regionfile does not exist state +- this.markNonExisting(regionPos); +- return null; // CraftBukkit + // Kaiiju start - Polyglot + //Path path1 = path.resolve("r." + j + "." + chunkcoordintpair.getRegionZ() + ".mca"); // Paper - diff on change + Path path1; @@ -857,22 +859,21 @@ index 9633b01d2d961fd1403e353484d336376ef009eb..0046809490f871f8a1797284307d9d8a + Path linear = path.resolve("r." + j + "." + chunkcoordintpair.getRegionZ() + ".linear"); + if (java.nio.file.Files.exists(anvil)) path1 = anvil; + else if (java.nio.file.Files.exists(linear)) path1 = linear; -+ else return null; -+ } else { ++ else { ++ this.markNonExisting(regionPos); ++ return null; ++ } + } else { + String extension = switch (this.format) { + case "LINEAR" -> "linear"; + default -> "mca"; + }; + path1 = path.resolve("r." + j + "." + chunkcoordintpair.getRegionZ() + "." + extension); -+ } + this.createRegionFile(regionPos); + } + if (dev.kaiijumc.kaiiju.KaiijuConfig.regionFormatDebug) + org.bukkit.Bukkit.getLogger().info("[Region File Storage] Opening file " + path1 + " with format " + this.format + " (existingOnly = " + existingOnly + ")"); -+ //if (existingOnly && !java.nio.file.Files.exists(path1)) { // Paper start - cache regionfile does not exist state - this.markNonExisting(regionPos); - return null; // CraftBukkit - } else { -@@ -139,13 +164,15 @@ public class RegionFileStorage implements AutoCloseable { - } ++ // Paper end - cache regionfile does not exist state FileUtil.createDirectoriesSafe(this.folder); // Paper - only create directory if not existing only - moved from above - RegionFile regionfile1 = new RegionFile(path1, this.folder, this.sync, this.isChunkData); // Paper - allow for chunk regionfiles to regen header @@ -889,7 +890,7 @@ index 9633b01d2d961fd1403e353484d336376ef009eb..0046809490f871f8a1797284307d9d8a } // Paper end return regionfile1; -@@ -173,7 +200,7 @@ public class RegionFileStorage implements AutoCloseable { +@@ -173,7 +199,7 @@ public class RegionFileStorage implements AutoCloseable { } @@ -898,7 +899,7 @@ index 9633b01d2d961fd1403e353484d336376ef009eb..0046809490f871f8a1797284307d9d8a synchronized (regionfile) { try (DataInputStream datainputstream = regionfile.getChunkDataInputStream(chunkCoordinate)) { CompoundTag oversizedData = regionfile.getOversizedData(chunkCoordinate.x, chunkCoordinate.z); -@@ -220,14 +247,14 @@ public class RegionFileStorage implements AutoCloseable { +@@ -220,14 +246,14 @@ public class RegionFileStorage implements AutoCloseable { @Nullable public CompoundTag read(ChunkPos pos) throws IOException { // CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing @@ -915,7 +916,7 @@ index 9633b01d2d961fd1403e353484d336376ef009eb..0046809490f871f8a1797284307d9d8a // We add the regionfile parameter to avoid the potential deadlock (on fileLock) if we went back to obtain a regionfile // if we decide to re-read // Paper end -@@ -237,7 +264,7 @@ public class RegionFileStorage implements AutoCloseable { +@@ -237,7 +263,7 @@ public class RegionFileStorage implements AutoCloseable { // Paper start if (regionfile.isOversized(pos.x, pos.z)) { @@ -924,7 +925,7 @@ index 9633b01d2d961fd1403e353484d336376ef009eb..0046809490f871f8a1797284307d9d8a return readOversizedChunk(regionfile, pos); } // Paper end -@@ -251,12 +278,12 @@ public class RegionFileStorage implements AutoCloseable { +@@ -251,12 +277,12 @@ public class RegionFileStorage implements AutoCloseable { if (this.isChunkData) { ChunkPos chunkPos = ChunkSerializer.getChunkCoordinate(nbttagcompound); if (!chunkPos.equals(pos)) { @@ -940,7 +941,7 @@ index 9633b01d2d961fd1403e353484d336376ef009eb..0046809490f871f8a1797284307d9d8a return null; } } -@@ -290,13 +317,13 @@ public class RegionFileStorage implements AutoCloseable { +@@ -290,13 +316,13 @@ public class RegionFileStorage implements AutoCloseable { return nbttagcompound; } finally { // Paper start @@ -956,7 +957,7 @@ index 9633b01d2d961fd1403e353484d336376ef009eb..0046809490f871f8a1797284307d9d8a if (regionfile == null) { return; } -@@ -326,7 +353,7 @@ public class RegionFileStorage implements AutoCloseable { +@@ -326,7 +352,7 @@ public class RegionFileStorage implements AutoCloseable { } protected void write(ChunkPos pos, @Nullable CompoundTag nbt) throws IOException { @@ -965,7 +966,7 @@ index 9633b01d2d961fd1403e353484d336376ef009eb..0046809490f871f8a1797284307d9d8a if (nbt == null && regionfile == null) { return; } -@@ -376,7 +403,7 @@ public class RegionFileStorage implements AutoCloseable { +@@ -376,7 +402,7 @@ public class RegionFileStorage implements AutoCloseable { } // Paper end } finally { // Paper start @@ -974,7 +975,7 @@ index 9633b01d2d961fd1403e353484d336376ef009eb..0046809490f871f8a1797284307d9d8a } // Paper end } -@@ -385,7 +412,7 @@ public class RegionFileStorage implements AutoCloseable { +@@ -385,7 +411,7 @@ public class RegionFileStorage implements AutoCloseable { ObjectIterator objectiterator = this.regionCache.values().iterator(); while (objectiterator.hasNext()) { @@ -983,7 +984,7 @@ index 9633b01d2d961fd1403e353484d336376ef009eb..0046809490f871f8a1797284307d9d8a try { regionfile.close(); -@@ -401,7 +428,7 @@ public class RegionFileStorage implements AutoCloseable { +@@ -401,7 +427,7 @@ public class RegionFileStorage implements AutoCloseable { ObjectIterator objectiterator = this.regionCache.values().iterator(); while (objectiterator.hasNext()) { diff --git a/patches/server/0005-Kaiiju-Lobotomize-Configuration.patch b/patches/server/0005-Kaiiju-Lobotomize-Configuration.patch deleted file mode 100644 index d6bcb1e..0000000 --- a/patches/server/0005-Kaiiju-Lobotomize-Configuration.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com> -Date: Sat, 11 Feb 2023 02:10:20 +0200 -Subject: [PATCH] Kaiiju Lobotomize Configuration - - -diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java -index b194f4dbebcbbf5bb4e026a0169e2d24806b46ec..907fdfb368c87bfe7b4374bb0b5f49d5ff095339 100644 ---- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java -+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java -@@ -143,4 +143,7 @@ public class KaiijuWorldConfig { - regionFormatLinearCompressionLevel = 1; - } - } -+ -+ private void lobotomizeSettings() { -+ } - } -\ No newline at end of file diff --git a/patches/server/0007-Kaiiju-Network-Configuration.patch b/patches/server/0005-Kaiiju-Network-Configuration.patch similarity index 100% rename from patches/server/0007-Kaiiju-Network-Configuration.patch rename to patches/server/0005-Kaiiju-Network-Configuration.patch diff --git a/patches/server/0006-Kaiiju-Lobotomize-Animal.patch b/patches/server/0006-Kaiiju-Lobotomize-Animal.patch deleted file mode 100644 index 57caf4b..0000000 --- a/patches/server/0006-Kaiiju-Lobotomize-Animal.patch +++ /dev/null @@ -1,358 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com> -Date: Sat, 11 Feb 2023 06:29:15 +0200 -Subject: [PATCH] Kaiiju Lobotomize Animal - -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 907fdfb368c87bfe7b4374bb0b5f49d5ff095339..b99b438b92587f23c77c5321d5d23e76dc5450de 100644 ---- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java -+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java -@@ -144,6 +144,17 @@ public class KaiijuWorldConfig { - } - } - -+ 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); - } - } -\ No newline at end of file -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..14f085e75295882f52634622b40676295cd78d5f ---- /dev/null -+++ b/src/main/java/dev/kaiijumc/kaiiju/entity/Lobotomized.java -@@ -0,0 +1,73 @@ -+package dev.kaiijumc.kaiiju.entity; -+ -+import net.minecraft.core.BlockPos; -+import net.minecraft.world.entity.LivingEntity; -+import net.minecraft.world.level.Level; -+import net.minecraft.world.level.block.state.BlockState; -+import net.minecraft.world.level.pathfinder.PathComputationType; -+ -+public class Lobotomized { -+ private boolean isLobotomized = false; -+ private int notLobotomizedCount = 0; -+ -+ public boolean isLobotomized() { -+ return this.isLobotomized; -+ } -+ -+ public void setLobotomized(boolean b) { -+ this.isLobotomized = b; -+ } -+ -+ 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 ((entity.getId() + entity.tickCount) % interval == 0) { -+ this.isLobotomized = entity.isOnGround() && !canTravelFrom(entity, level, entity.getBbHeight() <= 1.0F); -+ -+ if (this.isLobotomized) { -+ this.notLobotomizedCount = 0; -+ } else { -+ this.notLobotomizedCount++; -+ } -+ } -+ return this.isLobotomized; -+ } -+ -+ private boolean canTravelFrom(LivingEntity entity, Level level, boolean ignoreTop) { -+ BlockPos pos = new BlockPos(entity.getBlockX(), (int) (entity.getY() + 0.5D), entity.getBlockZ()); -+ 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(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; -+ 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.getBlockX(), (int) (entity.getY() + 2.5D), entity.getBlockZ()); -+ 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 -index 485e5c3f1348f9e79f48f6ec3fad34fa58dcfe73..01ef7777286ed94f5ffe1aeefabc04a8941da384 100644 ---- a/src/main/java/net/minecraft/world/entity/LivingEntity.java -+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -301,6 +301,8 @@ public abstract class LivingEntity extends Entity implements Attackable { - this.brain = this.makeBrain(new Dynamic(dynamicopsnbt, (Tag) dynamicopsnbt.createMap((Map) ImmutableMap.of(dynamicopsnbt.createString("memories"), (Tag) dynamicopsnbt.emptyMap())))); - } - -+ public boolean isLobotomized() { return false; } // Kaiiju -+ - public Brain getBrain() { - return this.brain; - } -diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java -index 7093c62be53fe99ed9880fc8ddaa07440fe4f715..2acbb26af2c24b2f4c569d55e8ba44a068fd9d86 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java -+++ b/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java -@@ -16,6 +16,7 @@ public class FloatGoal extends Goal { - - @Override - public boolean canUse() { -+ if (!this.mob.getLevel().kaiijuConfig.lobotomizeAnimalFloat && this.mob.isLobotomized()) return false; // Kaiiju - return this.mob.isInWater() && this.mob.getFluidHeight(FluidTags.WATER) > this.mob.getFluidJumpThreshold() || this.mob.isInLava(); - } - -diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/FollowParentGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/FollowParentGoal.java -index a668d5263586f955a5656ac66bcc7fe8cc51fe00..c195e60a7773f106775cded4f1c3ed51a69ca2f5 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/goal/FollowParentGoal.java -+++ b/src/main/java/net/minecraft/world/entity/ai/goal/FollowParentGoal.java -@@ -21,6 +21,7 @@ public class FollowParentGoal extends Goal { - - @Override - public boolean canUse() { -+ if (this.animal.isLobotomized()) return false; // Kaiiju - if (this.animal.getAge() >= 0) { - return false; - } else { -@@ -51,6 +52,7 @@ public class FollowParentGoal extends Goal { - - @Override - public boolean canContinueToUse() { -+ if (this.animal.isLobotomized()) return false; // Kaiiju - if (this.animal.getAge() >= 0) { - return false; - } else if (!this.parent.isAlive()) { -diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/LookAtPlayerGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/LookAtPlayerGoal.java -index 8b189d7587303263efa1790066e5a83edd45f9d7..1304fc96834e4ce7156076fd893993a0aa75cbbc 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/goal/LookAtPlayerGoal.java -+++ b/src/main/java/net/minecraft/world/entity/ai/goal/LookAtPlayerGoal.java -@@ -48,6 +48,7 @@ public class LookAtPlayerGoal extends Goal { - - @Override - public boolean canUse() { -+ if (!mob.getLevel().kaiijuConfig.lobotomizeAnimalLookAtPlayer && this.mob.isLobotomized()) return false; // Kaiiju - if (this.mob.getRandom().nextFloat() >= this.probability) { - return false; - } else { -diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PanicGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/PanicGoal.java -index 268b7457c2a93af6d36c1c5f623c5856f94a7af1..f1469e424f7bdf4e5813f250c0eae673db0b9049 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/goal/PanicGoal.java -+++ b/src/main/java/net/minecraft/world/entity/ai/goal/PanicGoal.java -@@ -29,6 +29,7 @@ public class PanicGoal extends Goal { - - @Override - public boolean canUse() { -+ if (this.mob.isLobotomized()) return false; // Kaiiju - if (!this.shouldPanic()) { - return false; - } else { -@@ -81,6 +82,7 @@ public class PanicGoal extends Goal { - - @Override - public boolean canContinueToUse() { -+ if (this.mob.isLobotomized()) return false; // Kaiiju - // CraftBukkit start - introduce a temporary timeout hack until this is fixed properly - if ((this.mob.tickCount - this.mob.lastHurtByMobTimestamp) > 100) { - this.mob.setLastHurtByMob((LivingEntity) null); -diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/RandomStrollGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/RandomStrollGoal.java -index 216929c838446c3c14d9b9906ffa625ef35fcbc8..3ea2e7c44018ec63b8f17fd3e5e3a23e2b1f72e4 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/goal/RandomStrollGoal.java -+++ b/src/main/java/net/minecraft/world/entity/ai/goal/RandomStrollGoal.java -@@ -35,6 +35,7 @@ public class RandomStrollGoal extends Goal { - - @Override - public boolean canUse() { -+ if (this.mob.isLobotomized()) return false; // Kaiiju - if (this.mob.isVehicle()) { - return false; - } else { -@@ -68,6 +69,7 @@ public class RandomStrollGoal extends Goal { - - @Override - public boolean canContinueToUse() { -+ if (this.mob.isLobotomized()) return false; // Kaiiju - return !this.mob.getNavigation().isDone() && !this.mob.isVehicle(); - } - -diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/TemptGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/TemptGoal.java -index 79bb13c5614bab1f0749c5f8f57f762c6216c564..fdef5631fc9b5007f4d2b64c98e117bd17a7b03d 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/goal/TemptGoal.java -+++ b/src/main/java/net/minecraft/world/entity/ai/goal/TemptGoal.java -@@ -43,6 +43,7 @@ public class TemptGoal extends Goal { - - @Override - public boolean canUse() { -+ if (this.mob.isLobotomized()) return false; // Kaiiju - if (this.calmDown > 0) { - --this.calmDown; - return false; -@@ -67,6 +68,7 @@ public class TemptGoal extends Goal { - - @Override - public boolean canContinueToUse() { -+ if (this.mob.isLobotomized()) return false; // Kaiiju - if (this.canScare()) { - if (this.mob.distanceToSqr((Entity) this.player) < 36.0D) { - if (this.player.distanceToSqr(this.px, this.py, this.pz) > 0.010000000000000002D) { -diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -index bd6910c279a3a319744d3c7c889a889b892a8f76..46f3826dbb087e07ff7737ea0e80e63b06168b66 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -@@ -198,6 +198,7 @@ public abstract class PathNavigation { - // Paper end - - public boolean moveTo(Entity entity, double speed) { -+ if (this.mob.isLobotomized()) return false; // Kaiiju - // Paper start - Pathfinding optimizations - if (this.pathfindFailures > 10 && this.path == null && this.tick < this.lastFailure + 40) { // Folia - region threading - return false; -@@ -218,6 +219,7 @@ public abstract class PathNavigation { - } - - public boolean moveTo(@Nullable Path path, double speed) { -+ if (this.mob.isLobotomized()) return false; // Kaiiju - if (path == null) { - this.path = null; - return false; -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 3c4d142e982c34a23bdb5da1f51c8dcacc0532c1..67a620dd49a2cc3994da75eed88f0c5770a0cd5b 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/Animal.java -+++ b/src/main/java/net/minecraft/world/entity/animal/Animal.java -@@ -13,7 +13,6 @@ import net.minecraft.tags.BlockTags; - import net.minecraft.util.RandomSource; - import net.minecraft.world.InteractionHand; - import net.minecraft.world.InteractionResult; --import net.minecraft.world.damagesource.DamageSource; - import net.minecraft.world.entity.AgeableMob; - import net.minecraft.world.entity.EntityType; - import net.minecraft.world.entity.ExperienceOrb; -@@ -39,6 +38,7 @@ public abstract class Animal extends AgeableMob { - @Nullable - public UUID loveCause; - public ItemStack breedItem; // CraftBukkit - Add breedItem variable -+ protected dev.kaiijumc.kaiiju.entity.Lobotomized lobotomized = new dev.kaiijumc.kaiiju.entity.Lobotomized(); // Kaiiju - - protected Animal(EntityType type, Level world) { - super(type, world); -@@ -73,8 +73,32 @@ public abstract class Animal extends AgeableMob { - } - } - -+ this.lobotomized.checkLobotomized(this); // Kaiiju - } - -+ // Kaiiju start -+ @Override -+ public void travel(net.minecraft.world.phys.Vec3 vec3) { -+ if (!this.isLobotomized() || net.minecraft.server.MinecraftServer.currentTick % 100 == 0) { -+ super.travel(vec3); -+ } -+ } -+ -+ @Override -+ public boolean isCollidable(boolean ignoreClimbing) { -+ if (!this.isLobotomized() || net.minecraft.server.MinecraftServer.currentTick % 20 == 0) { -+ return super.isCollidable(ignoreClimbing); -+ } -+ return false; -+ } -+ -+ @Override -+ public boolean isLobotomized() { -+ if (!this.level.kaiijuConfig.lobotomizeAnimalEnabled) return false; -+ return this.lobotomized.isLobotomized(); -+ } -+ // Kaiiju end -+ - /* CraftBukkit start - // Function disabled as it has no special function anymore after - // setSitting is disabled. -@@ -101,6 +125,7 @@ public abstract class Animal extends AgeableMob { - if (this.loveCause != null) { - nbt.putUUID("LoveCause", this.loveCause); - } -+ nbt.putBoolean("Kaiiju.Lobotomized", this.lobotomized.isLobotomized()); // Kaiiju - - } - -@@ -114,6 +139,13 @@ public abstract class Animal extends AgeableMob { - super.readAdditionalSaveData(nbt); - this.inLove = nbt.getInt("InLove"); - this.loveCause = nbt.hasUUID("LoveCause") ? nbt.getUUID("LoveCause") : null; -+ // Kaiiju start -+ boolean isLobotomized = nbt.getBoolean("Kaiiju.Lobotomized"); -+ this.lobotomized.setLobotomized(isLobotomized); -+ if (isLobotomized) { -+ this.onGround = true; -+ } -+ // Kaiiju end - } - - public static boolean checkAnimalSpawnRules(EntityType type, LevelAccessor world, MobSpawnType spawnReason, BlockPos pos, RandomSource random) { -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 c33e5c51839c8e6ec04c1b302127d2bf0f48664c..0831dc72de3bcc940315ce11fa8db4e612f8a8b5 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/Bee.java -+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java -@@ -967,6 +967,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { - - @Override - public boolean canBeeUse() { -+ if (Bee.this.isLobotomized()) return false; // Kaiiju - return Bee.this.remainingCooldownBeforeLocatingNewHive == 0 && !Bee.this.hasHive() && Bee.this.wantsToEnterHive(); - } - -@@ -1033,6 +1034,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { - - @Override - public boolean canBeeUse() { -+ if (Bee.this.isLobotomized()) return false; // Kaiiju - return Bee.this.hivePos != null && !Bee.this.hasRestriction() && Bee.this.wantsToEnterHive() && !this.hasReachedTarget(Bee.this.hivePos) && Bee.this.level.getBlockState(Bee.this.hivePos).is(BlockTags.BEEHIVES); - } - -@@ -1149,6 +1151,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { - - @Override - public boolean canBeeUse() { -+ if (Bee.this.isLobotomized()) return false; // Kaiiju - return Bee.this.savedFlowerPos != null && !Bee.this.hasRestriction() && this.wantsToGoToKnownFlower() && Bee.this.isFlowerValid(Bee.this.savedFlowerPos) && !Bee.this.closerThan(Bee.this.savedFlowerPos, 2); - } - -@@ -1201,6 +1204,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { - - @Override - public boolean canBeeUse() { -+ if (Bee.this.isLobotomized()) return false; // Kaiiju - return Bee.this.getCropsGrownSincePollination() >= 10 ? false : (Bee.this.random.nextFloat() < 0.3F ? false : Bee.this.hasNectar() && Bee.this.isHiveValid()); - } - diff --git a/patches/server/0008-Purpur-Network-Send-Null-Entity-Packets.patch b/patches/server/0006-Purpur-Network-Send-Null-Entity-Packets.patch similarity index 100% rename from patches/server/0008-Purpur-Network-Send-Null-Entity-Packets.patch rename to patches/server/0006-Purpur-Network-Send-Null-Entity-Packets.patch diff --git a/patches/server/0009-Kaiiju-Lithium-Configuration.patch b/patches/server/0007-Kaiiju-Lithium-Configuration.patch similarity index 100% rename from patches/server/0009-Kaiiju-Lithium-Configuration.patch rename to patches/server/0007-Kaiiju-Lithium-Configuration.patch diff --git a/patches/server/0010-Lithium-Math-FastUtil.patch b/patches/server/0008-Lithium-Math-FastUtil.patch similarity index 100% rename from patches/server/0010-Lithium-Math-FastUtil.patch rename to patches/server/0008-Lithium-Math-FastUtil.patch diff --git a/patches/server/0011-Lithium-Math-SineLut.patch b/patches/server/0009-Lithium-Math-SineLut.patch similarity index 100% rename from patches/server/0011-Lithium-Math-SineLut.patch rename to patches/server/0009-Lithium-Math-SineLut.patch diff --git a/patches/server/0012-Lithium-Entity-FastRetrieval.patch b/patches/server/0010-Lithium-Entity-FastRetrieval.patch similarity index 100% rename from patches/server/0012-Lithium-Entity-FastRetrieval.patch rename to patches/server/0010-Lithium-Entity-FastRetrieval.patch