Advertisement
Guest User

UnlitTorches patch

a guest
Aug 17th, 2013
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.48 KB | None | 0 0
  1. diff --git a/pelep/unlittorch/item/ItemTorch.java b/pelep/unlittorch/item/ItemTorch.java
  2. index a62ee1e..e2d2b95 100644
  3. --- a/pelep/unlittorch/item/ItemTorch.java
  4. +++ b/pelep/unlittorch/item/ItemTorch.java
  5. @@ -653,7 +653,7 @@ public class ItemTorch extends ItemBlock
  6.                      }
  7.                      else
  8.                      {
  9. -                        this.killItemTorch(world, p, ist, "fire.fire");
  10. +                        this.killItemTorch(world, p, ist, slot, "fire.fire");
  11.                      }
  12.  
  13.                      return;
  14. @@ -667,7 +667,7 @@ public class ItemTorch extends ItemBlock
  15.                      }
  16.                      else
  17.                      {
  18. -                        this.killItemTorch(world, p, ist, "fire.fire");
  19. +                        this.killItemTorch(world, p, ist, slot, "fire.fire");
  20.                      }
  21.  
  22.                      if (p.inventory.getStackInSlot(slot) == null)
  23. @@ -682,7 +682,7 @@ public class ItemTorch extends ItemBlock
  24.  
  25.                  if (world.canLightningStrikeAt(x, y, z) && (held && world.rand.nextInt(50) == 0 || world.rand.nextInt(80) == 0))
  26.                  {
  27. -                    this.killItemTorch(world, p, ist, "random.fizz");
  28. +                    this.killItemTorch(world, p, ist, slot, "random.fizz");
  29.                      return;
  30.                  }
  31.  
  32. @@ -698,22 +698,17 @@ public class ItemTorch extends ItemBlock
  33.      private void destroyItemTorch(World world, EntityPlayer p, ItemStack ist, int slot, boolean random)
  34.      {
  35.          world.playSoundAtEntity(p, "fire.fire", 1.0F, 1.0F);
  36. -
  37. -        if (random)
  38. -        {
  39. -            int dec = world.rand.nextInt(ist.stackSize) + 1;
  40. -            p.inventory.decrStackSize(slot, dec);
  41. -        }
  42. -        else
  43. -        {
  44. -            p.inventory.setInventorySlotContents(slot, (ItemStack)null);
  45. -        }
  46. +        ist.setItemDamage(1);
  47. +        p.inventory.decrStackSize(slot, 1);
  48.      }
  49.  
  50. -    private void killItemTorch(World world, EntityPlayer p, ItemStack ist, String sound)
  51. +    private void killItemTorch(World world, EntityPlayer p, ItemStack ist, int slot, String sound)
  52.      {
  53.          world.playSoundAtEntity(p, sound, 1.0F, 1.0F);
  54. -        ist.setItemDamage(0);
  55. +        ist.setItemDamage(1);
  56. +        p.inventory.decrStackSize(slot, 1);
  57. +        if( false == p.inventory.addItemStackToInventory(new ItemStack(ist.getItem())) )
  58. +            p.dropItem(ist.itemID, 1);
  59.      }
  60.  
  61.      public boolean onEntityItemUpdate(EntityItem ei)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement