mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 07:06:45 +01:00
parent
96fdf265d5
commit
f77446919f
@ -13,10 +13,9 @@ import com.google.common.base.Functions;
|
|||||||
* Called when mcMMO applies damage from an entity due to special abilities.
|
* Called when mcMMO applies damage from an entity due to special abilities.
|
||||||
*/
|
*/
|
||||||
public class FakeEntityDamageByEntityEvent extends EntityDamageByEntityEvent {
|
public class FakeEntityDamageByEntityEvent extends EntityDamageByEntityEvent {
|
||||||
private static final EnumMap<DamageModifier, Function<? super Double, Double>> functionModifiers = getFunctionModifiers();
|
|
||||||
|
|
||||||
public FakeEntityDamageByEntityEvent(Entity damager, Entity damagee, DamageCause cause, final Map<DamageModifier, Double> modifiers) {
|
public FakeEntityDamageByEntityEvent(Entity damager, Entity damagee, DamageCause cause, final Map<DamageModifier, Double> modifiers) {
|
||||||
super(damager, damagee, cause, modifiers, functionModifiers);
|
super(damager, damagee, cause, modifiers, getFunctionModifiers(modifiers));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -24,11 +23,11 @@ public class FakeEntityDamageByEntityEvent extends EntityDamageByEntityEvent {
|
|||||||
super(damager, damagee, cause, damage);
|
super(damager, damagee, cause, damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EnumMap<DamageModifier, Function<? super Double, Double>> getFunctionModifiers() {
|
public static EnumMap<DamageModifier, Function<? super Double, Double>> getFunctionModifiers(Map<DamageModifier, Double> modifiers) {
|
||||||
EnumMap<DamageModifier, Function<? super Double, Double>> modifierFunctions = new EnumMap<DamageModifier, Function<? super Double, Double>>(DamageModifier.class);
|
EnumMap<DamageModifier, Function<? super Double, Double>> modifierFunctions = new EnumMap<DamageModifier, Function<? super Double, Double>>(DamageModifier.class);
|
||||||
Function<? super Double, Double> ZERO = Functions.constant(-0.0);
|
Function<? super Double, Double> ZERO = Functions.constant(-0.0);
|
||||||
|
|
||||||
for (DamageModifier modifier : DamageModifier.values()) {
|
for (DamageModifier modifier : modifiers.keySet()) {
|
||||||
modifierFunctions.put(modifier, ZERO);
|
modifierFunctions.put(modifier, ZERO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,10 +13,9 @@ import com.google.common.base.Functions;
|
|||||||
* Called when mcMMO applies damage due to special abilities.
|
* Called when mcMMO applies damage due to special abilities.
|
||||||
*/
|
*/
|
||||||
public class FakeEntityDamageEvent extends EntityDamageEvent {
|
public class FakeEntityDamageEvent extends EntityDamageEvent {
|
||||||
private static final EnumMap<DamageModifier, Function<? super Double, Double>> functionModifiers = getFunctionModifiers();
|
|
||||||
|
|
||||||
public FakeEntityDamageEvent(Entity damagee, DamageCause cause, final Map<DamageModifier, Double> modifiers) {
|
public FakeEntityDamageEvent(Entity damagee, DamageCause cause, final Map<DamageModifier, Double> modifiers) {
|
||||||
super(damagee, cause, modifiers, functionModifiers);
|
super(damagee, cause, modifiers, getFunctionModifiers(modifiers));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -24,11 +23,11 @@ public class FakeEntityDamageEvent extends EntityDamageEvent {
|
|||||||
super(damagee, cause, damage);
|
super(damagee, cause, damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EnumMap<DamageModifier, Function<? super Double, Double>> getFunctionModifiers() {
|
public static EnumMap<DamageModifier, Function<? super Double, Double>> getFunctionModifiers(Map<DamageModifier, Double> modifiers) {
|
||||||
EnumMap<DamageModifier, Function<? super Double, Double>> modifierFunctions = new EnumMap<DamageModifier, Function<? super Double, Double>>(DamageModifier.class);
|
EnumMap<DamageModifier, Function<? super Double, Double>> modifierFunctions = new EnumMap<DamageModifier, Function<? super Double, Double>>(DamageModifier.class);
|
||||||
Function<? super Double, Double> ZERO = Functions.constant(-0.0);
|
Function<? super Double, Double> ZERO = Functions.constant(-0.0);
|
||||||
|
|
||||||
for (DamageModifier modifier : DamageModifier.values()) {
|
for (DamageModifier modifier : modifiers.keySet()) {
|
||||||
modifierFunctions.put(modifier, ZERO);
|
modifierFunctions.put(modifier, ZERO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user