package darkknight.jewelrycraft.curses; import java.util.ArrayList; import darkknight.jewelrycraft.api.Curse; import darkknight.jewelrycraft.config.ConfigHandler; import darkknight.jewelrycraft.util.Variables; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; public class CurseMoneyEqualsPower extends Curse { public CurseMoneyEqualsPower(String name, int txtID, String texturepack) { super(name, txtID, texturepack); } @Override public void entityDropItems(EntityPlayer player, Entity target, ArrayList drops) { int dropsTaken = 0; for (EntityItem item : drops) { if (rand.nextBoolean()) { int stackSize = item .getEntityItem().stackSize; int takenItems = rand.nextInt(stackSize); item.getEntityItem().stackSize -= takenItems; if (item.getEntityItem().stackSize <= 0) { item.setDead(); } dropsTaken += takenItems; } } if (dropsTaken > 0) { if (dropsTaken > 3) { player.addPotionEffect(new PotionEffect( Potion.digSpeed.id, dropsTaken * 30, 1)); player.addPotionEffect(new PotionEffect( Potion.moveSpeed.id, dropsTaken * 30, 1)); player.addChatComponentMessage( new ChatComponentText( StatCollector.translateToLocal( EnumChatFormatting.RED + "curse.jewlrycraft2.moneyEqualsPower.bless1"))); } if (dropsTaken > 6) { player.addPotionEffect(new PotionEffect( Potion.resistance.id, dropsTaken * 20, 1)); player.addPotionEffect(new PotionEffect( Potion.damageBoost.id, dropsTaken * 20, 1)); player.addChatComponentMessage( new ChatComponentText( StatCollector.translateToLocal( EnumChatFormatting.RED + "curse.jewlrycraft2.moneyEqualsPower.bless2"))); } if (dropsTaken > 9) { player.addPotionEffect(new PotionEffect( Potion.regeneration.id, dropsTaken * 10, 1)); player.addPotionEffect(new PotionEffect( Potion.heal.id, dropsTaken * 10, 1)); player.addChatComponentMessage( new ChatComponentText( StatCollector.translateToLocal( EnumChatFormatting.RED + "curse.jewlrycraft2.moneyEqualsPower.bless3"))); } } } @Override public boolean canCurseBeActivated() { return ConfigHandler.CURSE_MONEY_EQUALS_POWER; } @Override public String getDescription() { return StatCollector.translateToLocal("curse." + Variables.MODID + ".moneyEqualsPower.description"); } @Override public String getDisplayName() { return StatCollector.translateToLocal("curse." + Variables.MODID + ".moneyEqualsPower"); } }