Fix for 'Extra Data for a Block Sometimes Will Lost' and 'Animals are invisible to players'
parent
807b8f336e
commit
e3e871c1b6
2
pom.xml
2
pom.xml
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>orebfuscator</artifactId>
|
<artifactId>orebfuscator</artifactId>
|
||||||
<version>4.0.11-SNAPSHOT</version>
|
<version>4.0.12-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>Orebfuscator4</name>
|
<name>Orebfuscator4</name>
|
||||||
|
|
|
@ -7,7 +7,6 @@ import java.util.Map;
|
||||||
import java.util.WeakHashMap;
|
import java.util.WeakHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
import net.minecraft.server.v1_9_R1.PacketPlayOutMapChunk;
|
|
||||||
import net.minecraft.server.v1_9_R1.PlayerChunk;
|
import net.minecraft.server.v1_9_R1.PlayerChunk;
|
||||||
import net.minecraft.server.v1_9_R1.PlayerChunkMap;
|
import net.minecraft.server.v1_9_R1.PlayerChunkMap;
|
||||||
import net.minecraft.server.v1_9_R1.WorldServer;
|
import net.minecraft.server.v1_9_R1.WorldServer;
|
||||||
|
@ -124,21 +123,22 @@ public class ChunkReloader extends Thread implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void reloadChunks(
|
private static void reloadChunks(
|
||||||
World world,
|
final World world,
|
||||||
HashSet<ChunkCoord> chunksForReloadForWorld,
|
HashSet<ChunkCoord> chunksForReloadForWorld,
|
||||||
ArrayList<ChunkCoord> reloadedChunks
|
ArrayList<ChunkCoord> reloadedChunks
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
WorldServer worldServer = ((CraftWorld)world).getHandle();
|
WorldServer worldServer = ((CraftWorld)world).getHandle();
|
||||||
PlayerChunkMap chunkMap = worldServer.getPlayerChunkMap();
|
PlayerChunkMap chunkMap = worldServer.getPlayerChunkMap();
|
||||||
File cacheFolder = new File(OrebfuscatorConfig.getCacheFolder(), world.getName());
|
File cacheFolder = new File(OrebfuscatorConfig.getCacheFolder(), world.getName());
|
||||||
|
final ArrayList<ChunkCoord> scheduledChunksForReload = new ArrayList<ChunkCoord>();
|
||||||
|
|
||||||
for(ChunkCoord chunk : chunksForReloadForWorld) {
|
for(ChunkCoord chunk : chunksForReloadForWorld) {
|
||||||
if(!chunkMap.isChunkInUse(chunk.x, chunk.z)) continue;
|
if(!chunkMap.isChunkInUse(chunk.x, chunk.z)) continue;
|
||||||
|
|
||||||
PlayerChunk playerChunk = chunkMap.b(chunk.x, chunk.z);
|
PlayerChunk playerChunk = chunkMap.b(chunk.x, chunk.z);
|
||||||
if(playerChunk == null || playerChunk.chunk == null || !playerChunk.chunk.isReady()) continue;
|
if(playerChunk == null || playerChunk.chunk == null || !playerChunk.chunk.isReady()) continue;
|
||||||
|
|
||||||
reloadedChunks.add(chunk);
|
reloadedChunks.add(chunk);
|
||||||
|
|
||||||
if(OrebfuscatorConfig.UseCache) {
|
if(OrebfuscatorConfig.UseCache) {
|
||||||
|
@ -146,10 +146,22 @@ public class ChunkReloader extends Thread implements Runnable {
|
||||||
if(cache.getHash() != 0) continue;
|
if(cache.getHash() != 0) continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Orebfuscator.log("Force chunk x = " + chunk.x + ", z = " + chunk.z + " reload for players");/*debug*/
|
scheduledChunksForReload.add(chunk);
|
||||||
|
|
||||||
playerChunk.a(new PacketPlayOutMapChunk(playerChunk.chunk, true, 0xffff));//Reload chunks for players loaded it
|
//Orebfuscator.log("Add chunk x = " + chunk.x + ", z = " + chunk.z + " to schedule for reload for players");/*debug*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Orebfuscator.instance.runTask(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
//Reload chunk for players
|
||||||
|
for(ChunkCoord chunk : scheduledChunksForReload) {
|
||||||
|
world.refreshChunk(chunk.x, chunk.z);
|
||||||
|
|
||||||
|
//Orebfuscator.log("Force chunk x = " + chunk.x + ", z = " + chunk.z + " to reload for players");/*debug*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void restart() {
|
private static void restart() {
|
||||||
|
|
Loading…
Reference in New Issue