use of net.silentchaos512.gems.network.message.MessageSetFlight in project SilentGems by SilentChaos512.
the class ChaosBuff method removeFromPlayer.
public void removeFromPlayer(EntityPlayer player, int level, ItemStack stack) {
if (potion != null) {
player.removePotionEffect(potion);
}
if (this == FLIGHT && !player.capabilities.isCreativeMode) {
player.capabilities.allowFlying = false;
player.capabilities.isFlying = false;
player.fallDistance = 0;
if (!player.world.isRemote) {
NetworkHandler.INSTANCE.sendTo(new MessageSetFlight(false), (EntityPlayerMP) player);
}
}
}
use of net.silentchaos512.gems.network.message.MessageSetFlight in project SilentGems by SilentChaos512.
the class ChaosBuff method applyToPlayer.
public void applyToPlayer(EntityPlayer player, int level, ItemStack stack) {
if (potion != null) {
int duration = getApplyDuration(player, level);
if (duration > 0) {
player.addPotionEffect(new PotionEffect(potion, duration, level - 1, false, false));
// (Tough As Nails) Remove hyper/hypothermia when using heat/cold resistance.
if (this == HEAT_RESISTANCE)
player.removeActivePotionEffect(hyperthermia);
else if (this == COLD_RESISTANCE)
player.removeActivePotionEffect(hypothermia);
}
}
if (this == FLIGHT) {
player.capabilities.allowFlying = true;
PlayerData data = PlayerDataHandler.get(player);
if (data != null)
data.flightTime = 100;
if (!player.world.isRemote && player.world.getTotalWorldTime() % 20 == 0) {
NetworkHandler.INSTANCE.sendTo(new MessageSetFlight(true), (EntityPlayerMP) player);
}
}
}
Aggregations