Prevent block entity and entity crashes

This commit is contained in:
Aikar
2016-03-01 23:52:34 -06:00
parent 6212f523fa
commit 0255317409
3 changed files with 55 additions and 15 deletions

View File

@@ -50,7 +50,21 @@
return nbttagcompound;
}
@@ -263,13 +287,19 @@
@@ -234,7 +258,12 @@
public void fillCrashReportCategory(CrashReportCategory crashReportSection) {
crashReportSection.setDetail("Name", this::getNameForReporting);
if (this.level != null) {
- CrashReportCategory.populateBlockDetails(crashReportSection, this.level, this.worldPosition, this.getBlockState());
+ // Paper start - Prevent block entity and entity crashes
+ BlockState block = this.getBlockState();
+ if (block != null) {
+ CrashReportCategory.populateBlockDetails(crashReportSection, this.level, this.worldPosition, block);
+ }
+ // Paper end - Prevent block entity and entity crashes
CrashReportCategory.populateBlockDetails(crashReportSection, this.level, this.worldPosition, this.level.getBlockState(this.worldPosition));
}
}
@@ -263,13 +292,19 @@
}
public final void applyComponents(DataComponentMap defaultComponents, DataComponentPatch components) {
@@ -72,7 +86,7 @@
@Nullable
@Override
public <T> T get(DataComponentType<T> type) {
@@ -284,9 +314,13 @@
@@ -284,9 +319,13 @@
}
});
Objects.requireNonNull(set);
@@ -87,7 +101,7 @@
}
protected void collectImplicitComponents(DataComponentMap.Builder builder) {}
@@ -321,6 +355,15 @@
@@ -321,6 +360,15 @@
}
}