当前位置: 首页>>代码示例>>Java>>正文


Java CraftingManager.getInstance方法代码示例

本文整理汇总了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);


}
 
开发者ID:GhostMonk3408,项目名称:MidgarCrusade,代码行数:25,代码来源:CraftRegister.java

示例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();
}
 
开发者ID:AtomicBlom,项目名称:ShearMadness,代码行数:29,代码来源:FollowAutoCraftItems.java


注:本文中的net.minecraft.item.crafting.CraftingManager.getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。