當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。