Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

public abstract class SyncedTileEntityBase extends BlockStateTileEntity implements ISyncedTileEntity {

public static final int SIZE_THRESHOLD = 10;
private final PacketDataList updates = new PacketDataList();

public @Nullable TileEntity getNeighbor(EnumFacing facing) {
Expand Down Expand Up @@ -65,7 +66,7 @@ private void notifyWorld() {

private boolean canNotifyWorld() {
// short circuit with packet size to avoid too many hash lookups and instanceof casts
if (updates.size() > 10 && getWorld() instanceof WorldServer server) {
if (updates.size() > SIZE_THRESHOLD && getWorld() instanceof WorldServer server) {
int x = getPos().getX() >> 4;
int z = getPos().getZ() >> 4;
if (server.getPlayerChunkMap().contains(x, z)) {
Expand All @@ -76,7 +77,8 @@ private boolean canNotifyWorld() {
return false;
}
}
return false;
// assume we can send data regardless
return true;
}

@Override
Expand Down
Loading