port to forestry 4.2

This commit is contained in:
marcin212 committed 2016-10-20 02:56:31 +02:00
1 parent dbc5c1a564
commit f969f63b66
3697 files changed
+78372

No files matched your search

@@ -0,0 +1,72 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.ceramic;
import java.util.List;
import java.util.ArrayList;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import binnie.botany.Botany;
import net.minecraft.world.World;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
public class CeramicTileRecipe implements IRecipe
{
ItemStack cached;
@Override
public boolean matches(final InventoryCrafting inv, final World world) {
this.cached = this.getCraftingResult(inv);
return this.cached != null;
}
@Override
public ItemStack getCraftingResult(final InventoryCrafting inv) {
final Item ceramicBlock = Item.getItemFromBlock(Botany.ceramic);
final Item ceramicTile = Item.getItemFromBlock(Botany.ceramicTile);
final Item ceramicBrick = Item.getItemFromBlock(Botany.ceramicBrick);
final Item mortar = Botany.misc;
final List<ItemStack> stacks = new ArrayList<ItemStack>();
int ix = -1;
int iy = -1;
for (int i = 0; i < inv.getSizeInventory(); ++i) {
final ItemStack stack = inv.getStackInSlot(i);
if (stack != null) {
final int x = i / 3;
final int y = i % 3;
if (ix == -1) {
ix = x;
iy = y;
}
if (x - ix >= 2 || y - iy >= 2 || y < iy || x < ix) {
return null;
}
if (stack.getItem() != ceramicBlock && stack.getItem() != ceramicTile && stack.getItem() != ceramicBrick && stack.getItem() != mortar) {
return null;
}
stacks.add(stack);
}
}
for (final BlockCeramicBrick.TileType type : BlockCeramicBrick.TileType.values()) {
final ItemStack stack2 = type.getRecipe(stacks);
if (stack2 != null) {
return stack2;
}
}
return null;
}
@Override
public int getRecipeSize() {
return 2;
}
@Override
public ItemStack getRecipeOutput() {
return this.cached;
}
}