Fixed dummy blocks not being removed from registry on dedicated server correctly. Closes #2487
Also added some more debug logs!
This commit is contained in:
parent
0dd796fb16
commit
ecfb9accaa
2 changed files with 21 additions and 3 deletions
|
@ -10,6 +10,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
|
@ -463,7 +464,11 @@ public class FMLControlledNamespacedRegistry<I> extends RegistryNamespacedDefaul
|
|||
{
|
||||
getExistingDelegate(thing).setResourceName(name);
|
||||
}
|
||||
this.dummiedLocations.remove(name);
|
||||
|
||||
if (this.dummiedLocations.remove(name) && DEBUG)
|
||||
{
|
||||
FMLLog.fine("Registry Dummy Remove: %s", name);
|
||||
}
|
||||
|
||||
if (DEBUG)
|
||||
{
|
||||
|
@ -474,6 +479,10 @@ public class FMLControlledNamespacedRegistry<I> extends RegistryNamespacedDefaul
|
|||
|
||||
void markDummy(ResourceLocation rl, Integer id, I thing)
|
||||
{
|
||||
if (DEBUG)
|
||||
{
|
||||
FMLLog.finer("Registry Dummy Add: %s %d -> %s", rl, id, thing);
|
||||
}
|
||||
this.dummiedLocations.add(rl);
|
||||
this.addObjectRaw(id, rl, thing);
|
||||
}
|
||||
|
@ -705,6 +714,10 @@ public class FMLControlledNamespacedRegistry<I> extends RegistryNamespacedDefaul
|
|||
|
||||
public void loadDummied(Set<ResourceLocation> dummied)
|
||||
{
|
||||
if (DEBUG && dummied.size() > 0)
|
||||
{
|
||||
FMLLog.fine("Registry Dummy Load: [%s]", Joiner.on(", ").join(dummied));
|
||||
}
|
||||
this.dummiedLocations.addAll(dummied);
|
||||
}
|
||||
|
||||
|
|
|
@ -174,6 +174,10 @@ public class PersistentRegistryManager
|
|||
else if (isLocalWorld)
|
||||
{
|
||||
// Carry on, we resuscitated the block
|
||||
if (FMLControlledNamespacedRegistry.DEBUG)
|
||||
{
|
||||
FMLLog.log(Level.DEBUG, "Registry: Resuscitating dummy block %s", dummy);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -324,10 +328,11 @@ public class PersistentRegistryManager
|
|||
newRegistry.loadBlocked(snapshotEntry.blocked);
|
||||
missing.put(registryName, Maps.<ResourceLocation, Integer>newLinkedHashMap());
|
||||
remaps.put(registryName, Maps.<ResourceLocation, Integer[]>newHashMap());
|
||||
// Load current dummies BEFORE the snapshot is loaded so that add() will remove from the list.
|
||||
// Potentially causes issues from cpw's previous comment. Must keep eye on.
|
||||
newRegistry.loadDummied(snapshotEntry.dummied);
|
||||
newRegistry.loadIds(snapshotEntry.ids, missing.get(registryName), remaps.get(registryName), currentRegistry, registryName);
|
||||
newRegistry.loadSubstitutions(substitutions);
|
||||
// Load current dummies AFTER the snapshot is loaded
|
||||
newRegistry.loadDummied(snapshotEntry.dummied);
|
||||
}
|
||||
|
||||
public static boolean isFrozen(FMLControlledNamespacedRegistry<?> registry)
|
||||
|
|
Loading…
Reference in a new issue