Search in sources :

Example 1 with SyncLevelData

use of uk.co.wehavecookies56.kk.common.network.packet.client.SyncLevelData 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 2 with SyncLevelData

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

the class CommandLevelUp method execute.

@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
    if (sender.getCommandSenderEntity() instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) sender.getCommandSenderEntity();
        if (args.length == 0 || args.length > 2)
            TextHelper.sendFormattedChatMessage("Invalid arguments, usage: " + getUsage(sender), TextFormatting.RED, (EntityPlayer) sender.getCommandSenderEntity());
        else if (args.length == 1) {
            int level = 1;
            try {
                if (Integer.parseInt(args[0]) < 1 || Integer.parseInt(args[0]) > 100) {
                    TextHelper.sendFormattedChatMessage("Invalid level, it must be a number between 1 - 100", TextFormatting.RED, (EntityPlayer) sender.getCommandSenderEntity());
                    return;
                } else
                    level = Integer.parseInt(args[0]);
            } catch (Exception e) {
                TextHelper.sendFormattedChatMessage("Invalid level, it must be a number between 1 - 100", TextFormatting.RED, (EntityPlayer) sender.getCommandSenderEntity());
                return;
            }
            PlayerStatsCapability.IPlayerStats STATS = player.getCapability(ModCapabilities.PLAYER_STATS, null);
            STATS.setLevel(1);
            STATS.setExperience(0);
            if (STATS.getChoice1().equals(Strings.Choice_Sword))
                STATS.setStrength(3);
            else
                STATS.setStrength(1);
            if (STATS.getChoice1().equals(Strings.Choice_Shield))
                STATS.setDefense(3);
            else
                STATS.setDefense(1);
            if (STATS.getChoice1().equals(Strings.Choice_Staff))
                STATS.setMagic(3);
            else
                STATS.setMagic(1);
            STATS.setHP(20);
            player.setHealth(20);
            while (STATS.getLevel() < level) STATS.addExperience(player, STATS.getExpNeeded(level - 1, STATS.getExperience()));
            player.heal(STATS.getHP());
            TextHelper.sendFormattedChatMessage("Your level is now " + args[0], TextFormatting.YELLOW, (EntityPlayer) sender.getCommandSenderEntity());
            PacketDispatcher.sendTo(new SyncLevelData(player.getCapability(ModCapabilities.PLAYER_STATS, null)), (EntityPlayerMP) player);
        } else if (args.length == 2) {
            int level = 1;
            try {
                if (Integer.parseInt(args[0]) < 1 || Integer.parseInt(args[0]) > 100) {
                    TextHelper.sendFormattedChatMessage("Invalid level, it must be a number between 1 - 100", TextFormatting.RED, (EntityPlayer) sender.getCommandSenderEntity());
                    return;
                } else
                    level = Integer.parseInt(args[0]);
            } catch (Exception e) {
                TextHelper.sendFormattedChatMessage("Invalid level, it must be a number between 1 - 100", TextFormatting.RED, (EntityPlayer) sender.getCommandSenderEntity());
                return;
            }
            EntityPlayerMP entityplayermp = args.length == 2 ? (EntityPlayerMP) getPlayerFromUsername(args[1]) : getCommandSenderAsPlayer(sender);
            PlayerStatsCapability.IPlayerStats STATS = entityplayermp.getCapability(ModCapabilities.PLAYER_STATS, null);
            STATS.setLevel(1);
            STATS.setExperience(0);
            if (STATS.getChoice1().equals(Strings.Choice_Sword))
                STATS.setStrength(3);
            else
                STATS.setStrength(1);
            if (STATS.getChoice1().equals(Strings.Choice_Shield))
                STATS.setDefense(3);
            else
                STATS.setDefense(1);
            if (STATS.getChoice1().equals(Strings.Choice_Staff))
                STATS.setMagic(3);
            else
                STATS.setMagic(1);
            STATS.setHP(20);
            entityplayermp.setHealth(20);
            while (STATS.getLevel() < level) STATS.addExperience(entityplayermp, STATS.getExpNeeded(level - 1, STATS.getExperience()));
            entityplayermp.heal(STATS.getHP());
            TextHelper.sendFormattedChatMessage(args[1] + "'s level is now " + args[0], TextFormatting.YELLOW, (EntityPlayer) sender.getCommandSenderEntity());
            TextHelper.sendFormattedChatMessage("Your level is now " + args[0], TextFormatting.YELLOW, (EntityPlayer) entityplayermp);
            PacketDispatcher.sendTo(new SyncLevelData(entityplayermp.getCapability(ModCapabilities.PLAYER_STATS, null)), (EntityPlayerMP) entityplayermp);
        } else
            TextHelper.sendFormattedChatMessage("Invalid arguments, usage: " + getUsage(sender), TextFormatting.RED, (EntityPlayer) sender.getCommandSenderEntity());
    }
}
Also used : SyncLevelData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncLevelData) PlayerStatsCapability(uk.co.wehavecookies56.kk.common.capability.PlayerStatsCapability) EntityPlayer(net.minecraft.entity.player.EntityPlayer) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) PlayerNotFoundException(net.minecraft.command.PlayerNotFoundException) CommandException(net.minecraft.command.CommandException)

Example 3 with SyncLevelData

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

the class RemoveItemInSlot method process.

@Override
public void process(EntityPlayer player, Side side) {
    switch(inv) {
        case "keychain":
            keychain = player.getCapability(ModCapabilities.SUMMON_KEYBLADE, null).getInventoryKeychain();
            keychain.setStackInSlot(slot, ItemStack.EMPTY);
            break;
        case Strings.DefenseBoost:
            if (!player.capabilities.isCreativeMode)
                player.inventory.removeStackFromSlot(player.inventory.currentItem);
            player.getCapability(ModCapabilities.PLAYER_STATS, null).addDefense(1);
            TextComponentTranslation strMessage = new TextComponentTranslation(Strings.Chat_DefenseBoost, new TextComponentTranslation("" + player.getCapability(ModCapabilities.PLAYER_STATS, null).getDefense()));
            strMessage.getStyle().setColor(TextFormatting.GREEN);
            player.sendMessage(strMessage);
            break;
        case Strings.MagicBoost:
            if (!player.capabilities.isCreativeMode)
                player.inventory.removeStackFromSlot(player.inventory.currentItem);
            player.getCapability(ModCapabilities.PLAYER_STATS, null).addMagic(1);
            TextComponentTranslation magMessage = new TextComponentTranslation(Strings.Chat_MagicBoost, new TextComponentTranslation("" + player.getCapability(ModCapabilities.PLAYER_STATS, null).getMagic()));
            magMessage.getStyle().setColor(TextFormatting.GREEN);
            player.sendMessage(magMessage);
            break;
        case Strings.PowerBoost:
            if (!player.capabilities.isCreativeMode)
                player.inventory.removeStackFromSlot(player.inventory.currentItem);
            player.getCapability(ModCapabilities.PLAYER_STATS, null).addStrength(1);
            TextComponentTranslation powMessage = new TextComponentTranslation(Strings.Chat_PowerBoost, new TextComponentTranslation("" + player.getCapability(ModCapabilities.PLAYER_STATS, null).getStrength()));
            powMessage.getStyle().setColor(TextFormatting.GREEN);
            player.sendMessage(powMessage);
            break;
        case Strings.Potion:
            potions = player.getCapability(ModCapabilities.PLAYER_STATS, null).getInventoryPotionsMenu();
            potions.setStackInSlot(slot, ItemStack.EMPTY);
            if (sound)
                player.world.playSound(null, player.getPosition(), ModSounds.potion, SoundCategory.MASTER, 0.5f, 1);
            break;
        case Strings.DriveBoost:
            if (!player.capabilities.isCreativeMode)
                player.inventory.removeStackFromSlot(player.inventory.currentItem);
            player.getCapability(ModCapabilities.DRIVE_STATE, null).setDriveGaugeLevel(player.getCapability(ModCapabilities.DRIVE_STATE, null).getDriveGaugeLevel() + 1);
            player.getCapability(ModCapabilities.DRIVE_STATE, null).setDP(player.getCapability(ModCapabilities.DRIVE_STATE, null).getMaxDP());
            PacketDispatcher.sendTo(new SyncDriveData(player.getCapability(ModCapabilities.DRIVE_STATE, null)), (EntityPlayerMP) player);
            TextComponentTranslation driMessage = new TextComponentTranslation(Strings.Chat_DriveBoost, new TextComponentTranslation("" + player.getCapability(ModCapabilities.DRIVE_STATE, null).getDriveGaugeLevel()));
            driMessage.getStyle().setColor(TextFormatting.GREEN);
            player.sendMessage(driMessage);
            break;
    }
    PacketDispatcher.sendTo(new SyncLevelData(player.getCapability(ModCapabilities.PLAYER_STATS, null)), (EntityPlayerMP) player);
}
Also used : TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) SyncDriveData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncDriveData) SyncLevelData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncLevelData)

Example 4 with SyncLevelData

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

the class EntityEvents method onPlayerTick.

@SubscribeEvent
public void onPlayerTick(TickEvent.PlayerTickEvent event) {
    EntityPlayer player = event.player;
    if (player.getCapability(ModCapabilities.ORGANIZATION_XIII, null).getMember() == Utils.OrgMember.NONE) {
        if (!ItemStack.areItemStacksEqual(player.inventory.armorInventory.get(0), ItemStack.EMPTY) && player.inventory.armorInventory.get(1) != ItemStack.EMPTY && player.inventory.armorInventory.get(2) != ItemStack.EMPTY && player.inventory.armorInventory.get(3) != ItemStack.EMPTY) {
            boolean isWearingOrgArmor = player.inventory.armorInventory.get(0).getItem() instanceof ItemOrganizationRobe && player.inventory.armorInventory.get(1).getItem() instanceof ItemOrganizationRobe && player.inventory.armorInventory.get(2).getItem() instanceof ItemOrganizationRobe && player.inventory.armorInventory.get(3).getItem() instanceof ItemOrganizationRobe;
            // boolean isWearingXemnasArmor = player.inventory.armorInventory.get(0).getItem() == ModItems.Xemnas_Boots && player.inventory.armorInventory.get(1).getItem() == ModItems.Xemnas_Leggings && player.inventory.armorInventory.get(2).getItem() == ModItems.Xemnas_Chestplate && player.inventory.armorInventory.get(3).getItem() == ModItems.Xemnas_Helmet;
            if (isWearingOrgArmor) {
                if (!player.world.isRemote) {
                    if (!player.getCapability(ModCapabilities.ORGANIZATION_XIII, null).getOpenedGUI()) {
                        player.getCapability(ModCapabilities.ORGANIZATION_XIII, null).setOpenedGUI(true);
                        PacketDispatcher.sendTo(new OpenOrgGUI(), (EntityPlayerMP) player);
                    }
                }
            }
        } else {
            if (player.getCapability(ModCapabilities.ORGANIZATION_XIII, null).getMember() == Utils.OrgMember.NONE)
                player.getCapability(ModCapabilities.ORGANIZATION_XIII, null).setOpenedGUI(false);
        }
    }
    if (player.getCapability(ModCapabilities.Xemnas, null).getMember() == Utils.OrgMember.NONE) {
        if (!ItemStack.areItemStacksEqual(player.inventory.armorInventory.get(0), ItemStack.EMPTY) && player.inventory.armorInventory.get(1) != ItemStack.EMPTY && player.inventory.armorInventory.get(2) != ItemStack.EMPTY && player.inventory.armorInventory.get(3) != ItemStack.EMPTY) {
            boolean isWearingXemnasArmor = player.inventory.armorInventory.get(0).getItem() == ModItems.Xemnas_Boots && player.inventory.armorInventory.get(1).getItem() == ModItems.Xemnas_Leggings && player.inventory.armorInventory.get(2).getItem() == ModItems.Xemnas_Chestplate && player.inventory.armorInventory.get(3).getItem() == ModItems.Xemnas_Helmet;
            if (isWearingXemnasArmor) {
                if (!player.world.isRemote) {
                    if (!player.getCapability(ModCapabilities.Xemnas, null).getOpenedGUI()) {
                        player.getCapability(ModCapabilities.Xemnas, null).setOpenedGUI(true);
                        PacketDispatcher.sendTo(new OpenOrgGUI(), (EntityPlayerMP) player);
                    }
                }
            }
        } else {
            if (player.getCapability(ModCapabilities.Xemnas, null).getMember() == Utils.OrgMember.NONE)
                player.getCapability(ModCapabilities.Xemnas, null).setOpenedGUI(false);
        }
    }
    // Choices
    IPlayerStats STATS = player.getCapability(ModCapabilities.PLAYER_STATS, null);
    if (!event.player.world.isRemote) {
        if (player.dimension == ModDimensions.diveToTheHeartID) {
            if (player.getPosition().getX() == -13 && player.getPosition().getZ() == -1 && player.getPosition().getY() == 66) {
                if (!STATS.getChoice1().equals(Strings.Choice_Shield)) {
                    STATS.setChoice1(Strings.Choice_Shield);
                    TextComponentTranslation shield = new TextComponentTranslation("Shield");
                    shield.getStyle().setColor(TextFormatting.YELLOW);
                    player.sendMessage(shield);
                }
            } else if (player.getPosition().getX() == 11 && player.getPosition().getZ() == -1 && player.getPosition().getY() == 66) {
                if (!STATS.getChoice1().equals(Strings.Choice_Staff)) {
                    STATS.setChoice1(Strings.Choice_Staff);
                    TextComponentTranslation staff = new TextComponentTranslation("Staff");
                    staff.getStyle().setColor(TextFormatting.YELLOW);
                    player.sendMessage(staff);
                }
            } else if (player.getPosition().getX() == -1 && player.getPosition().getZ() == -13 && player.getPosition().getY() == 66) {
                if (!STATS.getChoice1().equals(Strings.Choice_Sword)) {
                    STATS.setChoice1(Strings.Choice_Sword);
                    TextComponentTranslation sword = new TextComponentTranslation("Sword");
                    sword.getStyle().setColor(TextFormatting.YELLOW);
                    player.sendMessage(sword);
                }
            } else if (player.getPosition().getX() == -1 && player.getPosition().getZ() == +10 && player.getPosition().getY() == 65) {
                if (((EntityPlayer) player).dimension == ModDimensions.diveToTheHeartID) {
                    if (!STATS.getChoice1().equals("") && !STATS.getChoice1().equals("door")) {
                        // if (!player.world.isRemote) {
                        switch(STATS.getChoice1()) {
                            case Strings.Choice_Shield:
                                STATS.addDefense(2);
                                break;
                            case Strings.Choice_Staff:
                                STATS.addMagic(2);
                                break;
                            case Strings.Choice_Sword:
                                STATS.addStrength(2);
                                break;
                        }
                        PacketDispatcher.sendTo(new SyncLevelData(STATS), (EntityPlayerMP) player);
                        new TeleporterOverworld(event.player.world.getMinecraftServer().getServer().getWorld(0)).teleport((player), player.world);
                    // }
                    } else {
                        if (!STATS.getChoice1().equals("door")) {
                            TextComponentTranslation needChoice = new TextComponentTranslation("You must make a choice");
                            needChoice.getStyle().setColor(TextFormatting.RED);
                            player.sendMessage(needChoice);
                            STATS.setChoice1("door");
                        }
                    }
                }
            }
        } else if (player.dimension == ModDimensions.traverseTownID) {
            if (player.getPosition().getX() == 193 && player.getPosition().getZ() == 161 && player.getPosition().getY() == 6) {
                new TeleporterOverworld(event.player.world.getMinecraftServer().getServer().getWorld(0)).teleport((player), player.world);
            }
        }
    }
    DriveStateCapability.IDriveState DS = event.player.getCapability(ModCapabilities.DRIVE_STATE, null);
    if (!DS.getInDrive())
        if (STATS.getMP() <= 0 || STATS.getRecharge()) {
            STATS.setRecharge(true);
            if (STATS.getMP() != STATS.getMaxMP()) {
                STATS.addMP(0.1);
                if (STATS.getMP() > STATS.getMaxMP())
                    STATS.setMP(STATS.getMaxMP());
            } else {
                STATS.setMP(STATS.getMaxMP());
                STATS.setRecharge(false);
                if (event.side.isServer()) {
                    PacketDispatcher.sendTo(new SyncMagicData(event.player.getCapability(ModCapabilities.MAGIC_STATE, null), event.player.getCapability(ModCapabilities.PLAYER_STATS, null)), (EntityPlayerMP) event.player);
                }
            }
        }
    if (!DS.getActiveDriveName().equals("none") && DriveFormRegistry.isDriveFormRegistered(DS.getActiveDriveName())) {
        DriveFormRegistry.get(DS.getActiveDriveName()).update(event.player);
    }
    List<Entity> entities = event.player.world.getEntitiesWithinAABBExcludingEntity(event.player, event.player.getEntityBoundingBox().grow(16.0D, 10.0D, 16.0D).offset(-8.0D, -5.0D, -8.0D));
    List<Entity> bossEntities = event.player.world.getEntitiesWithinAABBExcludingEntity(event.player, event.player.getEntityBoundingBox().grow(150.0D, 100.0D, 150.0D).offset(-75.0D, -50.0D, -75.0D));
    if (!bossEntities.isEmpty()) {
        for (int i = 0; i < bossEntities.size(); i++) {
            if (bossEntities.get(i) instanceof EntityDragon || bossEntities.get(i) instanceof EntityWither) {
                isBoss = true;
                break;
            } else {
                isBoss = false;
            }
        }
    } else {
        isBoss = false;
    }
    if (!entities.isEmpty()) {
        for (int i = 0; i < entities.size(); i++) {
            if (entities.get(i) instanceof EntityMob) {
                isHostiles = true;
                break;
            } else {
                isHostiles = false;
            }
        }
    } else {
        isHostiles = false;
    }
}
Also used : Entity(net.minecraft.entity.Entity) EntityDragon(net.minecraft.entity.boss.EntityDragon) OpenOrgGUI(uk.co.wehavecookies56.kk.common.network.packet.client.OpenOrgGUI) TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) TeleporterOverworld(uk.co.wehavecookies56.kk.common.world.dimension.TeleporterOverworld) SyncLevelData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncLevelData) IPlayerStats(uk.co.wehavecookies56.kk.common.capability.PlayerStatsCapability.IPlayerStats) EntityMob(net.minecraft.entity.monster.EntityMob) DriveStateCapability(uk.co.wehavecookies56.kk.common.capability.DriveStateCapability) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemOrganizationRobe(uk.co.wehavecookies56.kk.common.item.ItemOrganizationRobe) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) SyncMagicData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncMagicData) EntityWither(net.minecraft.entity.boss.EntityWither) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 5 with SyncLevelData

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

the class EntityEvents method onLivingDeathEvent.

@SubscribeEvent
public void onLivingDeathEvent(LivingDeathEvent event) {
    if (!event.getEntity().world.isRemote && event.getEntity() instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) event.getEntity();
        SummonKeybladeCapability.ISummonKeyblade SUMMON = player.getCapability(ModCapabilities.SUMMON_KEYBLADE, null);
        IOrganizationXIII ORG = player.getCapability(ModCapabilities.ORGANIZATION_XIII, null);
        if (SUMMON.getIsKeybladeSummoned(EnumHand.MAIN_HAND)) {
            if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
                PacketDispatcher.sendToServer(new DeSummonKeyblade());
                PacketDispatcher.sendTo(new SyncKeybladeData(SUMMON), (EntityPlayerMP) player);
            } else {
                SUMMON.setIsKeybladeSummoned(EnumHand.MAIN_HAND, false);
                if (event.getEntity().world.getGameRules().getBoolean("keepInventory")) {
                    for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
                        if (!ItemStack.areItemStacksEqual(player.inventory.getStackInSlot(i), ItemStack.EMPTY)) {
                            if (player.inventory.getStackInSlot(i).getItem() instanceof ItemRealKeyblade) {
                                player.inventory.setInventorySlotContents(i, ItemStack.EMPTY);
                            }
                        }
                    }
                }
            }
        } else if (ORG.summonedWeapon(EnumHand.MAIN_HAND)) {
            if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
                PacketDispatcher.sendToServer(new DeSummonOrgWeapon());
                PacketDispatcher.sendTo(new SyncOrgXIIIData(ORG), (EntityPlayerMP) player);
            } else {
                SUMMON.setIsKeybladeSummoned(EnumHand.MAIN_HAND, false);
                if (event.getEntity().world.getGameRules().getBoolean("keepInventory")) {
                    for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
                        if (!ItemStack.areItemStacksEqual(player.inventory.getStackInSlot(i), ItemStack.EMPTY)) {
                            if (player.inventory.getStackInSlot(i).getItem() instanceof IOrgWeapon) {
                                player.inventory.setInventorySlotContents(i, ItemStack.EMPTY);
                            }
                        }
                    }
                }
            }
        }
    }
    if (event.getEntity() instanceof EntityDragon) {
        WorldSavedDataKingdomKeys.get(DimensionManager.getWorld(DimensionType.OVERWORLD.getId())).setSpawnHeartless(true);
    }
    if (!event.getEntity().world.isRemote && event.getEntity() instanceof EntityMob)
        if (event.getSource().getTrueSource() instanceof EntityPlayer) {
            EntityPlayer player = (EntityPlayer) event.getSource().getTrueSource();
            EntityMob mob = (EntityMob) event.getEntity();
            player.getCapability(ModCapabilities.PLAYER_STATS, null).addExperience(player, (int) (mob.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).getAttributeValue() / 2));
            if (!player.getCapability(ModCapabilities.PLAYER_STATS, null).enderDragonDefeated()) {
                player.getCapability(ModCapabilities.DRIVE_STATE, null).setDriveGaugeLevel(player.getCapability(ModCapabilities.DRIVE_STATE, null).getDriveGaugeLevel() + 1);
                player.getCapability(ModCapabilities.DRIVE_STATE, null).setDP(player.getCapability(ModCapabilities.DRIVE_STATE, null).getMaxDP());
                PacketDispatcher.sendTo(new SyncDriveData(player.getCapability(ModCapabilities.DRIVE_STATE, null)), (EntityPlayerMP) player);
                TextComponentTranslation driMessage = new TextComponentTranslation(Strings.Chat_DriveBoost, new TextComponentTranslation("" + player.getCapability(ModCapabilities.DRIVE_STATE, null).getDriveGaugeLevel()));
                driMessage.getStyle().setColor(TextFormatting.GREEN);
                player.sendMessage(driMessage);
                player.getCapability(ModCapabilities.PLAYER_STATS, null).setEnderDragonDefeated(true);
            }
            if (event.getEntity() instanceof EntityDragon) {
                player.getCapability(ModCapabilities.PLAYER_STATS, null).addExperience(player, 2000);
            }
            if (event.getEntity() instanceof EntityWither) {
                player.getCapability(ModCapabilities.PLAYER_STATS, null).addExperience(player, 1500);
            }
            PacketDispatcher.sendTo(new SyncLevelData(player.getCapability(ModCapabilities.PLAYER_STATS, null)), (EntityPlayerMP) player);
        }
}
Also used : EntityDragon(net.minecraft.entity.boss.EntityDragon) TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) SyncLevelData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncLevelData) DeSummonKeyblade(uk.co.wehavecookies56.kk.common.network.packet.server.DeSummonKeyblade) SyncKeybladeData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncKeybladeData) ItemRealKeyblade(uk.co.wehavecookies56.kk.common.item.base.ItemRealKeyblade) SyncOrgXIIIData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncOrgXIIIData) EntityMob(net.minecraft.entity.monster.EntityMob) SummonKeybladeCapability(uk.co.wehavecookies56.kk.common.capability.SummonKeybladeCapability) SyncDriveData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncDriveData) DeSummonOrgWeapon(uk.co.wehavecookies56.kk.common.network.packet.server.DeSummonOrgWeapon) EntityPlayer(net.minecraft.entity.player.EntityPlayer) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) EntityWither(net.minecraft.entity.boss.EntityWither) IOrgWeapon(uk.co.wehavecookies56.kk.common.item.org.IOrgWeapon) IOrganizationXIII(uk.co.wehavecookies56.kk.common.capability.OrganizationXIIICapability.IOrganizationXIII) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

SyncLevelData (uk.co.wehavecookies56.kk.common.network.packet.client.SyncLevelData)6 EntityPlayer (net.minecraft.entity.player.EntityPlayer)4 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)4 SyncDriveData (uk.co.wehavecookies56.kk.common.network.packet.client.SyncDriveData)4 TextComponentTranslation (net.minecraft.util.text.TextComponentTranslation)3 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)3 SyncMagicData (uk.co.wehavecookies56.kk.common.network.packet.client.SyncMagicData)3 EntityDragon (net.minecraft.entity.boss.EntityDragon)2 EntityWither (net.minecraft.entity.boss.EntityWither)2 EntityMob (net.minecraft.entity.monster.EntityMob)2 SyncKeybladeData (uk.co.wehavecookies56.kk.common.network.packet.client.SyncKeybladeData)2 SyncOrgXIIIData (uk.co.wehavecookies56.kk.common.network.packet.client.SyncOrgXIIIData)2 GameProfile (com.mojang.authlib.GameProfile)1 UUID (java.util.UUID)1 CommandException (net.minecraft.command.CommandException)1 PlayerNotFoundException (net.minecraft.command.PlayerNotFoundException)1 Entity (net.minecraft.entity.Entity)1 ItemStack (net.minecraft.item.ItemStack)1 ItemStackHandler (net.minecraftforge.items.ItemStackHandler)1 DriveStateCapability (uk.co.wehavecookies56.kk.common.capability.DriveStateCapability)1