Skip to content

Commit

Permalink
Fix tick issue and two mc-old features (#239)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lumine1909 authored Jun 26, 2024
1 parent 5a03bd3 commit 65deeff
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 26 deletions.
23 changes: 8 additions & 15 deletions patches/server/0006-Leaves-Server-Config-And-Command.patch
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,6 @@ index 5025c5df3ee6ed84106782e3f9228874bebe63ca..268193499b9f1fae0c01963e8004a3e7
tasks.registerRunTask("runBundler") {
description = "Spin up a test server from the Mojang mapped bundler jar"
classpath(rootProject.tasks.named<io.papermc.paperweight.tasks.CreateBundlerJar>("createMojmapBundlerJar").flatMap { it.outputZip })
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 41ed8d64963616fc97d382b6cd0b9cc154fd84c6..1b8f7ff3b0ccef6ce3ac99eecf98622fb13f9269 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1168,6 +1168,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
LOGGER.info("Done ({})! For help, type \"help\"", doneTime);
// Paper end

+ org.leavesmc.leaves.LeavesConfig.createWorldSections = false; // Leaves - dont let plugin create worlds fill our config
org.spigotmc.WatchdogThread.tick(); // Paper
org.spigotmc.WatchdogThread.hasStarted = true; // Paper
Arrays.fill( this.recentTps, 20 );
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 29d61b407762504dffc26f3048a17327592d9b4a..ec9ade19778c71561b4045ade5ab6cd090768547 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
Expand Down Expand Up @@ -97,10 +85,10 @@ index 459f47244bdfeab63b5f16d780b0291d36310de8..a872421bc3e67fdcc929f104f4b085fb
.withRequiredArg()
diff --git a/src/main/java/org/leavesmc/leaves/LeavesConfig.java b/src/main/java/org/leavesmc/leaves/LeavesConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..2a7f9d9fdb72786b08b3cb216f5aa5e5eac3c967
index 0000000000000000000000000000000000000000..9e82ab6e85288a7fb32a86478fe91a142225bdd0
--- /dev/null
+++ b/src/main/java/org/leavesmc/leaves/LeavesConfig.java
@@ -0,0 +1,922 @@
@@ -0,0 +1,927 @@
+package org.leavesmc.leaves;
+
+import com.destroystokyo.paper.util.SneakyThrow;
Expand Down Expand Up @@ -138,7 +126,6 @@ index 0000000000000000000000000000000000000000..2a7f9d9fdb72786b08b3cb216f5aa5e5
+ private static File configFile;
+ public static YamlConfiguration config;
+ private static int configVersion;
+ public static boolean createWorldSections = true;
+
+ public static void init(final File file) {
+ LeavesConfig.configFile = file;
Expand Down Expand Up @@ -370,6 +357,12 @@ index 0000000000000000000000000000000000000000..2a7f9d9fdb72786b08b3cb216f5aa5e5
+ @GlobalConfig(name = "protection-stacking", category = {"modify", "minecraft-old"})
+ public static boolean protectionStacking = false;
+
+ @GlobalConfig(name = "allow-grindstone-overstacking", category = {"modify", "minecraft-old"})
+ public static boolean allowGrindstoneOverstacking = false;
+
+ @GlobalConfig(name = "allow-entity-portal-with-passenger", category = {"modify", "minecraft-old"})
+ public static boolean allowEntityPortalWithPassenger = true;
+
+ // Leaves end - modify - minecraft-old
+
+ // Leaves start - modify - elytra-aeronautics
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0007-Leaves-Protocol-Core.patch
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ index 1967c43ee3a12e63365cc40ee6565307e2fd73cf..6e376d0db5321d8e9b6e0b54617ffd17

assert isValidPath(path);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 1b8f7ff3b0ccef6ce3ac99eecf98622fb13f9269..307c5a0b4b7c68fe2c7d1cf77ff23c766335882d 100644
index 41ed8d64963616fc97d382b6cd0b9cc154fd84c6..2d60beb706f99e0c570caf37ccc777e69c672ef2 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1736,6 +1736,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1735,6 +1735,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

this.profiler.popPush("server gui refresh");

Expand Down
4 changes: 2 additions & 2 deletions patches/server/0024-Config-to-disable-method-profiler.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ Subject: [PATCH] Config to disable method profiler
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)

diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 803d0b817e5d0acb1e4c6601d4784cc5cbd5e612..bef6e9e9871d6ab7ad1fbb72d1735cc411b9cc93 100644
index 2b29dacb541468d4f6410402c2e4eb1a57b80e2a..c35d6ed30fee7a684d1b68ec179eee6aa5a0b33d 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2484,6 +2484,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2483,6 +2483,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}

public ProfilerFiller getProfiler() {
Expand Down
7 changes: 4 additions & 3 deletions patches/server/0050-Fix-update-suppression-crash.patch
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,24 @@ index f7197f1347251a37dd0f6d9ffa2f09bc3a4e1233..8909f4f65864935f86608b0e00149c57
if (exception instanceof ReportedException) {
ReportedException reportedexception = (ReportedException) exception;
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 25e4fd107eefdd3c1420d6a1af541de9b6aa8b2c..7b6df49f1eb9e05a512d582db9ea49316f53314a 100644
index 139255c1528cb7164f4a814812c49a4c0855992a..d225b9d5853422397f7a7ecb4705de1386e3edab 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1715,6 +1715,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1714,7 +1714,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.profiler.push("tick");

try {
- worldserver.tick(shouldKeepTicking);
+ // Leaves start
+ try {
+ worldserver.tick(shouldKeepTicking);
+ } catch (org.leavesmc.leaves.util.UpdateSuppressionException e) {
+ org.leavesmc.leaves.LeavesLogger.LOGGER.info(e.getMessage());
+ }
+ // Leaves end
worldserver.tick(shouldKeepTicking);
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Exception ticking world");

diff --git a/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java b/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java
index 40518b1a58494525223e47845b4cb57c92a22d5e..4a0617f7b5f528421620ad504467212b7042716f 100644
--- a/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0051-Bedrock-break-list.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Bedrock break list


diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 7b6df49f1eb9e05a512d582db9ea49316f53314a..6dbc31ef1e5b8716e200a64835cf12f9c8232d25 100644
index d225b9d5853422397f7a7ecb4705de1386e3edab..e4298f95cde4b6297ceb789cd59db599cdd0b653 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1748,6 +1748,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1746,6 +1746,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handleTick(); // Leaves - protocol

Expand Down
4 changes: 2 additions & 2 deletions patches/server/0097-Replay-Mod-API.patch
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ index c8d39e6e1c570c9219f6066da273dc0130920519..96a074281d16a7f64058619da4b102f3
if (((List) object).size() >= i) {
return (List) object;
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 6dbc31ef1e5b8716e200a64835cf12f9c8232d25..6a5650024b8d6aca49aa98d69af68195d6d43bb0 100644
index e4298f95cde4b6297ceb789cd59db599cdd0b653..a2a88f4d547bba8dc20a9216d1942f609faa00e0 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1619,7 +1619,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1618,7 +1618,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}

private ServerStatus.Players buildPlayerStatus() {
Expand Down
28 changes: 28 additions & 0 deletions patches/server/0126-Allow-grindstone-overstacking.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Lumine1909 <133463833+Lumine1909@users.noreply.github.com>
Date: Wed, 26 Jun 2024 17:59:56 +0800
Subject: [PATCH] Allow grindstone overstacking


diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
index 1678f6c8b2c7db761783e53043169bf12bc2cb29..13cfda7c065e0332133a1e1b60b454ae44e87d35 100644
--- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
@@ -202,7 +202,7 @@ public class GrindstoneMenu extends AbstractContainerMenu {
byte b0 = 1;

if (!firstInput.isDamageableItem()) {
- if (firstInput.getMaxStackSize() < 2 || !ItemStack.matches(firstInput, secondInput)) {
+ if (!org.leavesmc.leaves.LeavesConfig.allowGrindstoneOverstacking && firstInput.getMaxStackSize() < 2 || !ItemStack.matches(firstInput, secondInput)) { // Leaves - allowGrindstoneOverstaking
return ItemStack.EMPTY;
}

@@ -286,7 +286,7 @@ public class GrindstoneMenu extends AbstractContainerMenu {
ItemStack itemstack3 = this.repairSlots.getItem(1);

if (slot == 2) {
- if (!this.moveItemStackTo(itemstack1, 3, 39, true)) {
+ if (!this.moveItemStackTo(itemstack1, 3, 39, true, org.leavesmc.leaves.LeavesConfig.allowGrindstoneOverstacking)) { // Leaves - allowGrindstoneOverstacking: Disable stack check
return ItemStack.EMPTY;
}

19 changes: 19 additions & 0 deletions patches/server/0127-Configurable-MC-67.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Lumine1909 <133463833+Lumine1909@users.noreply.github.com>
Date: Wed, 26 Jun 2024 18:15:57 +0800
Subject: [PATCH] Configurable MC-67


diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index b450c19fbb6cc7266db4ddc4bc86546ca2054d5a..64356adabfab88e76a1df9c1ff4d9112e61e8b09 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3753,7 +3753,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}

public boolean canChangeDimensions(Level from, Level to) {
- return this.isAlive() && this.valid; // Paper - Fix item duplication and teleport issues
+ return !(!org.leavesmc.leaves.LeavesConfig.allowEntityPortalWithPassenger && (this.isPassenger() || this.isVehicle())) && this.isAlive() && this.valid; // Paper - Fix item duplication and teleport issues // Leaves - allowEntityPortalWithPassenger
}

public float getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState, float max) {

0 comments on commit 65deeff

Please sign in to comment.