Java Code Examples for net.minecraft.tileentity.TileEntity.addMapping()

The following are Jave code examples for showing how to use addMapping() of the net.minecraft.tileentity.TileEntity class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: CustomWorldGen   File: GameRegistry.java   View Source Code Vote up 5 votes
/**
 * 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.addMapping(tileEntityClass, id);
    Map<String, Class<?>> teMappings = ObfuscationReflectionHelper.getPrivateValue(TileEntity.class, null, "field_" + "145855_i", "nameToClassMap");
    for (String s : alternatives)
    {
        if (!teMappings.containsKey(s))
        {
            teMappings.put(s, tileEntityClass);
        }
    }
}
 
Example 2
Project: CustomWorldGen   File: GameRegistry.java   View Source Code Vote up 4 votes
public static void registerTileEntity(Class<? extends TileEntity> tileEntityClass, String id)
{
    TileEntity.addMapping(tileEntityClass, id);
}