1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-11-01 22:22:59 +00:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Jonathan Coates
70c5cbafec Merge branch 'mc-1.16.x' into mc-1.17.x 2022-03-23 08:39:39 +00:00
Jonathan Coates
2c64186965 Bump version to 1.100.4 2022-03-23 08:36:09 +00:00
Jonathan Coates
31ba17d085 Don't wait for the chunk to be loaded when checking for monitors
There's a couple of alternative ways to solve this. Ideally we'd send
our network messages at the same time as MC does
(ChunkManager.playerLoadedChunk), but this'd require a mixin.

Instead we just rely on the fact that if the chunk isn't loaded,
monitors won't have done anything and so we don't need to send their
contents!

Fixes #1047, probably doesn't cause any regressions. I've not seen any
issues on 1.16, but I also hadn't before so ¯\_(ツ)_/¯.
2022-03-18 19:59:02 +00:00
4 changed files with 11 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
org.gradle.jvmargs=-Xmx3G
# Mod properties
mod_version=1.100.3
mod_version=1.100.4
# Minecraft properties (update mods.toml when changing)
mc_version=1.17.1

View File

@@ -15,7 +15,6 @@ import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.chunk.ChunkStatus;
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.event.world.ChunkWatchEvent;
@@ -47,8 +46,10 @@ public final class MonitorWatcher
@SubscribeEvent
public static void onWatch( ChunkWatchEvent.Watch event )
{
// Get the current chunk if it has been loaded. This is safe as, if the chunk hasn't been loaded yet, then the
// monitor will have no contents, and so we won't need to send an update anyway.
ChunkPos chunkPos = event.getPos();
LevelChunk chunk = (LevelChunk) event.getWorld().getChunk( chunkPos.x, chunkPos.z, ChunkStatus.FULL, false );
LevelChunk chunk = event.getWorld().getChunkSource().getChunkNow( chunkPos.x, chunkPos.z );
if( chunk == null ) return;
for( BlockEntity te : chunk.getBlockEntities().values() )

View File

@@ -1,3 +1,8 @@
# New features in CC: Tweaked 1.100.4
Several bug fixes:
* Fix the monitor watching blocking the main thread when chunks are slow to load.
# New features in CC: Tweaked 1.100.3
Several bug fixes:

View File

@@ -1,9 +1,6 @@
New features in CC: Tweaked 1.100.3
New features in CC: Tweaked 1.100.4
Several bug fixes:
* Fix client disconnect when uploading large files.
* Correctly handling empty computer ID file.
* Fix the normal turtle recipe not being unlocked.
* Remove turtle fake EntityType.
* Fix the monitor watching blocking the main thread when chunks are slow to load.
Type "help changelog" to see the full version history.