diff options
Diffstat (limited to 'src/main/java/darkknight/jewelrycraft/affixes/LootingAffix.java')
| -rw-r--r-- | src/main/java/darkknight/jewelrycraft/affixes/LootingAffix.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/main/java/darkknight/jewelrycraft/affixes/LootingAffix.java b/src/main/java/darkknight/jewelrycraft/affixes/LootingAffix.java new file mode 100644 index 0000000..559ad4e --- /dev/null +++ b/src/main/java/darkknight/jewelrycraft/affixes/LootingAffix.java @@ -0,0 +1,30 @@ +package darkknight.jewelrycraft.affixes; + +import darkknight.jewelrycraft.api.ModifierEffect; +import darkknight.jewelrycraft.item.ItemBaseJewelry; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraftforge.event.entity.living.LivingDropsEvent; + +public class LootingAffix extends ModifierEffect { + private int bonus; + + public LootingAffix(int bonus) { + super(null); + + this.bonus = bonus; + } + + @Override + public void onLivingDropItems(ItemStack item, EntityPlayer player, LivingDropsEvent event, + ItemBaseJewelry jewelry) { + for (EntityItem drop : event.drops) { + ItemStack is = drop.getEntityItem(); + + if (is.isStackable()) { + is.stackSize = Math.min(is.stackSize + bonus, is.getMaxStackSize()); + } + } + } +} |
