1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
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<EntityItem> 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");
}
}
|