mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-19 14:59:25 +00:00
84 lines
5.1 KiB
Diff
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 e3c7065cd4832e0c533f70d444c0a7beff53e423..d73546a9f086f67bafb3ce3a2a8ed5c227abc355 100644
|
|
--- a/net/minecraft/server/MinecraftServer.java
|
|
+++ b/net/minecraft/server/MinecraftServer.java
|
|
@@ -1744,6 +1744,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 e08083fbb6c3090c9a6f78dbbe487cbd4fec485a..d5d77110e7799223a66c2d6e47a1d9b4653f3ec4 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 f45cf0136e77ed5a903d033a7b0611e5edc23db9..e5b0cc92a2f9cdb89cd2436f6591531f8ae91d28 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(
|