13
0
geforkt von Mirrors/Paper

SPIGOT-5482: Structure Block setUsageMode encounters NullpointerException

Dieser Commit ist enthalten in:
md_5 2019-12-25 10:09:20 +11:00
Ursprung 82322fe06c
Commit edcb0a4b6a
2 geänderte Dateien mit 20 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,11 @@
--- a/net/minecraft/server/TileEntityStructure.java
+++ b/net/minecraft/server/TileEntityStructure.java
@@ -18,7 +18,7 @@
public BlockPosition size;
public EnumBlockMirror mirror;
public EnumBlockRotation rotation;
- private BlockPropertyStructureMode usageMode;
+ public BlockPropertyStructureMode usageMode;
public boolean ignoreEntities;
private boolean powered;
public boolean showAir;

Datei anzeigen

@ -105,7 +105,7 @@ public class CraftStructureBlock extends CraftBlockEntityState<TileEntityStructu
@Override
public void setUsageMode(UsageMode mode) {
getSnapshot().setUsageMode(BlockPropertyStructureMode.valueOf(mode.name()));
getSnapshot().usageMode = BlockPropertyStructureMode.valueOf(mode.name());
}
@Override
@ -177,6 +177,14 @@ public class CraftStructureBlock extends CraftBlockEntityState<TileEntityStructu
return getSnapshot().metadata;
}
@Override
protected void applyTo(TileEntityStructure tileEntity) {
super.applyTo(tileEntity);
// Ensure block type is correct
tileEntity.setUsageMode(tileEntity.getUsageMode());
}
private static boolean isBetween(int num, int min, int max) {
return num >= min && num <= max;
}