use of cavern.network.client.MagicCancelMessage in project Cavern2 by kegare.
the class MagicBookMessage method process.
@Override
public IMessage process(EntityPlayerMP player) {
MagicBook book = MagicBook.get(player);
Magic magic = EnumType.byItemStack(player.getHeldItem(hand)).createMagic(player.getServerWorld(), player, hand);
if (magic == null) {
return new MagicCancelMessage();
}
book.setSpellingMagic(magic);
return null;
}
use of cavern.network.client.MagicCancelMessage in project Cavern2 by kegare.
the class MagicInvisibleMessage method process.
@Override
public IMessage process(EntityPlayerMP player) {
MagicBook book = MagicBook.get(player);
Magic magic = book.getSpellingMagic();
if (magic != null) {
if (magic.getMana() < magic.getCost()) {
return new MagicCancelMessage();
}
player.setInvisible(true);
SoundEvent sound = magic.getSuccessSound();
if (sound != null) {
player.world.playSound(null, player.posX, player.posY + 0.25D, player.posZ, sound, SoundCategory.PLAYERS, 1.0F, 1.0F);
}
}
return null;
}
Aggregations