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:
parent
e58007ea11
commit
c2a2cc074a
@ -110,11 +110,11 @@ public class LayerWorld extends Layer {
|
|||||||
|
|
||||||
tmp_testControls.applyPlayerControls();
|
tmp_testControls.applyPlayerControls();
|
||||||
|
|
||||||
for (EntityData data : this.client.getWorld().getData().getEntities()) {
|
this.client.getWorld().getData().getEntities().forEach(data -> {
|
||||||
tmp_applyFriction(data, tickLength);
|
tmp_applyFriction(data, tickLength);
|
||||||
tmp_applyGravity(data, tickLength);
|
tmp_applyGravity(data, tickLength);
|
||||||
tmp_renderCollisionModel(data);
|
tmp_renderCollisionModel(data);
|
||||||
}
|
});
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.err.println("OLEGSHA is to blame. Tell him he vry stupiDD!!");
|
System.err.println("OLEGSHA is to blame. Tell him he vry stupiDD!!");
|
||||||
|
@ -10,6 +10,7 @@ import glm.vec._3.i.Vec3i;
|
|||||||
import ru.windcorp.progressia.client.ClientState;
|
import ru.windcorp.progressia.client.ClientState;
|
||||||
import ru.windcorp.progressia.common.world.block.BlockDataRegistry;
|
import ru.windcorp.progressia.common.world.block.BlockDataRegistry;
|
||||||
import ru.windcorp.progressia.common.world.entity.EntityData;
|
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.TickContext;
|
||||||
import ru.windcorp.progressia.server.world.entity.EntityLogic;
|
import ru.windcorp.progressia.server.world.entity.EntityLogic;
|
||||||
|
|
||||||
@ -57,7 +58,7 @@ public class TestEntityLogicFallingBlock extends EntityLogic {
|
|||||||
// "+String.valueOf(entity!=null) + " " +
|
// "+String.valueOf(entity!=null) + " " +
|
||||||
// context.toString());
|
// context.toString());
|
||||||
super.tick(entity, context);
|
super.tick(entity, context);
|
||||||
|
|
||||||
// friction
|
// friction
|
||||||
Vec3 vel = entity.getVelocity();
|
Vec3 vel = entity.getVelocity();
|
||||||
float friction = 0f;
|
float friction = 0f;
|
||||||
@ -105,12 +106,14 @@ public class TestEntityLogicFallingBlock extends EntityLogic {
|
|||||||
|
|
||||||
if (context.getWorldData().isBlockLoaded(occupiedBlock)
|
if (context.getWorldData().isBlockLoaded(occupiedBlock)
|
||||||
&& context.getWorldData().getChunk(chunkCoords).getBlock(inChunkCoords).getId() != "Test:Air") {
|
&& 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,
|
// 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.
|
||||||
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()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user