Advertisement
Guest User

Untitled

a guest
Jan 18th, 2016
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.81 KB | None | 0 0
  1. import cpw.mods.fml.common.registry.GameRegistry;
  2. import net.minecraft.init.Blocks;
  3. import net.minecraft.init.Items;
  4. import net.minecraft.inventory.InventoryCrafting;
  5. import net.minecraft.item.Item;
  6. import net.minecraft.item.ItemStack;
  7. import net.minecraft.item.crafting.IRecipe;
  8. import net.minecraft.world.World;
  9.  
  10. public class RainbowWoolRecipe implements IRecipe{
  11.  
  12.     @Override
  13.     public boolean matches(InventoryCrafting ic, World world) {
  14.         if(!ic.getInventoryName().equals("Crafting")) {
  15.             return false;
  16.         }
  17.         ItemStack topLeft = ic.getStackInRowAndColumn(0, 0);
  18.         if(topLeft.getItem() == Item.getItemFromBlock(Blocks.wool)) {
  19.             ItemStack topCentre = ic.getStackInRowAndColumn(0, 1);
  20.             ItemStack topRight = ic.getStackInRowAndColumn(0, 2);
  21.             ItemStack centreLeft = ic.getStackInRowAndColumn(1, 0);
  22.             ItemStack centreCentre = ic.getStackInRowAndColumn(1, 1);
  23.             ItemStack centreRight = ic.getStackInRowAndColumn(1, 2);
  24.             ItemStack bottomLeft = ic.getStackInRowAndColumn(2, 0);
  25.             ItemStack bottomCentre = ic.getStackInRowAndColumn(2, 1);
  26.             ItemStack bottomRight = ic.getStackInRowAndColumn(2, 2);
  27.            
  28.             ItemStack[] items = new ItemStack[]{topCentre, topRight, centreLeft, centreCentre, centreRight, bottomLeft, bottomCentre, bottomRight};
  29.             for(ItemStack itemstack : items) {
  30.                 if(itemstack.getItem() != Items.dye) {
  31.                     return false;
  32.                 }
  33.                 return true;
  34.             }
  35.         }
  36.         return false;
  37.     }
  38.  
  39.     @Override
  40.     public ItemStack getCraftingResult(InventoryCrafting p_77572_1_) {
  41.         return new ItemStack(GameRegistry.findBlock(Reference.MOD_ID, "RainbowWool"), 1);
  42.     }
  43.  
  44.     @Override
  45.     public int getRecipeSize() {
  46.         // TODO Auto-generated method stub
  47.         return 9;
  48.     }
  49.  
  50.     @Override
  51.     public ItemStack getRecipeOutput() {
  52.         return new ItemStack(GameRegistry.findBlock(Reference.MOD_ID, "RainbowWool"), 1);
  53.     }
  54.  
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement