Fixed night vision power consumption
This commit is contained in:
parent
b6152480fe
commit
eb3b69febb
2 changed files with 6 additions and 8 deletions
|
@ -107,9 +107,9 @@ public class PlayerTickHandlerClient implements ITickHandler {
|
||||||
hasParachute = ItemUtils.itemHasActiveModule(torso, ModularCommon.MODULE_PARACHUTE);
|
hasParachute = ItemUtils.itemHasActiveModule(torso, ModularCommon.MODULE_PARACHUTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasNightVision) {
|
if (hasNightVision && totalEnergyDrain + 5 < totalEnergy) {
|
||||||
player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 500, -337));
|
player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 500, -337));
|
||||||
ItemUtils.drainPlayerEnergy(player, 5);
|
totalEnergyDrain += 5;
|
||||||
} else {
|
} else {
|
||||||
Collection<PotionEffect> effects = player.getActivePotionEffects();
|
Collection<PotionEffect> effects = player.getActivePotionEffects();
|
||||||
for (PotionEffect effect : effects) {
|
for (PotionEffect effect : effects) {
|
||||||
|
@ -119,9 +119,9 @@ public class PlayerTickHandlerClient implements ITickHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasInvis) {
|
if (hasInvis && totalEnergyDrain + 50 < totalEnergy) {
|
||||||
player.addPotionEffect(new PotionEffect(Potion.invisibility.id, 500, 81));
|
player.addPotionEffect(new PotionEffect(Potion.invisibility.id, 500, 81));
|
||||||
ItemUtils.drainPlayerEnergy(player, 50);
|
totalEnergyDrain += 50;
|
||||||
} else {
|
} else {
|
||||||
Collection<PotionEffect> effects = player.getActivePotionEffects();
|
Collection<PotionEffect> effects = player.getActivePotionEffects();
|
||||||
for (PotionEffect effect : effects) {
|
for (PotionEffect effect : effects) {
|
||||||
|
|
|
@ -272,9 +272,8 @@ public class PlayerTickHandlerServer implements ITickHandler {
|
||||||
if (torso != null && torso.getItem() instanceof IModularItem) {
|
if (torso != null && torso.getItem() instanceof IModularItem) {
|
||||||
hasInvis = ItemUtils.itemHasActiveModule(torso, ModularCommon.MODULE_ACTIVE_CAMOUFLAGE);
|
hasInvis = ItemUtils.itemHasActiveModule(torso, ModularCommon.MODULE_ACTIVE_CAMOUFLAGE);
|
||||||
}
|
}
|
||||||
if (hasNightVision) {
|
if (hasNightVision && 5 < ItemUtils.getPlayerEnergy(player)) {
|
||||||
player.addPotionEffect(new PotionEffect(16, 500, -337));
|
player.addPotionEffect(new PotionEffect(16, 500, -337));
|
||||||
ItemUtils.drainPlayerEnergy(player, 5);
|
|
||||||
} else {
|
} else {
|
||||||
Collection<PotionEffect> effects = player.getActivePotionEffects();
|
Collection<PotionEffect> effects = player.getActivePotionEffects();
|
||||||
for (PotionEffect effect : effects) {
|
for (PotionEffect effect : effects) {
|
||||||
|
@ -284,9 +283,8 @@ public class PlayerTickHandlerServer implements ITickHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasInvis) {
|
if (hasInvis && 50 < ItemUtils.getPlayerEnergy(player)) {
|
||||||
player.addPotionEffect(new PotionEffect(Potion.invisibility.id, 500, 81));
|
player.addPotionEffect(new PotionEffect(Potion.invisibility.id, 500, 81));
|
||||||
ItemUtils.drainPlayerEnergy(player, 50);
|
|
||||||
} else {
|
} else {
|
||||||
Collection<PotionEffect> effects = player.getActivePotionEffects();
|
Collection<PotionEffect> effects = player.getActivePotionEffects();
|
||||||
for (PotionEffect effect : effects) {
|
for (PotionEffect effect : effects) {
|
||||||
|
|
Loading…
Reference in a new issue