diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2019-09-08 20:43:22 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2019-09-08 20:43:22 -0400 |
| commit | 718ec4658576c94c8f5346829c9f5d6ebc028805 (patch) | |
| tree | 6984f5fc6c77b2ecab625dad72ed7c24972c4c60 /src/main/java/darkknight/jewelrycraft/affixes/LootingAffix.java | |
| parent | 1fa81166dfe255d37a54e0a81d212954351c8d20 (diff) | |
More affix work
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()); + } + } + } +} |
