Bug Fixing and Performance
-Multiple null checks(It doesn't work without them) -Checks to make sure entities are within loaded chunks -Actual entity removal
This commit is contained in:
parent
3879e5ffac
commit
ae2980c9de
@ -53,8 +53,8 @@ public class TestEntityLogicFallingBlock extends EntityLogic {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// LogManager.getLogger().info("NotNull "+entity.toString() + " " +
|
//LogManager.getLogger().info("NotNull "+entity.toString()+" "+String.valueOf(entity!=null) + " " +
|
||||||
// context.toString());
|
//context.toString());
|
||||||
super.tick(entity, context);
|
super.tick(entity, context);
|
||||||
|
|
||||||
// friction
|
// friction
|
||||||
@ -67,6 +67,12 @@ public class TestEntityLogicFallingBlock extends EntityLogic {
|
|||||||
.getData().getEntity(entity.getEntityId()); // ClientState.getInstance().getWorld().getData().getEntity(entity.getEntityId());
|
.getData().getEntity(entity.getEntityId()); // ClientState.getInstance().getWorld().getData().getEntity(entity.getEntityId());
|
||||||
// fallBlock = (TestEntityDataFallingBlock) entity;
|
// fallBlock = (TestEntityDataFallingBlock) entity;
|
||||||
|
|
||||||
|
//LogManager.getLogger().info("NotNull FB "+String.valueOf(fallBlock!=null));
|
||||||
|
if (fallBlock==null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (fallBlock.isDone() || !context.getWorld().isBlockLoaded(fallBlock.getBlockInWorld(null))) {
|
if (fallBlock.isDone() || !context.getWorld().isBlockLoaded(fallBlock.getBlockInWorld(null))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -96,13 +102,13 @@ public class TestEntityLogicFallingBlock extends EntityLogic {
|
|||||||
// LogManager.getLogger().info("Block is of type " +
|
// LogManager.getLogger().info("Block is of type " +
|
||||||
// context.getWorldData().getChunk(chunkCoords).getBlock(inChunkCoords).getId());
|
// context.getWorldData().getChunk(chunkCoords).getBlock(inChunkCoords).getId());
|
||||||
|
|
||||||
if (context.getWorldData().getChunk(chunkCoords).getBlock(inChunkCoords).getId() != "Test:Air") {
|
if (context.getWorldData().isBlockLoaded(occupiedBlock) && context.getWorldData().getChunk(chunkCoords).getBlock(inChunkCoords).getId() != "Test:Air") {
|
||||||
LogManager.getLogger().info("Deleting FallingBlock at " + String.valueOf(occupiedBlock.x));
|
LogManager.getLogger().info("Deleting FallingBlock at " + String.valueOf(occupiedBlock.x));
|
||||||
// ClientState.getInstance().getWorld().getData().setBlock(occupiedBlock,
|
// ClientState.getInstance().getWorld().getData().setBlock(occupiedBlock,
|
||||||
// fallBlock.getBlock(),true);
|
// fallBlock.getBlock(),true);
|
||||||
context.getAccessor().setBlock(occupiedBlock, fallBlock.getBlock());
|
context.getAccessor().setBlock(occupiedBlock, fallBlock.getBlock());
|
||||||
fallBlock.setInvisible(); // Until I know how to properly delete it.
|
fallBlock.setInvisible(); // Until I know how to properly delete it.
|
||||||
// context.getWorldData().removeEntity(entity.getEntityId());
|
ClientState.getInstance().getWorld().getData().removeEntity(entity.getEntityId());//context.getWorldData().removeEntity(entity.getEntityId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user