mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-20 14:08:57 +01:00
SPIGOT-6754: Temporarily restore previous behaviour for tile entities with removed blocks
By: md_5 <git@md-5.net>
This commit is contained in:
parent
188d3b23d0
commit
e9ecd12983
2 changed files with 6 additions and 1 deletions
|
@ -6,7 +6,7 @@ import org.bukkit.World;
|
||||||
import org.bukkit.block.TileState;
|
import org.bukkit.block.TileState;
|
||||||
import org.bukkit.persistence.PersistentDataContainer;
|
import org.bukkit.persistence.PersistentDataContainer;
|
||||||
|
|
||||||
public abstract class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState implements TileState {
|
public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState implements TileState {
|
||||||
|
|
||||||
private final T tileEntity;
|
private final T tileEntity;
|
||||||
private final T snapshot;
|
private final T snapshot;
|
||||||
|
|
|
@ -106,6 +106,11 @@ public final class CraftBlockStates {
|
||||||
private static final BlockStateFactory<?> DEFAULT_FACTORY = new BlockStateFactory<CraftBlockState>(CraftBlockState.class) {
|
private static final BlockStateFactory<?> DEFAULT_FACTORY = new BlockStateFactory<CraftBlockState>(CraftBlockState.class) {
|
||||||
@Override
|
@Override
|
||||||
public CraftBlockState createBlockState(World world, BlockPosition blockPosition, IBlockData blockData, TileEntity tileEntity) {
|
public CraftBlockState createBlockState(World world, BlockPosition blockPosition, IBlockData blockData, TileEntity tileEntity) {
|
||||||
|
// SPIGOT-6754: Temporarily restore previous behaviour for tile entities with removed blocks
|
||||||
|
if (tileEntity != null) {
|
||||||
|
// block with unhandled TileEntity:
|
||||||
|
return new CraftBlockEntityState<>(world, tileEntity);
|
||||||
|
}
|
||||||
Preconditions.checkState(tileEntity == null, "Unexpected BlockState for %s", CraftMagicNumbers.getMaterial(blockData.getBlock()));
|
Preconditions.checkState(tileEntity == null, "Unexpected BlockState for %s", CraftMagicNumbers.getMaterial(blockData.getBlock()));
|
||||||
return new CraftBlockState(world, blockPosition, blockData);
|
return new CraftBlockState(world, blockPosition, blockData);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue