Fabricae Ex Nihilo

Fabricae Ex Nihilo

152k Downloads

Strainers cause a lot of network congestion

quat1024 opened this issue ยท 2 comments

commented

Strainers, if they are waterlogged and ready to work, always call markDirty from tick:

BaseBlockEntity always calls markForUpdate from markDirty:

public void markDirty() {
super.markDirty();
if (this.world != null && this.world instanceof ServerWorld serverWorld) {
var chunkManager = serverWorld.getChunkManager();
if (chunkManager != null) {
chunkManager.markForUpdate(pos);

And markForUpdate causes a packet to be dispatched to nearby players, so just like that, 20 packets per second per strainer :(

It looks like barrels also sync in both branches of an if/else:

markDirty();
tickRecipe();
} else {
--tickCounter;
markDirty();

I understand that markDirty should be called because timers are being ticked down earlier in these tickers, but it should probably not result in a full sync of the entire NBT tag to clients !

I'm writing a packet logger and strainer syncs are one of the most commonly received packets across all received packets at Blanketcon. Fireblanket includes an optimization that prevents a block entity from syncing the same NBT tag twice in a row, but since these tags include the ticking-down timer, that optimization can't kick in :(

commented

Fixed in v1.0.0

commented

Yeah. Overall the sync code just lasily syncs everything (lazy as in lazy dev). It would be pretty easy to only send necessary data and only when it updates.