本文整理汇总了Java中net.minecraft.item.crafting.CraftingManager.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java CraftingManager.getInstance方法的具体用法?Java CraftingManager.getInstance怎么用?Java CraftingManager.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.item.crafting.CraftingManager
的用法示例。
在下文中一共展示了CraftingManager.getInstance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: load
import net.minecraft.item.crafting.CraftingManager; //导入方法依赖的package包/类
public static void load()
{
CraftingManager craftingManager;
craftingManager = CraftingManager.getInstance();
craftingManager.addRecipe(new ItemStack(ItemRegister.BLUE_STICK, 4), new Object[] {"#", "#", '#', new ItemStack(BlockRegister.PLANKS, 1, 0)});
craftingManager.addRecipe(new ItemStack(Items.stick, 4), new Object[] {"#", "#", '#', new ItemStack(BlockRegister.PLANKS, 1, 1)});
craftingManager.addRecipe(new ItemStack(BlockRegister.PLANKS, 4, 0), new Object[] {"#", '#', new ItemStack(BlockRegister.LOGS1, 1, 0)});
craftingManager.addRecipe(new ItemStack(BlockRegister.PLANKS, 4, 0), new Object[] {"#", '#', new ItemStack(BlockRegister.LOGS1, 1, 1)});
craftingManager.addRecipe(new ItemStack(BlockRegister.PLANKS, 4, 1), new Object[] {"#", '#', new ItemStack(BlockRegister.LOGS1, 1, 2)});
(new RecipesToolsM()).addRecipes(craftingManager);
(new RecipesWeaponsM()).addRecipes(craftingManager);
(new RecipesArmorM()).addRecipes(craftingManager);
GameRegistry.registerFuelHandler(new FuelHandler());
GameRegistry.addSmelting(BlockRegister.ORE_SILVER, new ItemStack(ItemRegister.INGOT_SILVER, 1), 0.1f);
GameRegistry.addSmelting(BlockRegister.ORE_COMBUSTIUM, new ItemStack(ItemRegister.COMBUSTIUM, 1), 0.1f);
GameRegistry.addSmelting(BlockRegister.ORE_ETHERNIUM, new ItemStack(ItemRegister.ETHERNIUM, 1), 0.1f);
GameRegistry.addSmelting(BlockRegister.ORE_TITANIUM, new ItemStack(ItemRegister.INGOT_TITANIUM, 1), 0.1f);
}
示例2: createItem
import net.minecraft.item.crafting.CraftingManager; //导入方法依赖的package包/类
private void createItem(EntitySheep entity, World worldObj) {
final ContainerWorkbench container = new ContainerWorkbench(new InventoryPlayer(null), worldObj, entity.getPosition());
for (int i = 0; i < 9; ++i) {
container.craftMatrix.setInventorySlotContents(i, itemsConsumed[i]);
}
final CraftingManager instance = CraftingManager.getInstance();
final ItemStack craftedItem = instance.findMatchingRecipe(container.craftMatrix, worldObj);
if (craftedItem != null) {
EntityItem entityItem = new EntityItem(worldObj, entity.posX, entity.posY, entity.posZ, craftedItem);
worldObj.spawnEntityInWorld(entityItem);
entityItem.rotationYaw = entity.renderYawOffset + 180;
entityItem.moveRelative(0, 0.3f, 1);
final ItemStack[] remainingItems = instance.getRemainingItems(container.craftMatrix, worldObj);
for (final ItemStack remainingItem : remainingItems) {
if (remainingItem == null) continue;
entityItem = new EntityItem(worldObj, entity.posX, entity.posY, entity.posZ, remainingItem);
worldObj.spawnEntityInWorld(entityItem);
entityItem.rotationYaw = entity.renderYawOffset + 180;
entityItem.moveRelative(0, 0.3f, 1);
}
}
System.arraycopy(originalCraftingGrid, 0, itemsToCollect, 0, 9);
itemsConsumed = new ItemStack[9];
updateItemsConsumed();
}