Ported rule updateSuppressionCrashFix from Carpet-Extra + More (#1133)
* Posted rule `updateSuppressionCrashFix` from Carpet-Extra Also added catch for update suppression in neighbour update during ServerPlayerEntity tick. Added Logger `updateSuppressedCrashes` so not everyone sees the crash messages Added Coords to crash message so we now know where it originates from * Make it easier to read * that `s` has been there for a long time * Made `updateSuppressionCrashFix` compatible with carpet-extra
This commit is contained in:
1 parent
506457d878
commit
0714098347
7 files changed
+169
-4
No files matched your search
@@ -0,0 +1,32 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import carpet.helpers.ThrowableSuppression;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
|
||||
@Mixin(World.class)
|
||||
public class World_updateSuppressionCrashFixMixin {
|
||||
|
||||
@Inject(
|
||||
method = "updateNeighbor",
|
||||
at = @At(
|
||||
value="INVOKE",
|
||||
target = "Lnet/minecraft/util/crash/CrashReport;create(Ljava/lang/Throwable;Ljava/lang/String;)Lnet/minecraft/util/crash/CrashReport;"
|
||||
),
|
||||
locals = LocalCapture.CAPTURE_FAILHARD,
|
||||
require = 0
|
||||
)
|
||||
public void checkUpdateSuppression(BlockPos sourcePos, Block sourceBlock, BlockPos neighborPos, CallbackInfo ci, BlockState state,Throwable throwable){
|
||||
if(CarpetSettings.updateSuppressionCrashFix && (throwable instanceof ThrowableSuppression || throwable instanceof StackOverflowError)){
|
||||
throw new ThrowableSuppression("Update suppression",neighborPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user