本文整理汇总了Java中net.minecraft.inventory.InventoryCrafting.getStackInSlot方法的典型用法代码示例。如果您正苦于以下问题:Java InventoryCrafting.getStackInSlot方法的具体用法?Java InventoryCrafting.getStackInSlot怎么用?Java InventoryCrafting.getStackInSlot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.inventory.InventoryCrafting
的用法示例。
在下文中一共展示了InventoryCrafting.getStackInSlot方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRemainingItems
import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv)
{
NonNullList<ItemStack> nonnulllist = NonNullList.<ItemStack>func_191197_a(inv.getSizeInventory(), ItemStack.field_190927_a);
for (int i = 0; i < nonnulllist.size(); ++i)
{
ItemStack itemstack = inv.getStackInSlot(i);
if (itemstack.getItem().hasContainerItem())
{
nonnulllist.set(i, new ItemStack(itemstack.getItem().getContainerItem()));
}
}
return nonnulllist;
}
示例2: getRemainingItems
import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
public ItemStack[] getRemainingItems(InventoryCrafting inv)
{
ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()];
for (int i = 0; i < aitemstack.length; ++i)
{
ItemStack itemstack = inv.getStackInSlot(i);
if (itemstack != null && itemstack.getItem().hasContainerItem())
{
aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem());
}
}
return aitemstack;
}
示例3: getAAFromMatrix
import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
private ItemStack getAAFromMatrix(InventoryCrafting matrix)
{
int counter = 0;
while (counter < matrix.getSizeInventory())
{
if (matrix.getStackInSlot(counter) != null && matrix.getStackInSlot(counter).getItem() instanceof PackedUpAA)
{
return matrix.getStackInSlot(counter); // Found it
}
counter += 1;
}
return null;
}
示例4: getRemainingItems
import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv)
{
NonNullList<ItemStack> nonnulllist = NonNullList.<ItemStack>func_191197_a(inv.getSizeInventory(), ItemStack.field_190927_a);
for (int i = 0; i < nonnulllist.size(); ++i)
{
ItemStack itemstack = inv.getStackInSlot(i);
if (!itemstack.func_190926_b())
{
if (itemstack.getItem().hasContainerItem())
{
nonnulllist.set(i, new ItemStack(itemstack.getItem().getContainerItem()));
}
else if (itemstack.hasTagCompound() && TileEntityBanner.getPatterns(itemstack) > 0)
{
ItemStack itemstack1 = itemstack.copy();
itemstack1.func_190920_e(1);
nonnulllist.set(i, itemstack1);
}
}
}
return nonnulllist;
}
示例5: matches
import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
@Override
public boolean matches(InventoryCrafting inv, World worldIn) {
int slots = inv.getHeight() * inv.getWidth();
int center = (int) ((float)slots / 2F);
ItemStack checked = inv.getStackInSlot(center);
if(checked.isEmpty() || !checked.hasTagCompound()) return false;
int amount = 0;
for(int j = 0; j < slots; j++) {
ItemStack stack = inv.getStackInSlot(j);
if(!stack.isEmpty() && (!hasTag(stack) || stack.getItem() != checked.getItem())) return false;
if(!stack.isEmpty() && j != center) {
amount++;
}
}
return amount > 0;
}
示例6: getCraftingResult
import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
@Override
public ItemStack getCraftingResult(InventoryCrafting inv) {
ItemStack inputSlaw = inv.getStackInSlot(0);
byte additions = 0;
if (inputSlaw.hasTagCompound()) {
additions = inputSlaw.getTagCompound().getByte("additions");
}
additions += 1;
ItemStack outputStack = new ItemStack(ModItems.simic_slaw);
outputStack.setTagCompound(new NBTTagCompound());
outputStack.getTagCompound().setByte("additions", additions);
return outputStack;
}
示例7: matches
import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
@Override
public boolean matches(InventoryCrafting inv, World worldIn) {
int count = 0;
boolean forge = false;
for (int i = 0; i < inv.getSizeInventory(); i++) {
ItemStack stack = inv.getStackInSlot(i);
if(!stack.isEmpty()) {
if(stack.getItem() instanceof ItemBlock && ((ItemBlock) stack.getItem()).getBlock() instanceof CraftiniumForge) {
if(forge && !this.combining) {
return false;
} else {
forge = true;
if(!stack.hasTagCompound() || stack.getSubCompound("randores") == null || !stack.getSubCompound("randores").hasKey("furnace_speed")) {
return false;
}
}
} else if (this.upgrades.keySet().stream().noneMatch(k -> k.apply(stack))) {
return false;
}
count++;
}
}
return count >= 2 && forge;
}
示例8: matches
import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
@Override
public boolean matches(InventoryCrafting inv, World worldIn)
{
ItemStack tempStack = ItemStack.EMPTY;
if (VALID_ITEMS == null) buildValidItemsArray();
int potionEffects = 0;
for (int i = 0; i < inv.getSizeInventory(); i++)
{
ItemStack stack = inv.getStackInSlot(i);
if (!stack.isEmpty())
{
Item item = stack.getItem();
if (!ArrayUtils.contains(VALID_ITEMS, item)) return false;
if (tempStack.isEmpty())
{
tempStack = stack.copy();
}
else
{
if (!canCombineItems(tempStack, stack)) return false;
}
if (ModConfiguration.maxPotionEffects >= 0)
{
potionEffects += getEffectsFromStack(stack).size();
if (potionEffects > ModConfiguration.maxPotionEffects) return false;
}
}
}
return true;
}
示例9: matches
import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
/**
* Used to check if a recipe matches current crafting inventory
*/
public boolean matches(InventoryCrafting inv, World worldIn)
{
if (!super.matches(inv, worldIn))
{
return false;
}
else
{
ItemStack itemstack = ItemStack.field_190927_a;
for (int i = 0; i < inv.getSizeInventory() && itemstack.func_190926_b(); ++i)
{
ItemStack itemstack1 = inv.getStackInSlot(i);
if (itemstack1.getItem() == Items.FILLED_MAP)
{
itemstack = itemstack1;
}
}
if (itemstack.func_190926_b())
{
return false;
}
else
{
MapData mapdata = Items.FILLED_MAP.getMapData(itemstack, worldIn);
return mapdata == null ? false : (this.func_190934_a(mapdata) ? false : mapdata.scale < 4);
}
}
}
示例10: matches
import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
/**
* Used to check if a recipe matches current crafting inventory
*/
public boolean matches(InventoryCrafting inv, World worldIn)
{
int i = 0;
ItemStack itemstack = null;
for (int j = 0; j < inv.getSizeInventory(); ++j)
{
ItemStack itemstack1 = inv.getStackInSlot(j);
if (itemstack1 != null)
{
if (itemstack1.getItem() == Items.filled_map)
{
if (itemstack != null)
{
return false;
}
itemstack = itemstack1;
}
else
{
if (itemstack1.getItem() != Items.map)
{
return false;
}
++i;
}
}
}
return itemstack != null && i > 0;
}
示例11: matches
import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
/**
* Used to check if a recipe matches current crafting inventory
*/
public boolean matches(InventoryCrafting inv, World worldIn)
{
if (!super.matches(inv, worldIn))
{
return false;
}
else
{
ItemStack itemstack = null;
for (int i = 0; i < inv.getSizeInventory() && itemstack == null; ++i)
{
ItemStack itemstack1 = inv.getStackInSlot(i);
if (itemstack1 != null && itemstack1.getItem() == Items.filled_map)
{
itemstack = itemstack1;
}
}
if (itemstack == null)
{
return false;
}
else
{
MapData mapdata = Items.filled_map.getMapData(itemstack, worldIn);
return mapdata == null ? false : mapdata.scale < 4;
}
}
}
示例12: getRemainingItems
import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
public ItemStack[] getRemainingItems(InventoryCrafting inv)
{
ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()];
for (int i = 0; i < aitemstack.length; ++i)
{
ItemStack itemstack = inv.getStackInSlot(i);
aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack);
}
return aitemstack;
}
示例13: findHelmet
import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
private ItemStack findHelmet(InventoryCrafting inv) {
for (int i = 0; i < inv.getSizeInventory(); i++) {
if (inv.getStackInSlot(i).getItem() == Itemss.PNEUMATIC_HELMET) {
return inv.getStackInSlot(i);
}
}
return ItemStack.EMPTY;
}
示例14: matches
import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
/**
* Used to check if a recipe matches current crafting inventory
*/
public boolean matches(InventoryCrafting inv, World worldIn)
{
ItemStack itemstack = null;
List<ItemStack> list = Lists.<ItemStack>newArrayList();
for (int i = 0; i < inv.getSizeInventory(); ++i)
{
ItemStack itemstack1 = inv.getStackInSlot(i);
if (itemstack1 != null)
{
if (itemstack1.getItem() instanceof ItemArmor)
{
ItemArmor itemarmor = (ItemArmor)itemstack1.getItem();
if (itemarmor.getArmorMaterial() != ItemArmor.ArmorMaterial.LEATHER || itemstack != null)
{
return false;
}
itemstack = itemstack1;
}
else
{
if (itemstack1.getItem() != Items.dye)
{
return false;
}
list.add(itemstack1);
}
}
}
return itemstack != null && !list.isEmpty();
}
示例15: matches
import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
/**
* Used to check if a recipe matches current crafting inventory
*/
public boolean matches(InventoryCrafting inv, World worldIn)
{
List<ItemStack> list = Lists.<ItemStack>newArrayList();
for (int i = 0; i < inv.getSizeInventory(); ++i)
{
ItemStack itemstack = inv.getStackInSlot(i);
if (itemstack != null)
{
list.add(itemstack);
if (list.size() > 1)
{
ItemStack itemstack1 = (ItemStack)list.get(0);
if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isDamageable())
{
return false;
}
}
}
}
return list.size() == 2;
}