Search in sources :

Example 1 with SpawnKeybladeParticles

use of uk.co.wehavecookies56.kk.common.network.packet.client.SpawnKeybladeParticles in project Kingdom-Keys-Re-Coded by Wehavecookies56.

the class SummonKeyblade method process.

@Override
public void process(EntityPlayer player, Side side) {
    ItemStack keychain = player.getCapability(ModCapabilities.SUMMON_KEYBLADE, null).getInventoryKeychain().getStackInSlot(offHandSlot);
    ItemStack keyblade = new ItemStack(((ItemKeychain) (keychain.getItem())).getKeyblade());
    if (keychain.hasTagCompound()) {
        keyblade.setTagCompound(keychain.getTagCompound());
    }
    if (hand == EnumHand.MAIN_HAND) {
        player.inventory.setInventorySlotContents(player.inventory.currentItem, keyblade);
    } else {
        player.inventory.offHandInventory.set(0, keyblade);
    }
    player.world.playSound((EntityPlayer) null, player.getPosition(), ModSounds.summon, SoundCategory.MASTER, 1.0f, 1.0f);
    player.getCapability(ModCapabilities.SUMMON_KEYBLADE, null).setIsKeybladeSummoned(hand, true);
    player.sendMessage(new TextComponentTranslation(TextFormatting.DARK_GREEN + "Summoned " + player.getHeldItem(hand).getDisplayName()));
    PacketDispatcher.sendToAllAround(new SpawnKeybladeParticles(player), player, 64.0D);
    PacketDispatcher.sendTo(new SyncKeybladeData(player.getCapability(ModCapabilities.SUMMON_KEYBLADE, null)), (EntityPlayerMP) player);
}
Also used : TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) SyncKeybladeData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncKeybladeData) SpawnKeybladeParticles(uk.co.wehavecookies56.kk.common.network.packet.client.SpawnKeybladeParticles) ItemStack(net.minecraft.item.ItemStack)

Aggregations

ItemStack (net.minecraft.item.ItemStack)1 TextComponentTranslation (net.minecraft.util.text.TextComponentTranslation)1 SpawnKeybladeParticles (uk.co.wehavecookies56.kk.common.network.packet.client.SpawnKeybladeParticles)1 SyncKeybladeData (uk.co.wehavecookies56.kk.common.network.packet.client.SyncKeybladeData)1