blob: e85dfad4902b23c79d9cbe9a0fec34d847a7f040 (
plain)
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
package fyresmodjam.blessings;
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.event.entity.player.PlayerDropsEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
/**
* Represents a blessing bestowed to a player.
*
* @author bjculkin
*/
public abstract class Blessing {
private static int nextOrdinal = 0;
public final int ordinal;
public final String shortName;
protected Blessing(String name) {
this(name, true);
}
protected Blessing(String name, boolean mobAppropriate) {
ordinal = nextOrdinal++;
shortName = name;
BlessingUtils.playerBlessings.put(name, this);
if (mobAppropriate) {
BlessingUtils.mobBlessings.put(name, this);
}
}
public boolean hasCustomName() {
return true;
}
public String customName() {
return type().displayPrefix + " " + name();
}
/**
* Get the type of this blessing.
*
* @return The type of the blessing
*/
public abstract BlessingType type();
/**
* Get the name of this blessing.
*
* @return The name of this blessing.
*/
public String name() {
return shortName;
}
/**
* Get the description of this blessing.
*
* @return The description of this blessing.
*/
public abstract String description();
/**
* Modify the player's break speed.
*
* @param pebsev
* The break speed event.
*/
public void checkBreakSpeed(PlayerEvent.BreakSpeed pebsev) {
return;
}
/**
* Correct inappropriate blessings for mobs.
*
* @param ent
* The mob to correct for.
*/
public void correctBlessing(Entity ent) {
return;
}
/**
* Do something on every tick.
*
* @param stev
* The tick event
*/
public void commonTick(ServerTickEvent stev, EntityPlayer play) {
return;
}
/**
* Handle adjusting the damage multiplier for mob knowledge.
*
* @param lhev
* The event being dealt with.
*
* @param pickedDamageBonus
* The base damage bonus for mob knowledge.
*
* @return The new damage bonus for mob knowledge
*/
public float adjustMobKnowledgeBonus(LivingHurtEvent lhev, float pickedDamageBonus) {
return pickedDamageBonus;
}
/**
* Handle adjusting the damage multiplier for weapon knowledge.
*
* @param lhev
* The event being dealt with.
*
* @param pickedDamageBonus
* The base damage bonus for weapon knowledge.
*
* @return The new damage bonus for weapon knowledge
*/
public float adjustWeaponKnowledgeBonus(LivingHurtEvent lhev, float pickedDamageBonus) {
return pickedDamageBonus;
}
public float onIncomingDamage(LivingHurtEvent lhev, float damageMultiplier) {
return damageMultiplier;
}
public float onOutgoingDamage(LivingHurtEvent event, float damageMultiplier) {
return damageMultiplier;
}
public void onMobKill(LivingDeathEvent event) {
return;
}
public void onPlayerDrops(PlayerDropsEvent event) {
}
}
|