mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-21 20:52:34 +00:00
Some more tweaks to the chunkloading code. The world.load event fires slightly later- once the entity watcher is
set up, so entities can actually load into the server world. Also, tickets actually save and load properly and null entities don't break the server
This commit is contained in:
1 parent
4dd3d2cfd7
commit
384f795d52
4 files changed
+43
-31
No files matched your search
@@ -236,8 +236,8 @@ public class ForgeChunkManager
|
||||
|
||||
static void loadWorld(World world)
|
||||
{
|
||||
ArrayListMultimap<String, Ticket> loadedTickets = ArrayListMultimap.<String, Ticket>create();
|
||||
tickets.put(world, loadedTickets);
|
||||
ArrayListMultimap<String, Ticket> newTickets = ArrayListMultimap.<String, Ticket>create();
|
||||
tickets.put(world, newTickets);
|
||||
|
||||
SetMultimap<ChunkCoordIntPair,Ticket> forcedChunkMap = LinkedHashMultimap.create();
|
||||
forcedChunks.put(world, forcedChunkMap);
|
||||
@@ -253,6 +253,7 @@ public class ForgeChunkManager
|
||||
|
||||
if (chunkLoaderData.exists() && chunkLoaderData.isFile())
|
||||
{
|
||||
ArrayListMultimap<String, Ticket> loadedTickets = ArrayListMultimap.<String, Ticket>create();
|
||||
NBTTagCompound forcedChunkData;
|
||||
try
|
||||
{
|
||||
@@ -638,19 +639,23 @@ public class ForgeChunkManager
|
||||
for (Ticket tick : ticketSet.get(modId))
|
||||
{
|
||||
NBTTagCompound ticket = new NBTTagCompound();
|
||||
tickets.appendTag(ticket);
|
||||
ticket.setByte("Type", (byte) tick.ticketType.ordinal());
|
||||
ticket.setByte("ChunkListDepth", (byte) tick.maxDepth);
|
||||
if (tick.modData != null)
|
||||
{
|
||||
ticket.setCompoundTag("ModData", tick.modData);
|
||||
}
|
||||
if (tick.ticketType == Type.ENTITY)
|
||||
if (tick.ticketType == Type.ENTITY && tick.entity != null)
|
||||
{
|
||||
ticket.setInteger("chunkX", MathHelper.floor_double(tick.entity.chunkCoordX));
|
||||
ticket.setInteger("chunkZ", MathHelper.floor_double(tick.entity.chunkCoordZ));
|
||||
ticket.setLong("PersistentIDMSB", tick.entity.getPersistentID().getMostSignificantBits());
|
||||
ticket.setLong("PersistentIDLSB", tick.entity.getPersistentID().getLeastSignificantBits());
|
||||
tickets.appendTag(ticket);
|
||||
}
|
||||
else if (tick.ticketType != Type.ENTITY)
|
||||
{
|
||||
tickets.appendTag(ticket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user