improve client performance and fix chunk light concurrency
This commit is contained in:
parent
46c95630f3
commit
ca97bf2e18
10 changed files with 44 additions and 208 deletions
|
@ -250,7 +250,7 @@ public class BlockChest extends Block implements ITileEntityProvider, Rotatable
|
|||
TileEntity te = world.getTileEntity(pos);
|
||||
if(te instanceof TileEntityChest chest)
|
||||
return state.withProperty(OPEN, chest.numPlayersUsing > 0);
|
||||
return state;
|
||||
return state.withProperty(OPEN, false);
|
||||
}
|
||||
|
||||
public boolean isXrayVisible()
|
||||
|
|
|
@ -13,12 +13,6 @@ import common.world.State;
|
|||
import common.world.World;
|
||||
|
||||
public abstract class TileEntity {
|
||||
public static enum CreateMode {
|
||||
IMMEDIATE,
|
||||
QUEUED,
|
||||
CHECK;
|
||||
}
|
||||
|
||||
protected World world;
|
||||
protected LocalPos pos = LocalPos.ORIGIN;
|
||||
private boolean invalid;
|
||||
|
|
|
@ -220,7 +220,7 @@ public abstract class Chunk {
|
|||
}
|
||||
|
||||
if(oldb instanceof ITileEntityProvider) {
|
||||
TileEntity tile = this.getTileEntity(pos, TileEntity.CreateMode.CHECK);
|
||||
TileEntity tile = this.getTileEntity(pos, false);
|
||||
|
||||
if(tile != null) {
|
||||
tile.resetBlock();
|
||||
|
@ -232,7 +232,7 @@ public abstract class Chunk {
|
|||
}
|
||||
|
||||
if(block instanceof ITileEntityProvider) {
|
||||
TileEntity tile = this.getTileEntity(pos, TileEntity.CreateMode.CHECK);
|
||||
TileEntity tile = this.getTileEntity(pos, false);
|
||||
|
||||
if(tile == null) {
|
||||
tile = ((ITileEntityProvider)block).createNewTileEntity();
|
||||
|
@ -297,11 +297,11 @@ public abstract class Chunk {
|
|||
return !(block instanceof ITileEntityProvider provider) ? null : provider.createNewTileEntity();
|
||||
}
|
||||
|
||||
public TileEntity getTileEntity(LocalPos pos, TileEntity.CreateMode type) {
|
||||
public TileEntity getTileEntity(LocalPos pos, boolean create) {
|
||||
TileEntity tile = this.tiles.get(pos);
|
||||
|
||||
if(tile == null) {
|
||||
if(type == TileEntity.CreateMode.IMMEDIATE) {
|
||||
if(create) {
|
||||
tile = this.createNewTileEntity(pos);
|
||||
this.world.setTileEntity(pos, tile);
|
||||
}
|
||||
|
|
|
@ -1087,7 +1087,7 @@ public abstract class World implements IWorldAccess {
|
|||
}
|
||||
|
||||
if(tileentity == null) {
|
||||
tileentity = this.getChunk(pos).getTileEntity(pos, TileEntity.CreateMode.IMMEDIATE);
|
||||
tileentity = this.getChunk(pos).getTileEntity(pos, true);
|
||||
}
|
||||
|
||||
if(tileentity == null) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue