mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-10 18:27:41 +01:00
SPIGOT-5482: Structure Block setUsageMode encounters NullpointerException
By: md_5 <git@md-5.net>
This commit is contained in:
parent
886b2f0508
commit
03662947f3
11
paper-server/nms-patches/TileEntityStructure.patch
Normal file
11
paper-server/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
|
@Override
|
||||||
public void setUsageMode(UsageMode mode) {
|
public void setUsageMode(UsageMode mode) {
|
||||||
getSnapshot().setUsageMode(BlockPropertyStructureMode.valueOf(mode.name()));
|
getSnapshot().usageMode = BlockPropertyStructureMode.valueOf(mode.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -177,6 +177,14 @@ public class CraftStructureBlock extends CraftBlockEntityState<TileEntityStructu
|
|||||||
return getSnapshot().metadata;
|
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) {
|
private static boolean isBetween(int num, int min, int max) {
|
||||||
return num >= min && num <= max;
|
return num >= min && num <= max;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user