use of net.minecraft.item.ItemStack in project BetterStorage by copygirl.
the class LockColorRecipe method getCraftingResult.
@Override
public ItemStack getCraftingResult(InventoryCrafting crafting) {
ItemStack lock = InventoryUtils.findItem(crafting, BetterStorageItems.lock);
List<ItemStack> dyes = InventoryUtils.findDyes(crafting);
ItemStack result = lock.copy();
// Apply color.
if (dyes.size() > 0) {
int color = DyeUtils.getColorFromDyes(dyes);
if (dyes.size() >= 8)
ItemBetterStorage.setFullColor(result, color);
else
ItemBetterStorage.setColor(result, color);
}
return result;
}
use of net.minecraft.item.ItemStack in project BetterStorage by copygirl.
the class LockRecipe method getCraftingResult.
@Override
public ItemStack getCraftingResult(InventoryCrafting crafting) {
int id = ItemBetterStorage.getID(crafting.getStackInSlot(4));
ItemStack result = getRecipeOutput().copy();
ItemBetterStorage.setID(result, id);
return result;
}
use of net.minecraft.item.ItemStack in project BetterStorage by copygirl.
the class PresentRecipe method createRecipeInput.
private static ItemStack[] createRecipeInput() {
ItemStack box = new ItemStack(BetterStorageTiles.cardboardBox);
ItemStack wool1 = new ItemStack(Blocks.wool, 1, 14);
ItemStack wool2 = new ItemStack(Blocks.wool, 1, 0);
return new ItemStack[] { wool1, wool2, wool1, wool1, box, wool1, wool1, wool2, wool1 };
}
use of net.minecraft.item.ItemStack in project BetterStorage by copygirl.
the class PresentRecipe method checkWoolColor.
private static int checkWoolColor(InventoryCrafting crafting, int... slots) {
int color = -1;
for (int i = 0; i < slots.length; i++) {
int slot = slots[i];
ItemStack stack = crafting.getStackInSlot(slot);
int woolColor;
if (stack == null)
return -1;
else if (stack.getItem() == Item.getItemFromBlock(Blocks.wool))
woolColor = stack.getItemDamage();
else if (stack.getItem() == Item.getItemFromBlock(Blocks.gold_block))
woolColor = 16;
else
return -1;
if (i <= 0)
color = woolColor;
else if (woolColor != color)
return -1;
}
return color;
}
use of net.minecraft.item.ItemStack in project BetterStorage by copygirl.
the class PresentRecipe method getCraftingResult.
@Override
public ItemStack getCraftingResult(InventoryCrafting crafting) {
int colorInner = checkWoolColor(crafting, 0);
int colorOuter = checkWoolColor(crafting, 1);
int leftRight = checkWoolColor(crafting, 3);
boolean skojanzaMode = (leftRight == colorOuter);
ItemStack box = crafting.getStackInSlot(4);
ItemStack present = new ItemStack(BetterStorageTiles.present);
NBTTagCompound compound = (NBTTagCompound) box.getTagCompound().copy();
compound.setByte(TileEntityPresent.TAG_COLOR_INNER, (byte) colorInner);
compound.setByte(TileEntityPresent.TAG_COLOR_OUTER, (byte) colorOuter);
compound.setBoolean(TileEntityPresent.TAG_SKOJANZA_MODE, skojanzaMode);
int color = StackUtils.get(box, -1, "display", "color");
if (color >= 0)
compound.setInteger("color", color);
present.setTagCompound(compound);
StackUtils.remove(present, "display", "color");
return present;
}
Aggregations