Some tweaks - GameRegistry is modder facing API, so avoid having MC methods there. Fix a couple of registry bugs.

This commit is contained in:
cpw 2015-11-29 23:12:34 -05:00
parent 0af45cbf25
commit 55e707cc07
4 changed files with 3 additions and 15 deletions

View file

@ -28,7 +28,7 @@ import net.minecraftforge.fml.common.registry.RegistryDelegate.Delegate;
public class FMLControlledNamespacedRegistry<I> extends RegistryNamespacedDefaultedByKey<ResourceLocation, I>
{
public static final boolean DEBUG = Boolean.parseBoolean(System.getProperty("fml.debugRegistryEntries", "false"));
public static final boolean DEBUG = Boolean.parseBoolean(System.getProperty("fml.debugRegistryEntries", "true"));
private final Class<I> superType;
private final boolean isDelegated;
private final Field delegateAccessor;

View file

@ -32,7 +32,7 @@ public class GameData
static final int MAX_BLOCK_ID = 4095;
static final int MIN_ITEM_ID = 4096;
static final int MAX_ITEM_ID = 31999;
public static final int MIN_POTION_ID = 32; // 0-31 are vanilla, forge start at 32
public static final int MIN_POTION_ID = 0; // 0-~31 are vanilla, forge start at 32
public static final int MAX_POTION_ID = 255; // S1DPacketEntityEffect sends bytes, we can only use 255
private static final GameData mainData = new GameData();
@ -147,13 +147,6 @@ public class GameData
return iBlockRegistry.add(idHint, name, block);
}
/**
* Called from GameRegistry, which is called from Potion-Constructor
*/
int registerPotion(Potion potion, ResourceLocation name, int id) {
return iPotionRegistry.add(id, name, potion);
}
/**
* Prefix the supplied name with the current mod id.
* <p/>

View file

@ -236,11 +236,6 @@ public class GameRegistry
}
}
/** Called from Potion Constructor */
public static int registerPotion(Potion potion, ResourceLocation name, int potionID) {
return GameData.getMain().registerPotion(potion, name, potionID);
}
public static void addRecipe(ItemStack output, Object... params)
{
addShapedRecipe(output, params);

View file

@ -217,8 +217,8 @@ public class PersistentRegistryManager
private static <T> void loadFrozenDataToStagingRegistry(Map<ResourceLocation, Map<ResourceLocation, Integer[]>> remaps, ResourceLocation registryName, Class<T> regType)
{
FMLControlledNamespacedRegistry<T> newRegistry = PersistentRegistry.STAGING.getRegistry(registryName, regType);
FMLControlledNamespacedRegistry<T> frozenRegistry = PersistentRegistry.FROZEN.getRegistry(registryName, regType);
FMLControlledNamespacedRegistry<T> newRegistry = PersistentRegistry.STAGING.getOrShallowCopyRegistry(registryName, regType, frozenRegistry);
newRegistry.loadIds(frozenRegistry.getEntriesNotIn(newRegistry), Maps.<ResourceLocation, Integer>newLinkedHashMap(), remaps.get(registryName), frozenRegistry, registryName);
}