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/0056-Catch-update-suppressors.patch
2025-10-11 16:20:06 +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 ae0eb872f59be23126a7d44056607058c81a0e81..e76530da9641acc482aa0f030c4dc2670b1f7b14 100644
--- a/net/minecraft/network/PacketProcessor.java
+++ b/net/minecraft/network/PacketProcessor.java
@@ -77,6 +77,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 88296555274b67dc504c4765bc9bf049545ca19a..3ea69f961797e390aabb697ad9a7f007e549d04d 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -1723,6 +1723,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(