9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2025-12-19 14:59:25 +00:00
Files
DivineMC/divinemc-server/minecraft-patches/features/0051-Catch-update-suppressors.patch
NONPLAYT 7fc5a85908 Updated Upstream (Purpur)
Upstream has released updates that appear to apply and compile correctly

Purpur Changes:
PurpurMC/Purpur@49f28912 Updated Upstream (Paper)
2025-10-14 01:27:58 +03:00

84 lines
5.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
Date: Sun, 23 Feb 2025 01:14:54 +0300
Subject: [PATCH] Catch update suppressors
diff --git a/net/minecraft/network/PacketProcessor.java b/net/minecraft/network/PacketProcessor.java
index 3e4241976fdfe65bc0aae90a9097770745c0ddf1..98b101fde04fbf5507f021bb8d8e6bed334de5b6 100644
--- a/net/minecraft/network/PacketProcessor.java
+++ b/net/minecraft/network/PacketProcessor.java
@@ -97,6 +97,10 @@ public class PacketProcessor implements AutoCloseable {
if (this.listener.shouldHandleMessage(this.packet)) {
try {
this.packet.handle(this.listener);
+ // DivineMC start - Catch update suppressors
+ } catch (org.bxteam.divinemc.util.exception.UpdateSuppressorException e) {
+ LOGGER.info(e.getMessage());
+ // DivineMC end - Catch update suppressors
} catch (Exception var3) {
if (var3 instanceof ReportedException reportedException && reportedException.getCause() instanceof OutOfMemoryError) {
throw PacketUtils.makeReportedException(var3, this.packet, this.listener);
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 1c60d0384e3f5cc9f719fdd2ca2960af407114a0..949b8129ec014c76a1558a9011633f1a6405f2d7 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -1725,6 +1725,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
serverLevel.tickTimes10s.add(this.tickCount, j);
serverLevel.tickTimes60s.add(this.tickCount, j);
// DivineMC end - MSPT Tracking for each world
+ // DivineMC start - Catch update suppressors
+ } catch (org.bxteam.divinemc.util.exception.UpdateSuppressorException e) {
+ LOGGER.info(e.getMessage());
+ // DivineMC end - Catch update suppressors
} catch (Throwable levelTickingException) {
CrashReport crashReport = CrashReport.forThrowable(levelTickingException, "Exception ticking world");
serverLevel.fillReportDetails(crashReport);
diff --git a/net/minecraft/world/level/block/ShulkerBoxBlock.java b/net/minecraft/world/level/block/ShulkerBoxBlock.java
index f3bc957110ef60ad5e4384b934b60dccea76d5a7..18a1ed31575bec6fdbeed5d394c9f90e48ea9ba4 100644
--- a/net/minecraft/world/level/block/ShulkerBoxBlock.java
+++ b/net/minecraft/world/level/block/ShulkerBoxBlock.java
@@ -183,7 +183,17 @@ public class ShulkerBoxBlock extends BaseEntityBlock {
@Override
protected int getAnalogOutputSignal(BlockState state, Level level, BlockPos pos, Direction direction) {
- return AbstractContainerMenu.getRedstoneSignalFromBlockEntity(level.getBlockEntity(pos));
+ // DivineMC start - Catch update suppressors
+ try {
+ return AbstractContainerMenu.getRedstoneSignalFromBlockEntity(level.getBlockEntity(pos));
+ } catch (ClassCastException ex) {
+ if (org.bxteam.divinemc.config.DivineConfig.FixesCategory.updateSuppressionCrashFix) {
+ throw new org.bxteam.divinemc.util.exception.UpdateSuppressorException(pos, this);
+ } else {
+ throw ex;
+ }
+ }
+ // DivineMC end - Catch update suppressors
}
public static Block getBlockByColor(@Nullable DyeColor color) {
diff --git a/net/minecraft/world/level/redstone/NeighborUpdater.java b/net/minecraft/world/level/redstone/NeighborUpdater.java
index 332b33a004ab11150cca0cc2cefc26d0286648f5..261f3fb9981342330a31d4a4f317d1c93120012d 100644
--- a/net/minecraft/world/level/redstone/NeighborUpdater.java
+++ b/net/minecraft/world/level/redstone/NeighborUpdater.java
@@ -60,9 +60,19 @@ public interface NeighborUpdater {
state.handleNeighborChanged(level, pos, neighborBlock, orientation, movedByPiston);
// Spigot start
} catch (StackOverflowError ex) {
+ // DivineMC start - Catch update suppressors
+ if (org.bxteam.divinemc.config.DivineConfig.FixesCategory.updateSuppressionCrashFix) {
+ throw new org.bxteam.divinemc.util.exception.UpdateSuppressorException(pos, neighborBlock);
+ }
+ // DivineMC end - Catch update suppressors
level.lastPhysicsProblem = pos.immutable();
// Spigot end
} catch (Throwable var9) {
+ // DivineMC start - Catch update suppressors
+ if (org.bxteam.divinemc.config.DivineConfig.FixesCategory.updateSuppressionCrashFix) {
+ throw new org.bxteam.divinemc.util.exception.UpdateSuppressorException(pos, neighborBlock);
+ }
+ // DivineMC end - Catch update suppressors
CrashReport crashReport = CrashReport.forThrowable(var9, "Exception while updating neighbours");
CrashReportCategory crashReportCategory = crashReport.addCategory("Block being updated");
crashReportCategory.setDetail(