Advertisement
Guest User

Untitled

a guest
Dec 27th, 2015
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.82 KB | None | 0 0
  1. package com.nitrodev.warehousestorage.recipes.custom;
  2.  
  3.  
  4. import com.google.common.primitives.Ints;
  5. import com.nitrodev.warehousestorage.items.ModItems;
  6. import net.minecraft.init.Blocks;
  7. import net.minecraft.init.Items;
  8. import net.minecraft.inventory.InventoryCrafting;
  9. import net.minecraft.item.Item;
  10. import net.minecraft.item.ItemSlab;
  11. import net.minecraft.item.ItemStack;
  12. import net.minecraft.item.crafting.IRecipe;
  13. import net.minecraft.world.World;
  14. import net.minecraftforge.oredict.OreDictionary;
  15.  
  16. public class PlankRecipe implements IRecipe {
  17.  
  18.     @Override
  19.     public boolean matches(InventoryCrafting inventoryCrafting, World world) {
  20.         ItemStack saw = null;
  21.         ItemStack slab = null;
  22.  
  23.         for (int i = 0; i < inventoryCrafting.getSizeInventory(); ++i) {
  24.             ItemStack stackInSlot = inventoryCrafting.getStackInSlot(i);
  25.  
  26.             if (stackInSlot != null) {
  27.                 if (stackInSlot.getItem() == ModItems.itemSaw) {
  28.                     if (saw != null) return false;
  29.                     saw = stackInSlot;
  30.                 }
  31.                 if (stackInSlot.getItem() == Item.getItemFromBlock(Blocks.wooden_slab)) {
  32.                     if (slab != null) return false;
  33.                     slab = stackInSlot;
  34.                 }
  35.  
  36.             }
  37.  
  38.         }
  39.         return saw != null && slab != null;
  40.     }
  41.  
  42.     @Override
  43.     public ItemStack getCraftingResult(InventoryCrafting inventoryCrafting) {
  44.         return getRecipeOutput().copy();
  45.     }
  46.  
  47.     @Override
  48.     public int getRecipeSize() {
  49.         return 4;
  50.     }
  51.  
  52.     @Override
  53.     public ItemStack getRecipeOutput() {
  54.         return new ItemStack(ModItems.itemPlank);
  55.     }
  56.  
  57.     @Override
  58.     public ItemStack[] getRemainingItems(InventoryCrafting inventoryCrafting) {
  59.         return new ItemStack[0];
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement