use of com.bewitchment.common.core.net.messages.PlayerTransformationChangedMessage in project Bewitchment by Um-Mitternacht.
the class TransformationEvents method onPlayerJoin.
@SubscribeEvent
public void onPlayerJoin(PlayerLoggedInEvent evt) {
if (evt.player instanceof EntityPlayerMP) {
EntityPlayerMP player = (EntityPlayerMP) evt.player;
NetworkHandler.HANDLER.sendTo(new PlayerTransformationChangedMessage(player), player);
NetworkHandler.HANDLER.sendTo(new PlayerVampireBloodChanged(player), player);
NetworkHandler.HANDLER.sendTo(new EntityInternalBloodChanged(player), player);
NetworkHandler.HANDLER.sendTo(new NightVisionStatus(player.getCapability(CapabilityTransformationData.CAPABILITY, null).isNightVisionActive()), player);
}
}
use of com.bewitchment.common.core.net.messages.PlayerTransformationChangedMessage in project Bewitchment by Um-Mitternacht.
the class ApiInstance method setTypeAndLevel.
@Override
public void setTypeAndLevel(EntityPlayer player, ITransformation type, int level, boolean isClient) {
ITransformationData data = player.getCapability(CapabilityTransformationData.CAPABILITY, null);
IBloodReserve ibr = player.getCapability(CapabilityBloodReserve.CAPABILITY, null);
data.setType(type);
data.setLevel(level);
data.setNightVision(data.isNightVisionActive() && (type == ModTransformations.WEREWOLF || type == ModTransformations.VAMPIRE));
if ((type == ModTransformations.SPECTRE || type == ModTransformations.VAMPIRE)) {
ibr.setMaxBlood(-1);
player.removePotionEffect(ModPotions.bloodDrained);
} else if (ibr.getMaxBlood() < 0) {
ibr.setMaxBlood(480);
ibr.setBlood(480);
}
if (isClient) {
HotbarAction.refreshActions(player, player.world);
} else {
NetworkHandler.HANDLER.sendTo(new PlayerTransformationChangedMessage(player), (EntityPlayerMP) player);
NetworkHandler.HANDLER.sendTo(new PlayerVampireBloodChanged(player), (EntityPlayerMP) player);
NetworkHandler.HANDLER.sendTo(new EntityInternalBloodChanged(player), (EntityPlayerMP) player);
NetworkHandler.HANDLER.sendTo(new NightVisionStatus(player.getCapability(CapabilityTransformationData.CAPABILITY, null).isNightVisionActive()), (EntityPlayerMP) player);
}
MinecraftForge.EVENT_BUS.post(new TransformationModifiedEvent(player, type, level));
}
Aggregations