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


Java InventoryCrafting.setInventorySlotContents方法代码示例

本文整理汇总了Java中net.minecraft.inventory.InventoryCrafting.setInventorySlotContents方法的典型用法代码示例。如果您正苦于以下问题:Java InventoryCrafting.setInventorySlotContents方法的具体用法?Java InventoryCrafting.setInventorySlotContents怎么用?Java InventoryCrafting.setInventorySlotContents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.inventory.InventoryCrafting的用法示例。


在下文中一共展示了InventoryCrafting.setInventorySlotContents方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCraftingGrid

import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
@Override
public InventoryCrafting getCraftingGrid() {
    InventoryCrafting invCrafting = new InventoryCrafting(new Container() {
        @Override
        public boolean canInteractWith(EntityPlayer p_75145_1_) {
            return false;
        }

    }, 3, 3);
    for (int y = 0; y < 3; y++) {
        ProgWidgetItemFilter itemFilter = (ProgWidgetItemFilter) getConnectedParameters()[y];
        for (int x = 0; x < 3 && itemFilter != null; x++) {
            invCrafting.setInventorySlotContents(y * 3 + x, itemFilter.getFilter());
            itemFilter = (ProgWidgetItemFilter) itemFilter.getConnectedParameters()[0];
        }
    }
    return invCrafting;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:19,代码来源:ProgWidgetCrafting.java

示例2: test_useUpItem

import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
@Test
public void test_useUpItem()
{
    DamageableShapelessOreRecipe recipe = new DamageableShapelessOreRecipe(new ResourceLocation("group"),
                                                                           new int[] {60}, new ItemStack(Blocks.DIRT), new ItemStack(Items.WOODEN_SWORD));
    InventoryCrafting inv = new InventoryCrafting(new Container()
    {
        @Override
        public boolean canInteractWith(EntityPlayer playerIn)
        {
            return false;
        }
    }, 3, 3);
    inv.setInventorySlotContents(3, new ItemStack(Items.WOODEN_SWORD));

    assertTrue(recipe.matches(inv, null));
    NonNullList<ItemStack> remaining = recipe.getRemainingItems(inv);
    assertTrue(remaining.get(3).isEmpty());
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:20,代码来源:DamageableShapelessOreRecipeTest.java

示例3: doTest

import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
private void doTest(boolean inOrder, boolean enoughDamage)
{
    DamageableShapelessOreRecipe recipe = new DamageableShapelessOreRecipe(new ResourceLocation("group"),
                                                                           new int[] {enoughDamage ? 5 : 5000, 0},
                                                                           new ItemStack(Blocks.DIRT), new ItemStack(Items.WOODEN_SWORD), new ItemStack(Items.APPLE));
    InventoryCrafting inv = new InventoryCrafting(new Container()
    {
        @Override
        public boolean canInteractWith(EntityPlayer playerIn)
        {
            return false;
        }
    }, 3, 3);
    inv.setInventorySlotContents(inOrder ? 3 : 4, new ItemStack(Items.WOODEN_SWORD));
    inv.setInventorySlotContents(inOrder ? 4 : 3, new ItemStack(Items.APPLE));

    assertSame(enoughDamage, recipe.matches(inv, null));

    if (enoughDamage)
    {
        NonNullList<ItemStack> remaining = recipe.getRemainingItems(inv);
        assertSame(Items.WOODEN_SWORD, remaining.get(inOrder ? 3 : 4).getItem());
        assertEquals(5, remaining.get(inOrder ? 3 : 4).getItemDamage());
    }
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:26,代码来源:DamageableShapelessOreRecipeTest.java

示例4: test_useUpItem

import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
@Test
public void test_useUpItem()
{
    ShapedOreRecipe recipe = new DamageableShapedOreRecipe(new ResourceLocation("group"),
                                                           new int[] {60}, new ItemStack(Blocks.DIRT),
                                                           "A",
                                                           'A', new ItemStack(Items.WOODEN_SWORD));

    InventoryCrafting inv = new InventoryCrafting(new Container()
    {
        @Override
        public boolean canInteractWith(EntityPlayer playerIn)
        {
            return false;
        }
    }, 3, 3);

    inv.setInventorySlotContents(0, new ItemStack(Items.WOODEN_SWORD));
    assertTrue(recipe.matches(inv, null));

    NonNullList<ItemStack> remaining = recipe.getRemainingItems(inv);
    assertTrue(remaining.get(0).isEmpty());
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:24,代码来源:DamageableShapedOreRecipeTest.java

示例5: canCraft

import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
public boolean canCraft() {
	if(currentEnergy <= 0) {
		FMLLog.log(Level.INFO, "Ba");
		currentEnergy = 0;
		return false;
	} else {
		FMLLog.log(Level.INFO, "Bb");
		InventoryCrafting inv = new InventoryCrafting(new ContainerAutoWorkBench(new InventoryPlayer(null), this), 3, 3);
		for(int i = 1; i < machineItemStacks.length - 1; i++) {
			inv.setInventorySlotContents(i - 1, machineItemStacks[i - 1]);
			FMLLog.log(Level.INFO, "Bc" + (i - 1));
		}
		ItemStack stack = AutoWorkBenchRecipes.smelting().getSmeltingResult(inv, worldObj, Tier.normal)[0];
		FMLLog.log(Level.INFO, "Bd" + (stack != null));
		return stack != null;
	}
}
 
开发者ID:viddeno,项目名称:Technical,代码行数:18,代码来源:TileEntityAutoWorkBench.java

示例6: getCraftingGrid

import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
@Override
public InventoryCrafting getCraftingGrid() {
    InventoryCrafting invCrafting = new InventoryCrafting(new Container() {
        @Override
        public boolean canInteractWith(EntityPlayer p_75145_1_) {
            return false;
        }
    }, 3, 3);
    for (int i = 0; i < 9; i++)
        invCrafting.setInventorySlotContents(i, craftingGrid[i]);
    return invCrafting;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:13,代码来源:ProgWidgetCC.java

示例7: findOutput

import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
public static ItemStack findOutput(int size, ItemStack input, World world) {
    InventoryCrafting inventoryCrafting = new InventoryCrafting(new Container() {
        @Override
        public boolean canInteractWith(EntityPlayer playerIn) {
            return false;
        }
    }, size, size);
    for (int i = 0; i < size * size; ++i) {
        inventoryCrafting.setInventorySlotContents(i, input.copy());
    }
    return CraftingManager.findMatchingResult(inventoryCrafting, world);
}
 
开发者ID:Buuz135,项目名称:Industrial-Foregoing,代码行数:13,代码来源:CraftingUtils.java

示例8: genCraftingInventory

import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
public static InventoryCrafting genCraftingInventory(World world, ItemStack... inputs) {
    InventoryCrafting inventoryCrafting = new InventoryCrafting(new Container() {
        @Override
        public boolean canInteractWith(EntityPlayer playerIn) {
            return false;
        }
    }, 3, 3);
    for (int i = 0; i < 9; ++i) {
        inventoryCrafting.setInventorySlotContents(i, inputs[i]);
    }
    return inventoryCrafting;
}
 
开发者ID:Buuz135,项目名称:Industrial-Foregoing,代码行数:13,代码来源:CraftingUtils.java

示例9: doTest

import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
private void doTest(boolean mirror, boolean enoughDamage)
{
    ShapedOreRecipe recipe = new DamageableShapedOreRecipe(new ResourceLocation("group"),
                                                           new int[] {0, 0, enoughDamage ? 5 : 5000, 0}, new ItemStack(Blocks.DIRT),
                                                           "AA", "BA",
                                                           'A', new ItemStack(Blocks.DIRT),
                                                           'B', new ItemStack(Items.WOODEN_SWORD))
            .setMirrored(mirror);

    InventoryCrafting inv = new InventoryCrafting(new Container()
    {
        @Override
        public boolean canInteractWith(EntityPlayer playerIn)
        {
            return false;
        }
    }, 3, 3);
    inv.setInventorySlotContents(4, new ItemStack(Blocks.DIRT));
    inv.setInventorySlotContents(5, new ItemStack(Blocks.DIRT));
    inv.setInventorySlotContents(mirror ? 8 : 7, new ItemStack(Items.WOODEN_SWORD));
    inv.setInventorySlotContents(mirror ? 7 : 8, new ItemStack(Blocks.DIRT));

    assertSame(enoughDamage, recipe.matches(inv, null));

    if (enoughDamage)
    {
        NonNullList<ItemStack> remaining = recipe.getRemainingItems(inv);
        assertSame(Items.WOODEN_SWORD, remaining.get(mirror ? 8 : 7).getItem());
        assertEquals(5, remaining.get(mirror ? 8 : 7).getItemDamage());
    }
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:32,代码来源:DamageableShapedOreRecipeTest.java

示例10: craftItem

import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
public boolean craftItem() {
	InventoryCrafting inv = new InventoryCrafting(new ContainerAutoWorkBench(null, this), 3, 3);
	for(int i = 1; i < machineItemStacks.length - 1; i++) {
		inv.setInventorySlotContents(i - 1, machineItemStacks[i - 1]);
		FMLLog.log(Level.INFO, "E" + (i - 1));
	}
	ItemStack result = AutoWorkBenchRecipes.smelting().getSmeltingResult(inv, worldObj, Tier.normal)[0];
	if(canCraft() && result != null && (machineItemStacks[10] == null || result.isItemEqual(machineItemStacks[10]))) {
		FMLLog.log(Level.INFO, "F");
		if(machineItemStacks[10] == null) {
			FMLLog.log(Level.INFO, "G");
			machineItemStacks[10] = result;
		} else {
			FMLLog.log(Level.INFO, "H");
			machineItemStacks[10].stackSize++;
		}
		for(int i = 1; i < machineItemStacks.length; i++) {
			FMLLog.log(Level.INFO, "I" + 1);
			if(machineItemStacks[i] != null) {
				FMLLog.log(Level.INFO, "J");
				machineItemStacks[i].stackSize--;
				if(machineItemStacks[i].stackSize <= 0) {
					FMLLog.log(Level.INFO, "K");
					machineItemStacks[i] = null;
				}
			}
		}
		FMLLog.log(Level.INFO, "L");
		return true;	
	}
	FMLLog.log(Level.INFO, "M");
	return false;
}
 
开发者ID:viddeno,项目名称:Technical,代码行数:34,代码来源:TileEntityAutoWorkBench.java

示例11: shouldExecute

import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
@Override
public boolean shouldExecute() {
    IRecipe recipe = ProgWidgetCrafting.getRecipe(drone.world(), widget);
    if (recipe == null) return false;
    InventoryCrafting craftingGrid = widget.getCraftingGrid();
    for (int crafted = 0; !((ICountWidget) widget).useCount() || crafted < ((ICountWidget) widget).getCount(); crafted++) {
        List<ItemStack>[] equivalentsList = new List[9];
        for (int i = 0; i < equivalentsList.length; i++) {
            ItemStack originalStack = craftingGrid.getStackInSlot(i);
            if (!originalStack.isEmpty()) {
                List<ItemStack> equivalents = new ArrayList<>();
                for (int j = 0; j < drone.getInv().getSlots(); j++) {
                    ItemStack droneStack = drone.getInv().getStackInSlot(j);
                    if (!droneStack.isEmpty() && (droneStack.getItem() == originalStack.getItem() || PneumaticCraftUtils.isSameOreDictStack(droneStack, originalStack))) {
                        equivalents.add(droneStack);
                    }
                }
                if (equivalents.isEmpty()) return false;
                equivalentsList[i] = equivalents;
            }
        }

        int[] curIndexes = new int[9];
        boolean first = true;
        boolean hasCrafted = false;
        while (first || count(curIndexes, equivalentsList)) {
            first = false;
            InventoryCrafting craftMatrix = new InventoryCrafting(new Container() {
                @Override
                public boolean canInteractWith(EntityPlayer p_75145_1_) {
                    return false;
                }

            }, 3, 3);
            for (int i = 0; i < 9; i++) {
                ItemStack stack = equivalentsList[i] == null ? ItemStack.EMPTY : equivalentsList[i].get(curIndexes[i]);
                craftMatrix.setInventorySlotContents(i, stack);
            }
            if (recipe.matches(craftMatrix, drone.world())) {
                if (craft(recipe.getCraftingResult(craftMatrix), craftMatrix)) {
                    hasCrafted = true;
                    break;
                }
            }
        }
        if (!hasCrafted) return false;
    }
    return false;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:50,代码来源:ProgWidgetCrafting.java


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