Advertisement
Guest User

Untitled

a guest
Feb 19th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.16 KB | None | 0 0
  1. public class CarvingRecipe extends ShapedOreRecipe{
  2.  
  3.     private ItemStack baseShears;
  4.     private String matName;
  5.    
  6.     public CarvingRecipe() {
  7.         super(new ItemStack(Item.getItemFromBlock(PumpkinCarving.carvedPumpkin),1,0), new Object[] {"  ", "BA", 'A', Blocks.PUMPKIN, 'B', new ItemStack(Items.SHEARS,1,OreDictionary.WILDCARD_VALUE)});
  8.     }
  9.  
  10.     @Override
  11.     public ItemStack[] getRemainingItems(InventoryCrafting inv) {
  12.        
  13.         ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()];
  14.  
  15.         for (int i = 0; i < aitemstack.length; ++i)
  16.         {
  17.             ItemStack itemstack = inv.getStackInSlot(i);
  18.             if(itemstack.getItem() == Items.SHEARS){
  19.                 ItemStack shearscopy = itemstack.copy();
  20.                 if(shearscopy.attemptDamageItem(1, Minecraft.getMinecraft().theWorld.rand)){
  21.                     ForgeEventFactory.onPlayerDestroyItem(ForgeHooks.getCraftingPlayer(), itemstack, null);
  22.                     aitemstack[i] = null;
  23.                 }else{
  24.                     aitemstack[i] = shearscopy;
  25.                 }
  26.             }else{
  27.                 aitemstack[i] = ForgeHooks.getContainerItem(itemstack);
  28.             }
  29.         }
  30.  
  31.         return aitemstack;
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement