mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-22 08:57:35 +01:00
SPIGOT-5472: Spurious warning when using clone command on tile entities
This commit is contained in:
parent
85106731bf
commit
75fac431cf
@ -334,15 +334,21 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -604,6 +816,7 @@
|
||||
}
|
||||
}
|
||||
@@ -606,12 +818,26 @@
|
||||
|
||||
+ public Map<BlockPosition, TileEntity> capturedTileEntities = Maps.newHashMap();
|
||||
@Nullable
|
||||
@Override
|
||||
+ // CraftBukkit start
|
||||
public TileEntity getTileEntity(BlockPosition blockposition) {
|
||||
@@ -612,6 +825,12 @@
|
||||
+ return getTileEntity(blockposition, true);
|
||||
+ }
|
||||
+ public Map<BlockPosition, TileEntity> capturedTileEntities = Maps.newHashMap();
|
||||
+
|
||||
+ @Nullable
|
||||
+ protected TileEntity getTileEntity(BlockPosition blockposition, boolean validate) {
|
||||
+ // CraftBukkit end
|
||||
if (isOutsideWorld(blockposition)) {
|
||||
return null;
|
||||
} else if (!this.isClientSide && Thread.currentThread() != this.serverThread) {
|
||||
return null;
|
||||
} else {
|
||||
@ -355,7 +361,7 @@
|
||||
TileEntity tileentity = null;
|
||||
|
||||
if (this.tickingTileEntities) {
|
||||
@@ -646,6 +865,13 @@
|
||||
@@ -646,6 +872,13 @@
|
||||
public void setTileEntity(BlockPosition blockposition, @Nullable TileEntity tileentity) {
|
||||
if (!isOutsideWorld(blockposition)) {
|
||||
if (tileentity != null && !tileentity.isRemoved()) {
|
||||
@ -369,3 +375,12 @@
|
||||
if (this.tickingTileEntities) {
|
||||
tileentity.setLocation(this, blockposition);
|
||||
Iterator iterator = this.tileEntityListPending.iterator();
|
||||
@@ -670,7 +903,7 @@
|
||||
}
|
||||
|
||||
public void removeTileEntity(BlockPosition blockposition) {
|
||||
- TileEntity tileentity = this.getTileEntity(blockposition);
|
||||
+ TileEntity tileentity = this.getTileEntity(blockposition, false); // CraftBukkit
|
||||
|
||||
if (tileentity != null && this.tickingTileEntities) {
|
||||
tileentity.ab_();
|
||||
|
@ -62,9 +62,9 @@
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ @Override
|
||||
+ public TileEntity getTileEntity(BlockPosition pos) {
|
||||
+ TileEntity result = super.getTileEntity(pos);
|
||||
+ if (Thread.currentThread() != this.serverThread) {
|
||||
+ protected TileEntity getTileEntity(BlockPosition pos, boolean validate) {
|
||||
+ TileEntity result = super.getTileEntity(pos, validate);
|
||||
+ if (!validate || Thread.currentThread() != this.serverThread) {
|
||||
+ // SPIGOT-5378: avoid deadlock, this can be called in loading logic (i.e lighting) but getType() will block on chunk load
|
||||
+ return result;
|
||||
+ }
|
||||
|
Loading…
Reference in New Issue
Block a user