2012-05-04 21:02:12 +00:00
|
|
|
package net.minecraft.src;
|
2012-05-03 23:40:55 +00:00
|
|
|
|
|
|
|
import java.util.Collections;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
public class ClientRegistry implements IMinecraftRegistry
|
|
|
|
{
|
|
|
|
|
2012-05-05 18:42:46 +00:00
|
|
|
public static ClientRegistry instance() {
|
|
|
|
return (ClientRegistry) CommonRegistry.instance();
|
|
|
|
}
|
2012-05-03 23:40:55 +00:00
|
|
|
@Override
|
|
|
|
public void addRecipe(ItemStack output, Object... params)
|
|
|
|
{
|
2012-05-04 21:02:12 +00:00
|
|
|
CraftingManager.func_1120_a().func_1121_a(output, params);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void addShapelessRecipe(ItemStack output, Object... params)
|
|
|
|
{
|
2012-05-04 21:02:12 +00:00
|
|
|
CraftingManager.func_1120_a().func_21187_b(output, params);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void addSmelting(int input, ItemStack output)
|
|
|
|
{
|
2012-05-04 21:02:12 +00:00
|
|
|
FurnaceRecipes.func_21200_a().func_21199_a(input, output);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void registerBlock(Block block)
|
|
|
|
{
|
|
|
|
registerBlock(block, ItemBlock.class);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void registerBlock(Block block, Class <? extends ItemBlock > itemclass)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
assert block != null : "registerBlock: block cannot be null";
|
|
|
|
assert itemclass != null : "registerBlock: itemclass cannot be null";
|
2012-05-04 21:02:12 +00:00
|
|
|
int blockItemId = block.field_376_bc - 256;
|
2012-05-03 23:40:55 +00:00
|
|
|
itemclass.getConstructor(int.class).newInstance(blockItemId);
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
//HMMM
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void registerEntityID(Class <? extends Entity > entityClass, String entityName, int id)
|
|
|
|
{
|
|
|
|
EntityList.addNewEntityListMapping(entityClass, entityName, id);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void registerEntityID(Class <? extends Entity > entityClass, String entityName, int id, int backgroundEggColour, int foregroundEggColour)
|
|
|
|
{
|
|
|
|
EntityList.addNewEntityListMapping(entityClass, entityName, id, backgroundEggColour, foregroundEggColour);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void registerTileEntity(Class <? extends TileEntity > tileEntityClass, String id)
|
|
|
|
{
|
|
|
|
TileEntity.addNewTileEntityMapping(tileEntityClass, id);
|
|
|
|
}
|
|
|
|
|
2012-05-05 18:42:46 +00:00
|
|
|
public void registerTileEntity(Class <? extends TileEntity > tileEntityClass, String id, TileEntitySpecialRenderer specialRenderer)
|
|
|
|
{
|
|
|
|
registerTileEntity(tileEntityClass, id);
|
|
|
|
TileEntityRenderer.setTileEntityRenderer(tileEntityClass, specialRenderer);
|
|
|
|
}
|
|
|
|
|
2012-05-03 23:40:55 +00:00
|
|
|
@Override
|
|
|
|
public void addBiome(BiomeGenBase biome)
|
|
|
|
{
|
|
|
|
//NOOP because the implementation idea is broken. Creating a BiomeGenBase adds the biome already.
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void addSpawn(Class <? extends EntityLiving > entityClass, int weightedProb, int min, int max, EnumCreatureType typeOfCreature, BiomeGenBase... biomes)
|
|
|
|
{
|
|
|
|
for (BiomeGenBase biome : biomes)
|
|
|
|
{
|
|
|
|
@SuppressWarnings("unchecked")
|
2012-05-04 21:02:12 +00:00
|
|
|
List<SpawnListEntry> spawns = biome.func_25063_a(typeOfCreature);
|
2012-05-03 23:40:55 +00:00
|
|
|
|
|
|
|
for (SpawnListEntry entry : spawns)
|
|
|
|
{
|
|
|
|
//Adjusting an existing spawn entry
|
2012-05-04 21:02:12 +00:00
|
|
|
if (entry.field_25212_a == entityClass)
|
2012-05-03 23:40:55 +00:00
|
|
|
{
|
2012-05-04 21:02:12 +00:00
|
|
|
entry.field_35590_d = weightedProb;
|
|
|
|
entry.field_35591_b = min;
|
|
|
|
entry.field_35592_c = max;
|
2012-05-03 23:40:55 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
spawns.add(new SpawnListEntry(entityClass, weightedProb, min, max));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
public void addSpawn(String entityName, int weightedProb, int min, int max, EnumCreatureType spawnList, BiomeGenBase... biomes)
|
|
|
|
{
|
|
|
|
Class <? extends Entity > entityClazz = EntityList.getEntityToClassMapping().get(entityName);
|
|
|
|
|
|
|
|
if (EntityLiving.class.isAssignableFrom(entityClazz))
|
|
|
|
{
|
|
|
|
addSpawn((Class <? extends EntityLiving >) entityClazz, weightedProb, min, max, spawnList, biomes);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void removeBiome(BiomeGenBase biome)
|
|
|
|
{
|
|
|
|
// NOOP because broken
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void removeSpawn(Class <? extends EntityLiving > entityClass, EnumCreatureType typeOfCreature, BiomeGenBase... biomes)
|
|
|
|
{
|
|
|
|
for (BiomeGenBase biome : biomes)
|
|
|
|
{
|
|
|
|
@SuppressWarnings("unchecked")
|
2012-05-04 21:02:12 +00:00
|
|
|
List<SpawnListEntry> spawns = biome.func_25063_a(typeOfCreature);
|
2012-05-03 23:40:55 +00:00
|
|
|
|
|
|
|
for (SpawnListEntry entry : Collections.unmodifiableList(spawns))
|
|
|
|
{
|
2012-05-04 21:02:12 +00:00
|
|
|
if (entry.field_25212_a == entityClass)
|
2012-05-03 23:40:55 +00:00
|
|
|
{
|
|
|
|
spawns.remove(entry);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
public void removeSpawn(String entityName, EnumCreatureType spawnList, BiomeGenBase... biomes)
|
|
|
|
{
|
|
|
|
Class <? extends Entity > entityClazz = EntityList.getEntityToClassMapping().get(entityName);
|
|
|
|
|
|
|
|
if (EntityLiving.class.isAssignableFrom(entityClazz))
|
|
|
|
{
|
|
|
|
removeSpawn((Class <? extends EntityLiving >) entityClazz, spawnList, biomes);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|