Some Stuff to Fix Bugs

-Improved debug info of Fallingblock ticking
-Fixed unsynchronized access as per OLEGSHA
-Maybe better server side deletion of blocks
This commit is contained in:
opfromthestart 2021-08-03 14:44:52 -04:00
parent e58007ea11
commit c2a2cc074a
2 changed files with 8 additions and 5 deletions

View File

@ -110,11 +110,11 @@ public class LayerWorld extends Layer {
tmp_testControls.applyPlayerControls();
for (EntityData data : this.client.getWorld().getData().getEntities()) {
this.client.getWorld().getData().getEntities().forEach(data -> {
tmp_applyFriction(data, tickLength);
tmp_applyGravity(data, tickLength);
tmp_renderCollisionModel(data);
}
});
} catch (Throwable e) {
e.printStackTrace();
System.err.println("OLEGSHA is to blame. Tell him he vry stupiDD!!");

View File

@ -10,6 +10,7 @@ import glm.vec._3.i.Vec3i;
import ru.windcorp.progressia.client.ClientState;
import ru.windcorp.progressia.common.world.block.BlockDataRegistry;
import ru.windcorp.progressia.common.world.entity.EntityData;
import ru.windcorp.progressia.server.Server;
import ru.windcorp.progressia.server.world.TickContext;
import ru.windcorp.progressia.server.world.entity.EntityLogic;
@ -105,12 +106,14 @@ public class TestEntityLogicFallingBlock extends EntityLogic {
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) + " " + String.valueOf(occupiedBlock.y) + " " + String.valueOf(occupiedBlock.z));
// ClientState.getInstance().getWorld().getData().setBlock(occupiedBlock,
// fallBlock.getBlock(),true);
context.getAccessor().setBlock(occupiedBlock, fallBlock.getBlock());
fallBlock.setInvisible(); // Until I know how to properly delete it.
ClientState.getInstance().getWorld().getData().removeEntity(entity.getEntityId());// context.getWorldData().removeEntity(entity.getEntityId());
//ClientState.getInstance().getWorld().getData().removeEntity(entity.getEntityId());// context.getWorldData().removeEntity(entity.getEntityId());
Server server = context.getServer();
server.invokeLater(() -> server.getWorld().getData().removeEntity(entity.getEntityId()));
}
}
}