net.minecraftforge.common
Class MinecartRegistry

java.lang.Object
  extended by net.minecraftforge.common.MinecartRegistry

public class MinecartRegistry
extends Object


Nested Class Summary
static class MinecartRegistry.MinecartKey
           
 
Constructor Summary
MinecartRegistry()
           
 
Method Summary
static Set<ItemStack> getAllCartItems()
          Will return a set of all registered minecart items.
static Class<? extends EntityMinecart> getCartClassForItem(ItemStack item)
          The function will return the cart class for a given item.
static int getCartTypeForItem(ItemStack item)
          The function will return the cart type for a given item.
static ItemStack getItemForCart(Class<? extends EntityMinecart> minecart)
          This function returns an ItemStack that represents this cart.
static ItemStack getItemForCart(Class<? extends EntityMinecart> minecart, int type)
          This function returns an ItemStack that represents this cart.
static ItemStack getItemForCart(EntityMinecart cart)
          This function returns an ItemStack that represents this cart.
static void registerMinecart(Class<? extends EntityMinecart> minecart, int type, ItemStack item)
          Registers a minecart and its corresponding item.
static void registerMinecart(Class<? extends EntityMinecart> cart, ItemStack item)
          Registers a custom minecart and its corresponding item.
static void removeMinecart(Class<? extends EntityMinecart> minecart, int type)
          Removes a previously registered Minecart.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MinecartRegistry

public MinecartRegistry()
Method Detail

registerMinecart

public static void registerMinecart(Class<? extends EntityMinecart> cart,
                                    ItemStack item)
Registers a custom minecart and its corresponding item. This should be the item used to place the minecart by the user, not the item dropped by the cart.

Parameters:
cart - The minecart.
item - The item used to place the cart.

registerMinecart

public static void registerMinecart(Class<? extends EntityMinecart> minecart,
                                    int type,
                                    ItemStack item)
Registers a minecart and its corresponding item. This should be the item used to place the minecart by the user, not the item dropped by the cart.

Parameters:
minecart - The minecart.
type - The minecart type, used to differentiate carts that have the same class.
item - The item used to place the cart.

removeMinecart

public static void removeMinecart(Class<? extends EntityMinecart> minecart,
                                  int type)
Removes a previously registered Minecart. Useful for replacing the vanilla minecarts.

Parameters:
minecart -
type -

getItemForCart

public static ItemStack getItemForCart(Class<? extends EntityMinecart> minecart)
This function returns an ItemStack that represents this cart. The player should be able to use this item to place the minecart. This is the item that was registered with the cart via the registerMinecart function, but is not necessary the item the cart drops when destroyed.

Parameters:
minecart - The cart class
Returns:
An ItemStack that can be used to place the cart.

getItemForCart

public static ItemStack getItemForCart(Class<? extends EntityMinecart> minecart,
                                       int type)
This function returns an ItemStack that represents this cart. The player should be able to use this item to place the minecart. This is the item that was registered with the cart via the registerMinecart function, but is not necessary the item the cart drops when destroyed.

Parameters:
minecart - The cart class
type - The minecartType value
Returns:
An ItemStack that can be used to place the cart.

getItemForCart

public static ItemStack getItemForCart(EntityMinecart cart)
This function returns an ItemStack that represents this cart. The player should be able to use this item to place the minecart. This is the item that was registered with the cart via the registerMinecart function, but is not necessary the item the cart drops when destroyed.

Parameters:
cart - The cart entity
Returns:
An ItemStack that can be used to place the cart.

getCartClassForItem

public static Class<? extends EntityMinecart> getCartClassForItem(ItemStack item)
The function will return the cart class for a given item. If the item was not registered via the registerMinecart function it will return null.

Parameters:
item - The item to test.
Returns:
Cart if mapping exists, null if not.

getCartTypeForItem

public static int getCartTypeForItem(ItemStack item)
The function will return the cart type for a given item. Will return -1 if the mapping doesn't exist. If the item was not registered via the registerMinecart function it will return null.

Parameters:
item - The item to test.
Returns:
the cart minecartType value.

getAllCartItems

public static Set<ItemStack> getAllCartItems()
Will return a set of all registered minecart items.

Returns:
a copy of the set of all minecart items