2020-05-06 11:48:49 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2014-12-22 22:13:29 +01:00
|
|
|
From: Aikar <aikar@aikar.co>
|
2016-03-01 00:09:49 +01:00
|
|
|
Date: Tue, 1 Mar 2016 23:52:34 -0600
|
2014-12-22 22:13:29 +01:00
|
|
|
Subject: [PATCH] Prevent tile entity and entity crashes
|
|
|
|
|
|
|
|
|
2021-03-16 08:19:45 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
|
|
|
|
index 62735e7908f86e31f7a89ce2071ddebe176c0385..87e37c38825ad20fc11f41ea2a4512753266d2b4 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/World.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/World.java
|
|
|
|
@@ -737,11 +737,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
2019-05-14 04:20:58 +02:00
|
|
|
|
2019-04-24 04:34:11 +02:00
|
|
|
gameprofilerfiller.exit();
|
|
|
|
} catch (Throwable throwable) {
|
|
|
|
- CrashReport crashreport = CrashReport.a(throwable, "Ticking block entity");
|
|
|
|
- CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Block entity being ticked");
|
|
|
|
-
|
|
|
|
- tileentity.a(crashreportsystemdetails);
|
|
|
|
- throw new ReportedException(crashreport);
|
2016-03-01 00:09:49 +01:00
|
|
|
+ // Paper start - Prevent tile entity and entity crashes
|
2014-12-22 22:13:29 +01:00
|
|
|
+ System.err.println("TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ());
|
2019-04-24 04:34:11 +02:00
|
|
|
+ throwable.printStackTrace();
|
2015-09-19 16:34:17 +02:00
|
|
|
+ tilesThisCycle--;
|
2016-03-01 00:09:49 +01:00
|
|
|
+ this.tileEntityListTick.remove(tileTickPosition--);
|
2014-12-22 22:13:29 +01:00
|
|
|
+ continue;
|
2016-03-01 00:09:49 +01:00
|
|
|
+ // Paper end
|
2021-02-21 21:55:01 +01:00
|
|
|
// Spigot start
|
|
|
|
} finally {
|
|
|
|
tileentity.tickTimer.stopTiming();
|
2021-03-16 08:19:45 +01:00
|
|
|
@@ -806,11 +808,12 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
2019-07-08 04:54:40 +02:00
|
|
|
try {
|
2019-04-24 04:34:11 +02:00
|
|
|
consumer.accept(entity);
|
|
|
|
} catch (Throwable throwable) {
|
|
|
|
- CrashReport crashreport = CrashReport.a(throwable, "Ticking entity");
|
|
|
|
- CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being ticked");
|
|
|
|
-
|
|
|
|
- entity.appendEntityCrashDetails(crashreportsystemdetails);
|
|
|
|
- throw new ReportedException(crashreport);
|
|
|
|
+ // Paper start - Prevent tile entity and entity crashes
|
2019-12-11 03:43:21 +01:00
|
|
|
+ System.err.println("Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX() + "," + entity.locY() + "," + entity.locZ());
|
2019-04-24 04:34:11 +02:00
|
|
|
+ throwable.printStackTrace();
|
|
|
|
+ entity.dead = true;
|
|
|
|
+ return;
|
|
|
|
+ // Paper end
|
2019-07-08 04:54:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-16 08:19:45 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
|
|
|
|
index da39fcb22d7656eedb8bf7d0774f50018b9fb02b..b1c220df7e00af79b548895cc9333ba85d5a447f 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
|
|
|
|
@@ -207,7 +207,12 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { /
|
|
|
|
return IRegistry.BLOCK_ENTITY_TYPE.getKey(this.getTileType()) + " // " + this.getClass().getCanonicalName();
|
|
|
|
});
|
|
|
|
if (this.world != null) {
|
|
|
|
- CrashReportSystemDetails.a(crashreportsystemdetails, this.position, this.getBlock());
|
|
|
|
+ // Paper start - Prevent TileEntity and Entity crashes
|
|
|
|
+ IBlockData block = this.getBlock();
|
|
|
|
+ if (block != null) {
|
|
|
|
+ CrashReportSystemDetails.a(crashreportsystemdetails, this.position, block);
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
CrashReportSystemDetails.a(crashreportsystemdetails, this.position, this.world.getType(this.position));
|
|
|
|
}
|
|
|
|
}
|