本文整理汇总了Java中net.minecraft.inventory.InventoryCrafting.getSizeInventory方法的典型用法代码示例。如果您正苦于以下问题:Java InventoryCrafting.getSizeInventory方法的具体用法?Java InventoryCrafting.getSizeInventory怎么用?Java InventoryCrafting.getSizeInventory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.inventory.InventoryCrafting
的用法示例。
在下文中一共展示了InventoryCrafting.getSizeInventory方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCraftingResult
import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
/**
* Returns an Item that is the result of this recipe
*/
public ItemStack getCraftingResult(InventoryCrafting inv)
{
ItemStack itemstack = this.getRecipeOutput().copy();
if (this.copyIngredientNBT)
{
for (int i = 0; i < inv.getSizeInventory(); ++i)
{
ItemStack itemstack1 = inv.getStackInSlot(i);
if (itemstack1 != null && itemstack1.hasTagCompound())
{
itemstack.setTagCompound((NBTTagCompound)itemstack1.getTagCompound().copy());
}
}
}
return itemstack;
}
示例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: 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() instanceof ItemEditableBook)
{
aitemstack[i] = itemstack;
break;
}
}
return aitemstack;
}
示例4: getCraftingResult
import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
/**
* Returns an Item that is the result of this recipe
*/
@Nullable
public ItemStack getCraftingResult(InventoryCrafting inv)
{
for (int i = 0; i < inv.getSizeInventory(); ++i)
{
ItemStack itemstack = inv.getStackInSlot(i);
if (itemstack != null && TileEntityBanner.getPatterns(itemstack) > 0)
{
ItemStack itemstack1 = itemstack.copy();
itemstack1.stackSize = 1;
return itemstack1;
}
}
return null;
}
示例5: getCraftingResult
import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
/**
* Returns an Item that is the result of this recipe
*/
public ItemStack getCraftingResult(InventoryCrafting inv)
{
ItemStack itemstack = this.getRecipeOutput().copy();
if (this.copyIngredientNBT)
{
for (int i = 0; i < inv.getSizeInventory(); ++i)
{
ItemStack itemstack1 = inv.getStackInSlot(i);
if (!itemstack1.func_190926_b() && itemstack1.hasTagCompound())
{
itemstack.setTagCompound(itemstack1.getTagCompound().copy());
}
}
}
return itemstack;
}
示例6: func_180303_b
import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
public ItemStack[] func_180303_b(InventoryCrafting p_180303_1_, World worldIn)
{
for (IRecipe irecipe : this.recipes)
{
if (irecipe.matches(p_180303_1_, worldIn))
{
return irecipe.getRemainingItems(p_180303_1_);
}
}
ItemStack[] aitemstack = new ItemStack[p_180303_1_.getSizeInventory()];
for (int i = 0; i < aitemstack.length; ++i)
{
aitemstack[i] = p_180303_1_.getStackInSlot(i);
}
return aitemstack;
}
示例7: getCraftingResult
import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
public ItemStack getCraftingResult(InventoryCrafting inv)
{
for (int i = 0; i < inv.getSizeInventory(); ++i)
{
ItemStack itemstack = inv.getStackInSlot(i);
if (!itemstack.func_190926_b() && TileEntityBanner.getPatterns(itemstack) > 0)
{
ItemStack itemstack1 = itemstack.copy();
itemstack1.func_190920_e(1);
return itemstack1;
}
}
return ItemStack.field_190927_a;
}
示例8: 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;
}
示例9: isInMatrix
import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
private boolean isInMatrix(InventoryCrafting matrix, Item item)
{
if (item == null) { return false; } // Can't find what doesn't exist
int counter = 0;
ItemStack stack = matrix.getStackInSlot(counter);
while (counter < matrix.getSizeInventory()) // scouring through the entire thing
{
if (stack != null && stack.getItem().getClass() == item.getClass()) // Found one!
{
if (stack.getItem() instanceof _WeaponBase) // Is a weapon, so need to ensure that it's empty
{
if (stack.getItemDamage() == stack.getMaxDamage()) { return true; }
// else, isn't empty
}
else if (stack.getItem() instanceof _AmmoBase) // is ammo
{
this.metadata = stack.getItemDamage(); // Keeping track of what this is gonna make, so I don't have to constantly recheck
return true;
}
// else, don't care what this is
}
// else, empty. That's fine
// Next!
counter += 1;
stack = matrix.getStackInSlot(counter);
}
return false; // Fallback. Didn't find what I'm looking for
}
示例10: 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;
}
示例11: getCraftingResult
import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
/**
* Returns an Item that is the result of this recipe
*/
public ItemStack getCraftingResult(InventoryCrafting inv)
{
int i = 0;
ItemStack itemstack = ItemStack.field_190927_a;
for (int j = 0; j < inv.getSizeInventory(); ++j)
{
ItemStack itemstack1 = inv.getStackInSlot(j);
if (!itemstack1.func_190926_b())
{
if (itemstack1.getItem() == Items.WRITTEN_BOOK)
{
if (!itemstack.func_190926_b())
{
return ItemStack.field_190927_a;
}
itemstack = itemstack1;
}
else
{
if (itemstack1.getItem() != Items.WRITABLE_BOOK)
{
return ItemStack.field_190927_a;
}
++i;
}
}
}
if (!itemstack.func_190926_b() && itemstack.hasTagCompound() && i >= 1 && ItemWrittenBook.getGeneration(itemstack) < 2)
{
ItemStack itemstack2 = new ItemStack(Items.WRITTEN_BOOK, i);
itemstack2.setTagCompound(itemstack.getTagCompound().copy());
itemstack2.getTagCompound().setInteger("generation", ItemWrittenBook.getGeneration(itemstack) + 1);
if (itemstack.hasDisplayName())
{
itemstack2.setStackDisplayName(itemstack.getDisplayName());
}
return itemstack2;
}
else
{
return ItemStack.field_190927_a;
}
}
示例12: matches
import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
public boolean matches(InventoryCrafting inv, World worldIn)
{
ItemStack itemstack = null;
ItemStack itemstack1 = null;
for (int i = 0; i < inv.getSizeInventory(); ++i)
{
ItemStack itemstack2 = inv.getStackInSlot(i);
if (itemstack2 != null)
{
if (itemstack2.getItem() != Items.banner)
{
return false;
}
if (itemstack != null && itemstack1 != null)
{
return false;
}
int j = TileEntityBanner.getBaseColor(itemstack2);
boolean flag = TileEntityBanner.getPatterns(itemstack2) > 0;
if (itemstack != null)
{
if (flag)
{
return false;
}
if (j != TileEntityBanner.getBaseColor(itemstack))
{
return false;
}
itemstack1 = itemstack2;
}
else if (itemstack1 != null)
{
if (!flag)
{
return false;
}
if (j != TileEntityBanner.getBaseColor(itemstack1))
{
return false;
}
itemstack = itemstack2;
}
else if (flag)
{
itemstack = itemstack2;
}
else
{
itemstack1 = itemstack2;
}
}
}
return itemstack != null && itemstack1 != null;
}
示例13: getCraftingResult
import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
/**
* Returns an Item that is the result of this recipe
*/
public ItemStack getCraftingResult(InventoryCrafting inv)
{
int i = 0;
ItemStack itemstack = ItemStack.field_190927_a;
for (int j = 0; j < inv.getSizeInventory(); ++j)
{
ItemStack itemstack1 = inv.getStackInSlot(j);
if (!itemstack1.func_190926_b())
{
if (itemstack1.getItem() == Items.FILLED_MAP)
{
if (!itemstack.func_190926_b())
{
return ItemStack.field_190927_a;
}
itemstack = itemstack1;
}
else
{
if (itemstack1.getItem() != Items.MAP)
{
return ItemStack.field_190927_a;
}
++i;
}
}
}
if (!itemstack.func_190926_b() && i >= 1)
{
ItemStack itemstack2 = new ItemStack(Items.FILLED_MAP, i + 1, itemstack.getMetadata());
if (itemstack.hasDisplayName())
{
itemstack2.setStackDisplayName(itemstack.getDisplayName());
}
if (itemstack.hasTagCompound())
{
itemstack2.setTagCompound(itemstack.getTagCompound());
}
return itemstack2;
}
else
{
return ItemStack.field_190927_a;
}
}
示例14: getCraftingResult
import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
/**
* Returns an Item that is the result of this recipe
*/
@Nullable
public ItemStack getCraftingResult(InventoryCrafting inv)
{
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().isRepairable())
{
return null;
}
}
}
}
if (list.size() == 2)
{
ItemStack itemstack2 = (ItemStack)list.get(0);
ItemStack itemstack3 = (ItemStack)list.get(1);
if (itemstack2.getItem() == itemstack3.getItem() && itemstack2.stackSize == 1 && itemstack3.stackSize == 1 && itemstack2.getItem().isRepairable())
{
// FORGE: Make itemstack sensitive // Item item = itemstack2.getItem();
int j = itemstack2.getMaxDamage() - itemstack2.getItemDamage();
int k = itemstack2.getMaxDamage() - itemstack3.getItemDamage();
int l = j + k + itemstack2.getMaxDamage() * 5 / 100;
int i1 = itemstack2.getMaxDamage() - l;
if (i1 < 0)
{
i1 = 0;
}
return new ItemStack(itemstack2.getItem(), 1, i1);
}
}
return null;
}