
Client bandwidth usage caused by barrels and crucibles
jinkhya opened this issue ยท 9 comments
Describe the bug
Hello, this is a rather weird issue but it looks like when playing on a server, the more you place barrels/crucibles, the more your client uses download bandwidth constantly. For testing purposes I placed a bunch of them and was able to cap my bandwidth (which is 6.5Mbps, yes I know my internet is crap which is why I noticed something was wrong :P )
To Reproduce
Steps to reproduce the behavior:
- Set up a server with forge (I used 36.1.24) and exnihilo sequentia
- Join the server and place barrels or crucibles
- The more you place the more you'll see your download usage go up.
Expected behavior
To not cause the client to download constantly.
Version
Minecraft Version: 1.16.5
Forge Version: 36.1.24
Ex Nihilo: Sequentia Version: 2.0.2.6
Hello,
Any update on this? I know it's only noticeable for people with bad internet but it gets frustrating when you can't visit your friends on server because they have a lot of barrels and crucibles :) I'm myself limiting how many I place at my base so I can keep playing on the server.
If you need me to test anything, I'm all for it, don't hesitate.
Thanks in advance,
Jin
(I'm currently playing SkyFactory one and can confirm this issue is still present)
That's awesome to hear !!! no worries on time, just happy you found what causes this :D thanks for the feedback
i actually found the problem, trying to fix it. just takes some time.
Any clues as to where in the code this is, please?
Thanks for that, will play around with something like the following:
diff --git a/src/main/java/novamachina/exnihilosequentia/common/tileentity/barrel/AbstractBarrelTile.java b/src/main/java/novamachina/exnihilosequentia/common/tileentity/barrel/AbstractBarrelTile.java
index 51f5165..1da7b8e 100644
--- a/src/main/java/novamachina/exnihilosequentia/common/tileentity/barrel/AbstractBarrelTile.java
+++ b/src/main/java/novamachina/exnihilosequentia/common/tileentity/barrel/AbstractBarrelTile.java
@@ -75,15 +75,21 @@ public abstract class AbstractBarrelTile extends TileEntity implements ITickable
return;
}
+ boolean updated = false;
+
if (mode.isEmptyMode() || mode.getModeName().equals(ExNihiloConstants.BarrelModes.FLUID)) {
BlockPos abovePos = worldPosition.offset(0, 1, 0);
if (getLevel().isRainingAt(abovePos)) {
FluidStack stack = new FluidStack(Fluids.WATER, Config.getRainFillAmount());
tank.fill(stack, IFluidHandler.FluidAction.EXECUTE);
}
+
+ updated = true;
}
mode.tick(this);
- getLevel().sendBlockUpdated(getBlockPos(), getBlockState(), getBlockState(), 2);
+
+ if (updated)
+ getLevel().sendBlockUpdated(getBlockPos(), getBlockState(), getBlockState(), 2);
}
@Override
diff --git a/src/main/java/novamachina/exnihilosequentia/common/tileentity/crucible/FiredCrucibleTile.java b/src/main/java/novamachina/exnihilosequentia/common/tileentity/crucible/FiredCrucibleTile.java
index 2e0e6f6..da543f4 100644
--- a/src/main/java/novamachina/exnihilosequentia/common/tileentity/crucible/FiredCrucibleTile.java
+++ b/src/main/java/novamachina/exnihilosequentia/common/tileentity/crucible/FiredCrucibleTile.java
@@ -42,6 +42,8 @@ public class FiredCrucibleTile extends BaseCrucibleTile {
return;
}
+ boolean updated = false;
+
inventory.setCrucibleHasRoom(tank.getFluidAmount() < MAX_FLUID_AMOUNT);
ticksSinceLast++;
@@ -63,6 +65,8 @@ public class FiredCrucibleTile extends BaseCrucibleTile {
solidAmount = ExNihiloRegistries.CRUCIBLE_REGISTRY.findRecipeByItemStack(currentItem)
.getAmount();
+
+ updated = true;
} else {
return;
}
@@ -78,6 +82,8 @@ public class FiredCrucibleTile extends BaseCrucibleTile {
if (inventory.getStackInSlot(0).isEmpty()) {
inventory.setStackInSlot(0, ItemStack.EMPTY);
}
+
+ updated = true;
}
}
@@ -91,8 +97,12 @@ public class FiredCrucibleTile extends BaseCrucibleTile {
ExNihiloRegistries.CRUCIBLE_REGISTRY.findRecipeByItemStack(currentItem).getResultFluid(), heat);
int filled = tank.fill(fluidStack, FluidAction.EXECUTE);
solidAmount -= filled;
+
+ updated = true;
}
}
- level.sendBlockUpdated(getBlockPos(), getBlockState(), getBlockState(), 2);
+
+ if (updated)
+ level.sendBlockUpdated(getBlockPos(), getBlockState(), getBlockState(), 2);
}
}
diff --git a/src/main/java/novamachina/exnihilosequentia/common/tileentity/crucible/WoodCrucibleTile.java b/src/main/java/novamachina/exnihilosequentia/common/tileentity/crucible/WoodCrucibleTile.java
index 0d5e985..78e0c2f 100644
--- a/src/main/java/novamachina/exnihilosequentia/common/tileentity/crucible/WoodCrucibleTile.java
+++ b/src/main/java/novamachina/exnihilosequentia/common/tileentity/crucible/WoodCrucibleTile.java
@@ -24,6 +24,8 @@ public class WoodCrucibleTile extends BaseCrucibleTile {
return;
}
+ boolean updated = false;
+
inventory.setCrucibleHasRoom(tank.getFluidAmount() < MAX_FLUID_AMOUNT);
ticksSinceLast++;
@@ -45,6 +47,8 @@ public class WoodCrucibleTile extends BaseCrucibleTile {
solidAmount = ExNihiloRegistries.CRUCIBLE_REGISTRY.findRecipeByItemStack(currentItem)
.getAmount();
+
+ updated = true;
} else {
return;
}
@@ -60,6 +64,8 @@ public class WoodCrucibleTile extends BaseCrucibleTile {
if (inventory.getStackInSlot(0).isEmpty()) {
inventory.setStackInSlot(0, ItemStack.EMPTY);
}
+
+ updated = true;
}
}
@@ -73,9 +79,13 @@ public class WoodCrucibleTile extends BaseCrucibleTile {
ExNihiloRegistries.CRUCIBLE_REGISTRY.findRecipeByItemStack(currentItem).getResultFluid(), heat);
int filled = tank.fill(fluidStack, FluidAction.EXECUTE);
solidAmount -= filled;
+
+ updated = true;
}
}
- level.sendBlockUpdated(getBlockPos(), getBlockState(), getBlockState(), 2);
+
+ if (updated)
+ level.sendBlockUpdated(getBlockPos(), getBlockState(), getBlockState(), 2);
}
@Override