OK, this is finally actually working, I think...
This commit is contained in:
parent
8309a32ad2
commit
45ec6e0833
2 changed files with 25 additions and 5 deletions
|
@ -32,10 +32,12 @@ import net.minecraftforge.fml.client.FMLFileResourcePack;
|
|||
import net.minecraftforge.fml.client.FMLFolderResourcePack;
|
||||
import net.minecraftforge.fml.common.asm.FMLSanityChecker;
|
||||
import net.minecraftforge.fml.common.event.FMLConstructionEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.network.NetworkCheckHandler;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler;
|
||||
import net.minecraftforge.fml.common.registry.GameData;
|
||||
import net.minecraftforge.fml.common.registry.VillagerRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
@ -84,6 +86,13 @@ public class FMLContainer extends DummyModContainer implements WorldAccessContai
|
|||
FMLNetworkHandler.registerChannel(this, evt.getSide());
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void modPreinitialization(FMLPreInitializationEvent evt)
|
||||
{
|
||||
// Initialize the villager registry
|
||||
VillagerRegistry.instance();
|
||||
}
|
||||
|
||||
@NetworkCheckHandler
|
||||
public boolean checkModLists(Map<String,String> modList, Side side)
|
||||
{
|
||||
|
|
|
@ -52,6 +52,7 @@ import com.google.common.base.Joiner.MapJoiner;
|
|||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBasedTable;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.google.common.collect.ImmutableBiMap;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableListMultimap;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
@ -709,15 +710,18 @@ public class GameData {
|
|||
|
||||
int register(Object obj, String name, int idHint) // from FMLControlledNamespacedRegistry.addObject
|
||||
{
|
||||
// tolerate extra name prefixes here since mc does it as well
|
||||
name = addPrefix(name);
|
||||
|
||||
if (obj instanceof Block)
|
||||
{
|
||||
// tolerate extra name prefixes here since mc does it as well
|
||||
name = addPrefix(name);
|
||||
|
||||
return registerBlock((Block) obj, name, idHint);
|
||||
}
|
||||
else if (obj instanceof Item)
|
||||
{
|
||||
// tolerate extra name prefixes here since mc does it as well
|
||||
name = addPrefix(name);
|
||||
|
||||
return registerItem((Item) obj, name, idHint);
|
||||
}
|
||||
else
|
||||
|
@ -963,7 +967,7 @@ public class GameData {
|
|||
}
|
||||
else
|
||||
{
|
||||
throw new RuntimeException("WHAT?");
|
||||
return ImmutableBiMap.of();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1058,6 +1062,12 @@ public class GameData {
|
|||
String regName = e.getKey();
|
||||
FMLControlledNamespacedRegistry<?> registry = e.getValue();
|
||||
FMLControlledNamespacedRegistry<?> newRegistry = genericRegistries.get(regName);
|
||||
if (newRegistry == null)
|
||||
{
|
||||
newRegistry = registry.makeShallowCopy();
|
||||
genericRegistries.put(regName, newRegistry);
|
||||
}
|
||||
|
||||
GameDataSnapshot.Entry regSnap = snapshot.entries.get("fmlgr:"+regName);
|
||||
if (regSnap == null) {
|
||||
FMLLog.info("Weird, there was no registry data for registry %s found in the snapshot", regName);
|
||||
|
@ -1081,7 +1091,8 @@ public class GameData {
|
|||
FMLLog.fine("Fixed registry %s id mismatch %s: %d (init) -> %d (map).", regName, entryName, currId, entryId);
|
||||
}
|
||||
|
||||
newRegistry.register(entryId, entryName, registry.getRaw(entryName));
|
||||
|
||||
newRegistry.add(entryId, entryName, registry.getRaw(entryName));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue