Add in a registry method to allow for alternative TileEntity names- they will be used to support
loading maps containing the older definitions.
This commit is contained in:
parent
c13502c690
commit
472ca8c8a9
1 changed files with 22 additions and 0 deletions
|
@ -45,6 +45,7 @@ import cpw.mods.fml.common.IWorldGenerator;
|
||||||
import cpw.mods.fml.common.Loader;
|
import cpw.mods.fml.common.Loader;
|
||||||
import cpw.mods.fml.common.LoaderException;
|
import cpw.mods.fml.common.LoaderException;
|
||||||
import cpw.mods.fml.common.LoaderState;
|
import cpw.mods.fml.common.LoaderState;
|
||||||
|
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||||
import cpw.mods.fml.common.Mod.Block;
|
import cpw.mods.fml.common.Mod.Block;
|
||||||
import cpw.mods.fml.common.ModContainer;
|
import cpw.mods.fml.common.ModContainer;
|
||||||
|
|
||||||
|
@ -278,6 +279,27 @@ public class GameRegistry
|
||||||
TileEntity.func_70306_a(tileEntityClass, id);
|
TileEntity.func_70306_a(tileEntityClass, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register a tile entity, with alternative TileEntity identifiers. Use with caution!
|
||||||
|
* This method allows for you to "rename" the 'id' of the tile entity.
|
||||||
|
*
|
||||||
|
* @param tileEntityClass The tileEntity class to register
|
||||||
|
* @param id The primary ID, this will be the ID that the tileentity saves as
|
||||||
|
* @param alternatives A list of alternative IDs that will also map to this class. These will never save, but they will load
|
||||||
|
*/
|
||||||
|
public static void registerTileEntityWithAlternatives(Class<? extends TileEntity> tileEntityClass, String id, String... alternatives)
|
||||||
|
{
|
||||||
|
TileEntity.func_70306_a(tileEntityClass, id);
|
||||||
|
Map<String,Class> teMappings = ObfuscationReflectionHelper.getPrivateValue(TileEntity.class, null, "field_70326_a", "a");
|
||||||
|
for (String s: alternatives)
|
||||||
|
{
|
||||||
|
if (!teMappings.containsKey(s))
|
||||||
|
{
|
||||||
|
teMappings.put(s, tileEntityClass);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void addBiome(BiomeGenBase biome)
|
public static void addBiome(BiomeGenBase biome)
|
||||||
{
|
{
|
||||||
WorldType.field_77137_b.addNewBiome(biome);
|
WorldType.field_77137_b.addNewBiome(biome);
|
||||||
|
|
Loading…
Reference in a new issue