mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-13 06:07:40 +01:00
SPIGOT-5482: Structure Block setUsageMode encounters NullpointerException
This commit is contained in:
parent
82322fe06c
commit
edcb0a4b6a
11
nms-patches/TileEntityStructure.patch
Normal file
11
nms-patches/TileEntityStructure.patch
Normal file
@ -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;
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user