mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-21 12:42:26 +00:00
Fix ChunkDataEvent.Load not firing, it now fires in the aync thread. (#6610)
This commit is contained in:
1 parent
6985736834
commit
9c9abe3576
2 files changed
+38
-3
No files matched your search
@@ -8,7 +8,24 @@
|
||||
} else {
|
||||
ChunkPrimer chunkprimer = new ChunkPrimer(p_222656_3_, upgradedata, achunksection, chunkprimerticklist1, chunkprimerticklist);
|
||||
ichunk = chunkprimer;
|
||||
@@ -314,12 +315,22 @@
|
||||
@@ -198,6 +199,7 @@
|
||||
}
|
||||
|
||||
if (chunkstatus$type == ChunkStatus.Type.LEVELCHUNK) {
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkDataEvent.Load(ichunk, compoundnbt, chunkstatus$type));
|
||||
return new ChunkPrimerWrapper((Chunk)ichunk);
|
||||
} else {
|
||||
ChunkPrimer chunkprimer1 = (ChunkPrimer)ichunk;
|
||||
@@ -231,6 +233,8 @@
|
||||
chunkprimer1.func_205767_a(generationstage$carving, BitSet.valueOf(compoundnbt5.func_74770_j(s1)));
|
||||
}
|
||||
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkDataEvent.Load(ichunk, compoundnbt, chunkstatus$type));
|
||||
+
|
||||
return chunkprimer1;
|
||||
}
|
||||
}
|
||||
@@ -314,12 +318,22 @@
|
||||
for(int k = 0; k < chunk.func_177429_s().length; ++k) {
|
||||
for(Entity entity : chunk.func_177429_s()[k]) {
|
||||
CompoundNBT compoundnbt3 = new CompoundNBT();
|
||||
@@ -31,7 +48,7 @@
|
||||
} else {
|
||||
ChunkPrimer chunkprimer = (ChunkPrimer)p_222645_1_;
|
||||
listnbt2.addAll(chunkprimer.func_201652_l());
|
||||
@@ -363,6 +374,7 @@
|
||||
@@ -363,6 +377,7 @@
|
||||
|
||||
compoundnbt1.func_218657_a("Heightmaps", compoundnbt6);
|
||||
compoundnbt1.func_218657_a("Structures", func_222649_a(chunkpos, p_222645_1_.func_201609_c(), p_222645_1_.func_201604_d()));
|
||||
|
||||
@@ -19,9 +19,12 @@
|
||||
|
||||
package net.minecraftforge.event.world;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.ChunkStatus;
|
||||
import net.minecraft.world.chunk.IChunk;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
@@ -54,7 +57,7 @@ public class ChunkDataEvent extends ChunkEvent
|
||||
/**
|
||||
* ChunkDataEvent.Load is fired when vanilla Minecraft attempts to load Chunk data.<br>
|
||||
* This event is fired during chunk loading in
|
||||
* {@link net.minecraftforge.common.chunkio.ChunkIOProvider#syncCallback()}.<br>
|
||||
* {@link net.minecraft.world.chunk.storage.ChunkSerializer.read(ServerWorld, TemplateManager, PointOfInterestManager, ChunkPos, CompoundNBT)} which means it is async, so be careful.<br>
|
||||
* <br>
|
||||
* This event is not {@link Cancelable}.<br>
|
||||
* <br>
|
||||
@@ -64,10 +67,25 @@ public class ChunkDataEvent extends ChunkEvent
|
||||
**/
|
||||
public static class Load extends ChunkDataEvent
|
||||
{
|
||||
private ChunkStatus.Type status;
|
||||
|
||||
@Deprecated
|
||||
public Load(IChunk chunk, CompoundNBT data)
|
||||
{
|
||||
super(chunk, data);
|
||||
}
|
||||
|
||||
public Load(IChunk chunk, CompoundNBT data, ChunkStatus.Type status)
|
||||
{
|
||||
super(chunk, data);
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ChunkStatus.Type getStatus()
|
||||
{
|
||||
return this.status;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user