9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-27 10:59:16 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0019-Remove-lambda-from-ticking-guard.patch
Dreeam f5b95a6716 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@b0da38c2 Repository details in RuntimeException for MavenLibraryResolver#addRepository (#12939)
PaperMC/Paper@1922be90 Update custom tags (#12183)
PaperMC/Paper@79cf1353 Ignore HopperInventorySearchEvent when it has no listeners (#13009)
PaperMC/Paper@ea014f7a feat: add stuckEntityPoiRetryDelay config (#12949)
PaperMC/Paper@a9e76749 Support for showNotification in PlayerRecipeDiscoverEvent (#12992)
PaperMC/Paper@5622c9dd Expose attribute sentiment (#12974)
PaperMC/Paper@42b653b1 Expose more argument types (#12665)
PaperMC/Paper@52d9a221 [ci/skip] Fix typo in Display javadoc (#13010)
PaperMC/Paper@614e9acf Improve APIs around riptide tridents (#12996)
PaperMC/Paper@51706e5a Fixed DyeItem sheep dye hunk
2025-08-25 15:52:00 -04:00

77 lines
4.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martijn Muijsers <martijnmuijsers@live.nl>
Date: Wed, 23 Nov 2022 23:13:56 +0100
Subject: [PATCH] Remove lambda from ticking guard
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
Gale - https://galemc.org
Remove lambda for clear stacktrace and better for JIT
This patch is based on the following patch:
"Remove lambda from ticking guard"
By: Paul Sauve <paul@technove.co>
As part of: Airplane (https://github.com/TECHNOVE/Airplane)
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
* Airplane copyright *
Airplane
Copyright (C) 2020 Technove LLC
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index 6bc70c1d53049a1f75268ab9944bfb1557ca74ee..a9c2f419200483673f6743ed94af110a8e875e71 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -788,7 +788,19 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
entity.stopRiding();
}
- this.guardEntityTick(this::tickNonPassenger, entity);
+ // Gale start - Airplane - remove lambda from ticking guard - copied from guardEntityTick
+ try {
+ this.tickNonPassenger(entity); // Gale - Airplane - remove lambda from ticking guard - changed
+ } catch (Throwable var6) {
+ // Paper start - Prevent block entity and entity crashes
+ final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level().getWorld().getName(), entity.getX(), entity.getY(), entity.getZ());
+ MinecraftServer.LOGGER.error(msg, var6);
+ getCraftServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerInternalException(msg, var6))); // Paper - ServerExceptionEvent
+ entity.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD);
+ // Paper end - Prevent block entity and entity crashes
+ }
+ this.moonrise$midTickTasks(); // Paper - rewrite chunk system
+ // Gale end - Airplane - remove lambda from ticking guard - copied from guardEntityTick
}
}
}
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
index a4c915c8fdd167bfa2c5ef20c5ec7acc53c89726..a0254e85fccebb66ce02bd58f9d461addd8ad73d 100644
--- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java
@@ -1489,10 +1489,10 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level().getWorld().getName(), entity.getX(), entity.getY(), entity.getZ());
MinecraftServer.LOGGER.error(msg, var6);
getCraftServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerInternalException(msg, var6))); // Paper - ServerExceptionEvent
- entity.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD);
+ entity.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD); // Gale - Airplane - remove lambda from ticking guard - diff on change ServerLevel#tick
// Paper end - Prevent block entity and entity crashes
}
- this.moonrise$midTickTasks(); // Paper - rewrite chunk system
+ this.moonrise$midTickTasks(); // Paper - rewrite chunk system // Gale - Airplane - remove lambda from ticking guard - diff on change ServerLevel#tick
}
// Paper start - Option to prevent armor stands from doing entity lookups