Botania (Fabric/Quilt)

Botania (Fabric/Quilt)

5M Downloads

Tangleberrie/Jiyuulia Chunk Update causing lag

Meth962 opened this issue ยท 6 comments

commented

The tangleberrie and jiyuulia flowers are coded to drain mana 5 times a second even if they're not doing anything. This causes a dispatch of TileEntityToPlayers updates which shows about 15 chunk updates per flower in MC's debug menu. I have two jiyuulia flowers (30 chunk updates) and this is causing fps to drop by 90 for friends on my server.

Can this be refactored or possibly redesigned so mana only drains when it is actually functioning like all the other flowers?

commented

I just went and rechecked, and the updates it sends every 5 ticks should not be causing chunk updates. It's something else.

commented

Try to reproduce in a void world (superflat preset) with nothing but botania

commented

I believe it is. It's 100% jiyuulia/tangleberrie and I don't think it's another mod/mc.

I started a flat world and noticed everything is acting exactly as I've described.

  1. No chunk updates without flowers.
  2. No chunk updates with flowers without mana.
  3. No chunk updates with flowers and mana pool, but not linked yet.
  4. As soon as I link them, 5 chunk updates per flower just as I expected.
  5. Breaking the mana pool still has 5 chunk updates until the flower runs out of mana (not captured in screenshot sorry)

2017-07-13_22 12 55
2017-07-13_22 13 27

The code in tangleberrie calls sync() 5 times a second, which is this in SubTileEntity.java:

public void sync() {
		VanillaPacketDispatcher.dispatchTEToNearbyPlayers(supertile);
}

which is in the VanillaPacketDispatcher.java:

public static void dispatchTEToNearbyPlayers(TileEntity tile) {
		SPacketUpdateTileEntity packet = tile.getUpdatePacket();

		if(packet != null && tile.getWorld() instanceof WorldServer) {
			PlayerChunkMapEntry chunk = ((WorldServer) tile.getWorld()).getPlayerChunkMap().getEntry(tile.getPos().getX() >> 4, tile.getPos().getZ() >> 4);
			if(chunk != null) {
				chunk.sendPacket(packet);
			}
		}
}

I'm not a java developer or anything but the code is explicitly saying it's sending chunk updates :)

commented

"chunk updates" in the f3 menu are chunk rerenders, which sending a tile entity packet does not do.

commented

Ah I know why. It used to cause chunk rerenders in the 1.10 code, and I changed it to not do so in 1.11 (you were looking at the 1.11 code)
Not really much I can do here besides say update to 1.11, sorry :/

commented

Alright, thanks for looking. Stuck playing FTB so we'll just deal for now :)