Search in sources :

Example 1 with SyncMunnyData

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

the class OpenSynthesis method process.

@Override
public void process(EntityPlayer player, Side side) {
    PacketDispatcher.sendTo(new SyncMunnyData(player.getCapability(ModCapabilities.MUNNY, null)), (EntityPlayerMP) player);
    PacketDispatcher.sendTo(new SyncRecipeData(player.getCapability(ModCapabilities.SYNTHESIS_RECIPES, null)), (EntityPlayerMP) player);
    PacketDispatcher.sendTo(new SyncFreeDevRecipeData(player.getCapability(ModCapabilities.SYNTHESIS_RECIPES, null)), (EntityPlayerMP) player);
    PacketDispatcher.sendTo(new SyncMaterialData(player.getCapability(ModCapabilities.SYNTHESIS_MATERIALS, null)), (EntityPlayerMP) player);
}
Also used : SyncRecipeData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncRecipeData) SyncFreeDevRecipeData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncFreeDevRecipeData) SyncMunnyData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncMunnyData) SyncMaterialData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncMaterialData)

Example 2 with SyncMunnyData

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

the class OpenMenu method process.

@Override
public void process(EntityPlayer player, Side side) {
    PacketDispatcher.sendTo(new SyncMunnyData(player.getCapability(ModCapabilities.MUNNY, null)), (EntityPlayerMP) player);
    PacketDispatcher.sendTo(new SyncMagicData(player.getCapability(ModCapabilities.MAGIC_STATE, null), player.getCapability(ModCapabilities.PLAYER_STATS, null)), (EntityPlayerMP) player);
    PacketDispatcher.sendTo(new SyncDriveData(player.getCapability(ModCapabilities.DRIVE_STATE, null)), (EntityPlayerMP) player);
    PacketDispatcher.sendTo(new SyncLevelData(player.getCapability(ModCapabilities.PLAYER_STATS, null)), (EntityPlayerMP) player);
}
Also used : SyncDriveData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncDriveData) SyncLevelData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncLevelData) SyncMunnyData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncMunnyData) SyncMagicData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncMagicData)

Example 3 with SyncMunnyData

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

the class GiveBoughtItem method process.

@Override
public void process(EntityPlayer player, Side side) {
    player.inventory.addItemStackToInventory(this.boughtItem);
    player.getCapability(ModCapabilities.MUNNY, null).remMunny(spentMunny);
    PacketDispatcher.sendTo(new SyncMunnyData(player.getCapability(ModCapabilities.MUNNY, null)), (EntityPlayerMP) player);
}
Also used : SyncMunnyData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncMunnyData)

Example 4 with SyncMunnyData

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

the class EntityMoogle method processInteract.

@Override
protected boolean processInteract(EntityPlayer player, EnumHand hand) {
    if (!player.isSneaking()) {
        this.world.playSound(player, this.posX, this.posY, this.posZ, ModSounds.kupo, SoundCategory.BLOCKS, 1.0F, 1.0F);
        if (!this.world.isRemote) {
            PacketDispatcher.sendTo(new SyncMunnyData(player.getCapability(ModCapabilities.MUNNY, null)), (EntityPlayerMP) player);
        }
        player.openGui(KingdomKeys.instance, GuiIDs.GUI_SHOP, this.world, (int) this.posX, (int) this.posY, (int) this.posZ);
        return true;
    }
    return false;
}
Also used : SyncMunnyData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncMunnyData)

Example 5 with SyncMunnyData

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

the class TakeSoldItem method process.

@Override
public void process(EntityPlayer player, Side side) {
    int quantityRemaining = quantity;
    for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
        if (player.inventory.getStackInSlot(i).getItem() instanceof ItemSynthesisMaterial) {
            ItemStack invItem = player.inventory.getStackInSlot(i);
            if (invItem.getTagCompound().getString("material").equals(soldItem.getTagCompound().getString("material"))) {
                // System.out.println(invItem.getTagCompound().getString("material")+">"+soldItem.getTagCompound().getString("material"));
                if (quantityRemaining >= player.inventory.getStackInSlot(i).getCount()) {
                    // If the amount you want to sell is bigger or equals to the amount you have
                    // Remove the item
                    player.inventory.removeStackFromSlot(i);
                    quantityRemaining -= player.inventory.getStackInSlot(i).getCount();
                } else if (quantityRemaining < player.inventory.getStackInSlot(i).getCount()) {
                    player.inventory.getStackInSlot(i).shrink(quantityRemaining);
                    quantityRemaining = 0;
                }
            }
        }
    }
    player.getCapability(ModCapabilities.MUNNY, null).addMunny(munnyToGive);
    PacketDispatcher.sendTo(new SyncMunnyData(player.getCapability(ModCapabilities.MUNNY, null)), (EntityPlayerMP) player);
}
Also used : ItemSynthesisMaterial(uk.co.wehavecookies56.kk.common.item.base.ItemSynthesisMaterial) SyncMunnyData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncMunnyData) ItemStack(net.minecraft.item.ItemStack)

Aggregations

SyncMunnyData (uk.co.wehavecookies56.kk.common.network.packet.client.SyncMunnyData)6 ItemSynthesisMaterial (uk.co.wehavecookies56.kk.common.item.base.ItemSynthesisMaterial)2 SyncDriveData (uk.co.wehavecookies56.kk.common.network.packet.client.SyncDriveData)2 SyncMagicData (uk.co.wehavecookies56.kk.common.network.packet.client.SyncMagicData)2 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)1 ItemStack (net.minecraft.item.ItemStack)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1 IItemHandler (net.minecraftforge.items.IItemHandler)1 IDriveState (uk.co.wehavecookies56.kk.common.capability.DriveStateCapability.IDriveState)1 MunnyCapability (uk.co.wehavecookies56.kk.common.capability.MunnyCapability)1 IPlayerStats (uk.co.wehavecookies56.kk.common.capability.PlayerStatsCapability.IPlayerStats)1 ItemHpOrb (uk.co.wehavecookies56.kk.common.item.ItemHpOrb)1 ItemMunny (uk.co.wehavecookies56.kk.common.item.ItemMunny)1 ShowOverlayPacket (uk.co.wehavecookies56.kk.common.network.packet.client.ShowOverlayPacket)1 SyncDriveInventory (uk.co.wehavecookies56.kk.common.network.packet.client.SyncDriveInventory)1 SyncFreeDevRecipeData (uk.co.wehavecookies56.kk.common.network.packet.client.SyncFreeDevRecipeData)1 SyncLevelData (uk.co.wehavecookies56.kk.common.network.packet.client.SyncLevelData)1 SyncMaterialData (uk.co.wehavecookies56.kk.common.network.packet.client.SyncMaterialData)1 SyncRecipeData (uk.co.wehavecookies56.kk.common.network.packet.client.SyncRecipeData)1