本文整理汇总了Java中thaumcraft.api.ThaumcraftApiHelper.getStackInRowAndColumn方法的典型用法代码示例。如果您正苦于以下问题:Java ThaumcraftApiHelper.getStackInRowAndColumn方法的具体用法?Java ThaumcraftApiHelper.getStackInRowAndColumn怎么用?Java ThaumcraftApiHelper.getStackInRowAndColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thaumcraft.api.ThaumcraftApiHelper
的用法示例。
在下文中一共展示了ThaumcraftApiHelper.getStackInRowAndColumn方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkMatch
import thaumcraft.api.ThaumcraftApiHelper; //导入方法依赖的package包/类
private boolean checkMatch(IInventory inv, int startX, int startY, boolean mirror) {
for (int x = 0; x < MAX_CRAFT_GRID_WIDTH; x++ ) {
for (int y = 0; y < MAX_CRAFT_GRID_HEIGHT; y++ ) {
int subX = x - startX;
int subY = y - startY;
Object target = null;
if ( (subX >= 0) && (subY >= 0) && (subX < width) && (subY < height)) {
if (mirror) {
target = input[ (width - subX - 1) + (subY * width)];
}
else {
target = input[subX + (subY * width)];
}
}
ItemStack slot = ThaumcraftApiHelper.getStackInRowAndColumn(inv, x, y);
if (target instanceof ItemStack) {
if (!checkItemEquals((ItemStack) target, slot)) {
return false;
}
}
else if (target instanceof ArrayList) {
boolean matched = false;
for (ItemStack item : (ArrayList<ItemStack>) target) {
matched = matched || checkItemEquals(item, slot);
}
if (!matched) {
return false;
}
}
else if ( (target == null) && (slot != null)) {
return false;
}
}
}
return true;
}
示例2: checkMatch
import thaumcraft.api.ThaumcraftApiHelper; //导入方法依赖的package包/类
private boolean checkMatch(IInventory inv, int startX, int startY, boolean mirror) {
for (int x = 0; x < MAX_CRAFT_GRID_WIDTH; x++) {
for (int y = 0; y < MAX_CRAFT_GRID_HEIGHT; y++) {
int subX = x - startX;
int subY = y - startY;
Object target = null;
if (subX >= 0 && subY >= 0 && subX < width && subY < height) {
if (mirror) {
target = input[width - subX - 1 + subY * width];
} else {
target = input[subX + subY * width];
}
}
ItemStack slot = ThaumcraftApiHelper.getStackInRowAndColumn(inv, x, y);
if (target instanceof ItemStack) {
if (!checkItemEquals((ItemStack) target, slot)) {
return false;
}
} else if (target instanceof ArrayList) {
boolean matched = false;
for (ItemStack item : (ArrayList<ItemStack>) target) {
matched = matched || checkItemEquals(item, slot);
}
if (!matched) {
return false;
}
} else if (target == null && slot != null) {
return false;
}
}
}
return true;
}
示例3: checkMatch
import thaumcraft.api.ThaumcraftApiHelper; //导入方法依赖的package包/类
private boolean checkMatch(IInventory inv, int startX, int startY, boolean mirror) {
for (int x = 0; x < MAX_CRAFT_GRID_WIDTH; x++) {
for (int y = 0; y < MAX_CRAFT_GRID_HEIGHT; y++) {
int subX = x - startX;
int subY = y - startY;
Object target = null;
if (subX >= 0 && subY >= 0 && subX < width && subY < height) {
if (mirror) {
target = input[width - subX - 1 + subY * width];
} else {
target = input[subX + subY * width];
}
}
ItemStack slot = ThaumcraftApiHelper.getStackInRowAndColumn(inv, x, y);
if (target instanceof ItemStack) {
if (!checkItemEquals((ItemStack) target, slot)) {
return false;
}
} else if (target instanceof ArrayList) {
boolean matched = false;
for (ItemStack item : (ArrayList<ItemStack>) target) {
matched = matched || checkItemEquals(item, slot);
}
if (!matched) {
return false;
}
} else if (target == null && slot != null) {
return false;
}
}
}
return true;
}
示例4: checkMatch
import thaumcraft.api.ThaumcraftApiHelper; //导入方法依赖的package包/类
private boolean checkMatch(IInventory inv, int startX, int startY, boolean mirror)
{
for (int x = 0; x < MAX_CRAFT_GRID_WIDTH; x++)
{
for (int y = 0; y < MAX_CRAFT_GRID_HEIGHT; y++)
{
int subX = x - startX;
int subY = y - startY;
Object target = null;
if (subX >= 0 && subY >= 0 && subX < width && subY < height)
{
if (mirror)
{
target = input[width - subX - 1 + subY * width];
}
else
{
target = input[subX + subY * width];
}
}
ItemStack slot = ThaumcraftApiHelper.getStackInRowAndColumn(inv, x, y);
if (target instanceof ItemStack)
{
if (!checkItemEquals((ItemStack)target, slot))
{
return false;
}
}
else if (target instanceof ArrayList)
{
boolean matched = false;
for (ItemStack item : (ArrayList<ItemStack>)target)
{
matched = matched || checkItemEquals(item, slot);
}
if (!matched)
{
return false;
}
}
else if (target == null && slot != null)
{
return false;
}
}
}
return true;
}
示例5: checkMatch
import thaumcraft.api.ThaumcraftApiHelper; //导入方法依赖的package包/类
private boolean checkMatch(IInventory inv, int startX, int startY, boolean mirror)
{
for(int x = 0; x < MAX_CRAFT_GRID_WIDTH; x++)
{
for(int y = 0; y < MAX_CRAFT_GRID_HEIGHT; y++)
{
int subX = x - startX;
int subY = y - startY;
Object target = null;
if(subX >= 0 && subY >= 0 && subX < width && subY < height)
{
if(mirror)
{
target = input[width - subX - 1 + subY * width];
}
else
{
target = input[subX + subY * width];
}
}
ItemStack slot = ThaumcraftApiHelper.getStackInRowAndColumn(inv, x, y);
if(target instanceof ItemStack)
{
if(!checkItemEquals((ItemStack) target, slot))
{
return false;
}
}
else if(target instanceof ArrayList)
{
boolean matched = false;
for(ItemStack item : (ArrayList<ItemStack>) target)
{
matched = matched || checkItemEquals(item, slot);
}
if(!matched)
{
return false;
}
}
else if(target == null && slot != null)
{
return false;
}
}
}
return true;
}
示例6: checkMatch
import thaumcraft.api.ThaumcraftApiHelper; //导入方法依赖的package包/类
/**
* Checks if the region of a crafting inventory is match for the recipe.
*/
private boolean checkMatch(IInventory par1InventoryCrafting, int par2, int par3, boolean par4)
{
for (int var5 = 0; var5 < 3; ++var5)
{
for (int var6 = 0; var6 < 3; ++var6)
{
int var7 = var5 - par2;
int var8 = var6 - par3;
ItemStack var9 = null;
if (var7 >= 0 && var8 >= 0 && var7 < this.recipeWidth && var8 < this.recipeHeight)
{
if (par4)
{
var9 = this.recipeItems[this.recipeWidth - var7 - 1 + var8 * this.recipeWidth];
}
else
{
var9 = this.recipeItems[var7 + var8 * this.recipeWidth];
}
}
ItemStack var10 = ThaumcraftApiHelper.getStackInRowAndColumn(par1InventoryCrafting, var5, var6);
if (var10 != null || var9 != null)
{
if (var10 == null && var9 != null || var10 != null && var9 == null)
{
return false;
}
if (var9.itemID != var10.itemID)
{
return false;
}
if (var9.getItemDamage() != -1 && var9.getItemDamage() != var10.getItemDamage())
{
return false;
}
if (var9.hasTagCompound()) {
NBTTagCompound tc = var9.getTagCompound();
for (Object tag:tc.getTags().toArray()) {
NBTBase base = (NBTBase)tag;
Class nc = NBTBase.newTag(base.getId(), base.getName()).getClass();
if (!(var10.hasTagCompound() &&
nc.cast(var10.getTagCompound().getTag(base.getName())).equals(nc.cast(base)))) {
return false;
}
}
}
}
}
}
return true;
}
示例7: matches
import thaumcraft.api.ThaumcraftApiHelper; //导入方法依赖的package包/类
/**
* Used to check if a recipe matches current crafting inventory
*/
public boolean matches(IInventory par1InventoryCrafting, EntityPlayer player)
{
if (key.length()>0 && !ThaumcraftApiHelper.isResearchComplete(player.username, key)) {
return false;
}
ArrayList var2 = new ArrayList(this.recipeItems);
for (int var3 = 0; var3 < 3; ++var3)
{
for (int var4 = 0; var4 < 3; ++var4)
{
ItemStack var5 = ThaumcraftApiHelper.getStackInRowAndColumn(par1InventoryCrafting, var4, var3);
if (var5 != null)
{
boolean var6 = false;
Iterator var7 = var2.iterator();
b1:
while (var7.hasNext())
{
ItemStack var8 = (ItemStack)var7.next();
if (var5.itemID == var8.itemID && (var8.getItemDamage() == -1 || var5.getItemDamage() == var8.getItemDamage()))
{
for (NBTBase nbt:nbtList) {
try {
Class nc = NBTBase.newTag(nbt.getId(), nbt.getName()).getClass();
if (var5.hasTagCompound() &&
nc.cast(var5.getTagCompound().getTag(nbt.getName())).equals(nc.cast(nbt))) {
var6 = true;
var2.remove(var8);
break b1;
}
} catch (Exception e) {/*probably classcast*/}
}
}
}
if (!var6)
{
return false;
}
}
}
}
return var2.isEmpty();
}
示例8: checkMatch
import thaumcraft.api.ThaumcraftApiHelper; //导入方法依赖的package包/类
/**
* Checks if the region of a crafting inventory is match for the recipe.
*/
private boolean checkMatch(IInventory par1InventoryCrafting, int par2, int par3, boolean par4)
{
for (int var5 = 0; var5 < 3; ++var5)
{
for (int var6 = 0; var6 < 3; ++var6)
{
int var7 = var5 - par2;
int var8 = var6 - par3;
ItemStack var9 = null;
if (var7 >= 0 && var8 >= 0 && var7 < this.recipeWidth && var8 < this.recipeHeight)
{
if (par4)
{
var9 = this.recipeItems[this.recipeWidth - var7 - 1 + var8 * this.recipeWidth];
}
else
{
var9 = this.recipeItems[var7 + var8 * this.recipeWidth];
}
}
ItemStack var10 = ThaumcraftApiHelper.getStackInRowAndColumn(par1InventoryCrafting, var5, var6);
if (var10 != null || var9 != null)
{
if (var10 == null && var9 != null || var10 != null && var9 == null)
{
return false;
}
if (var9.itemID != var10.itemID)
{
return false;
}
if (var9.getItemDamage() != -1 && var9.getItemDamage() != var10.getItemDamage())
{
return false;
}
if (var9.hasTagCompound()) {
NBTTagCompound tc = var9.getTagCompound();
for (Object tag:tc.getTags().toArray()) {
NBTBase base = (NBTBase)tag;
Class nc = NBTBase.newTag(base.getId(), base.getName()).getClass();
if (!(var10.hasTagCompound() &&
nc.cast(var10.getTagCompound().getTag(base.getName())).equals(nc.cast(base)))) {
return false;
}
}
}
}
}
}
return true;
}