Search in sources :

Example 66 with ChatComponentTranslation

use of net.minecraft.util.ChatComponentTranslation in project Tale-of-Kingdoms by Ivasik78.

the class EntityBuilderKeeper method interact.

@Override
public boolean interact(EntityPlayer player) {
    if (this.canInteractWith(player)) {
        if (PlayerProvider.get(player).getGlory() < 10000 && !Buildings.INSTANCE.kingdomCreated) {
            if (!worldObj.isRemote) {
                player.addChatMessage(new ChatComponentTranslation("npc.cityBuilder.dialog_1"));
            }
        }
        if (PlayerProvider.get(player).getGlory() >= 10000.0F && !setted) {
            if (!worldObj.isRemote) {
                player.addChatMessage(new ChatComponentTranslation("npc.cityBuilder.dialog_2"));
                this.follow = true;
                this.setted = true;
            }
            player.openGui(TaleOfKingdoms.instance, GUI_BUILD, worldObj, (int) this.posX, (int) this.posY, (int) this.posZ);
        } else if (PlayerProvider.get(player).getGlory() >= 10000.0F && this.follow && !Buildings.INSTANCE.kingdomCreated && !setted) {
            if (!worldObj.isRemote) {
                player.addChatMessage(new ChatComponentTranslation("npc.cityBuilder.dialog_3"));
                this.follow = false;
            }
        }
    }
    return true;
}
Also used : ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation)

Example 67 with ChatComponentTranslation

use of net.minecraft.util.ChatComponentTranslation in project Tale-of-Kingdoms by Ivasik78.

the class GuiHunter method actionPerformed.

@Override
protected void actionPerformed(GuiButton button) {
    switch(button.id) {
        case 1:
            this.player.addChatMessage(!HunterHandler.INSTANCE.getHunter() ? new ChatComponentTranslation("gui.guildMaster.killMobs") : new ChatComponentTranslation("gui.guildMaster.discarded"));
            this.player.addChatMessage(new ChatComponentTranslation("gui.guildMaster.await"));
            this.initGui();
            break;
        case 2:
            if (1500 <= playerProvider.getGoldTotal()) {
                EntityLiving entityLiving = (EntityLiving) UltimateHelper.INSTANCE.getEntity("Hired", world);
                entityLiving.setLocationAndAngles(this.player.posX, this.player.posY, this.player.posZ, 0.0F, 0.0F);
                this.world.spawnEntityInWorld(entityLiving);
                playerProvider.decreaseGold(1500);
            } else {
                this.goldchecker = true;
            }
            break;
        case 3:
            this.mc.displayGuiScreen(null);
            this.goldchecker = false;
            break;
        case 4:
            InventoryPlayer inventoryPlayer = this.player.inventory;
            boolean entity = false;
            if (inventoryPlayer.hasItem(Item.getItemFromBlock(Blocks.log))) {
                for (ItemStack stack : inventoryPlayer.mainInventory) {
                    if (stack != null && stack.getItem() == Item.getItemFromBlock(Blocks.log)) {
                        if (stack.stackSize == stack.getMaxStackSize() && !entity) {
                            inventoryPlayer.setItemStack(null);
                            entity = true;
                        }
                    }
                }
            }
            if (!entity) {
                if (!this.world.isRemote) {
                    this.player.addChatMessage(new ChatComponentTranslation("gui.guildMaster.needMore"));
                }
            } else if (!this.world.isRemote) {
                this.player.addChatMessage(new ChatComponentTranslation("gui.guildMaster.fixed"));
            }
            break;
        case 5:
            IntStream.range(0, this.world.loadedEntityList.size()).mapToObj(var7 -> (Entity) this.world.loadedEntityList.get(var7)).filter(entity1 -> entity1 instanceof EntityHired).map(entity1 -> (EntityHired) entity1).forEach(var9 -> {
                var9.setDead();
                playerProvider.addGold(1000);
            });
            break;
    }
}
Also used : IntStream(java.util.stream.IntStream) Entity(net.minecraft.entity.Entity) Side(cpw.mods.fml.relauncher.Side) SideOnly(cpw.mods.fml.relauncher.SideOnly) Blocks(net.minecraft.init.Blocks) GuiPriceBar(kingdoms.api.gui.GuiPriceBar) GuiButton(net.minecraft.client.gui.GuiButton) Item(net.minecraft.item.Item) World(net.minecraft.world.World) HunterHandler(kingdoms.server.handlers.resources.HunterHandler) InventoryPlayer(net.minecraft.entity.player.InventoryPlayer) I18n(net.minecraft.client.resources.I18n) ItemStack(net.minecraft.item.ItemStack) GuiScreenToK(kingdoms.api.gui.GuiScreenToK) EntityLiving(net.minecraft.entity.EntityLiving) EntityPlayer(net.minecraft.entity.player.EntityPlayer) UltimateHelper(kingdoms.server.handlers.UltimateHelper) ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation) EntityHired(kingdoms.server.entities.EntityHired) InventoryPlayer(net.minecraft.entity.player.InventoryPlayer) Entity(net.minecraft.entity.Entity) EntityLiving(net.minecraft.entity.EntityLiving) ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation) EntityHired(kingdoms.server.entities.EntityHired) ItemStack(net.minecraft.item.ItemStack)

Example 68 with ChatComponentTranslation

use of net.minecraft.util.ChatComponentTranslation in project Tale-of-Kingdoms by Ivasik78.

the class GuiQuarry method actionPerformed.

@Override
protected void actionPerformed(GuiButton button) {
    switch(button.id) {
        case 1:
            if (ResourcesHandler.INSTANCE.getCobblePool() >= 64) {
                ItemStack itemstack = new ItemStack(Blocks.cobblestone, 64, 0);
                EntityItem entityitem = new EntityItem(this.world, this.player.posX, this.player.posY, this.player.posZ, itemstack);
                this.world.spawnEntityInWorld(entityitem);
                this.goldchecker = false;
                ResourcesHandler.INSTANCE.decreaseCobblePool(64);
            } else
                this.player.addChatMessage(new ChatComponentTranslation("gui.foreman.notResources"));
            break;
        case 2:
            if (playerProvider.getGoldTotal() >= 1500) {
                if (WorkersHandler.INSTANCE.getQuarryMembers() < 12) {
                    if (!this.world.isRemote) {
                        WorkersHandler.INSTANCE.addQuarryMember((byte) 1);
                        playerProvider.decreaseGold(1500);
                        this.player.addChatMessage(new ChatComponentTranslation("gui.foreman.boughtWorker"));
                    }
                } else if (!this.world.isRemote) {
                    this.player.addChatMessage(new ChatComponentTranslation("gui.foreman.limitWorkers"));
                }
            } else
                this.goldchecker = true;
            break;
        case 3:
            this.mc.displayGuiScreen(null);
            break;
    }
}
Also used : ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation) ItemStack(net.minecraft.item.ItemStack) EntityItem(net.minecraft.entity.item.EntityItem)

Example 69 with ChatComponentTranslation

use of net.minecraft.util.ChatComponentTranslation in project Tale-of-Kingdoms by Ivasik78.

the class EntityPriestKeeper method interact.

@Override
public boolean interact(EntityPlayer player) {
    if (this.canInteractWith(player)) {
        if (!this.worldObj.isRemote) {
            this.heal(100.0F);
            player.addChatMessage(new ChatComponentTranslation("npc.headPriest.dialog"));
        }
        player.openGui(TaleOfKingdoms.instance, GUI_PRIEST, worldObj, 0, 0, 0);
    }
    return true;
}
Also used : ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation)

Example 70 with ChatComponentTranslation

use of net.minecraft.util.ChatComponentTranslation in project Armourers-Workshop by RiskyKen.

the class RehostedJarHandler method onPlayerTick.

@SubscribeEvent
public void onPlayerTick(TickEvent.PlayerTickEvent event) {
    if (validJar) {
        return;
    }
    if (event.side != Side.CLIENT) {
        return;
    }
    if (event.type != Type.PLAYER) {
        return;
    }
    if (event.phase != Phase.END) {
        return;
    }
    if (lastMessagePost + messagePostRate > System.currentTimeMillis()) {
        return;
    }
    lastMessagePost = System.currentTimeMillis();
    EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
    ChatComponentTranslation downloadLink = new ChatComponentTranslation("chat.armourersworkshop:invalidJarDownload", (Object) null);
    downloadLink.getChatStyle().setUnderlined(true);
    downloadLink.getChatStyle().setColor(EnumChatFormatting.BLUE);
    downloadLink.getChatStyle().setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentTranslation("chat.armourersworkshop:invalidJarDownloadTooltip", (Object) null)));
    downloadLink.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, LibModInfo.DOWNLOAD_URL));
    ChatComponentTranslation stopModRepostsLink = new ChatComponentTranslation("chat.armourersworkshop:invalidJarStopModReposts", (Object) null);
    stopModRepostsLink.getChatStyle().setUnderlined(true);
    stopModRepostsLink.getChatStyle().setColor(EnumChatFormatting.BLUE);
    stopModRepostsLink.getChatStyle().setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentTranslation("chat.armourersworkshop:invalidJarStopModRepostsTooltip", (Object) null)));
    stopModRepostsLink.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, STOP_MOD_REPOSTS_URL));
    ChatComponentTranslation updateMessage = new ChatComponentTranslation("chat.armourersworkshop:invalidJar", downloadLink, stopModRepostsLink);
    updateMessage.getChatStyle().setColor(EnumChatFormatting.RED);
    player.addChatMessage(updateMessage);
}
Also used : HoverEvent(net.minecraft.event.HoverEvent) EntityClientPlayerMP(net.minecraft.client.entity.EntityClientPlayerMP) ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation) ClickEvent(net.minecraft.event.ClickEvent) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent)

Aggregations

ChatComponentTranslation (net.minecraft.util.ChatComponentTranslation)89 ItemStack (net.minecraft.item.ItemStack)21 TileEntity (net.minecraft.tileentity.TileEntity)15 EntityPlayer (net.minecraft.entity.player.EntityPlayer)14 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)11 ChatComponentText (net.minecraft.util.ChatComponentText)6 ArrayList (java.util.ArrayList)5 Block (net.minecraft.block.Block)4 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)4 World (net.minecraft.world.World)4 Item1N4148 (club.nsdn.nyasamarailway.item.tool.Item1N4148)3 ItemNTP32Bit (club.nsdn.nyasamarailway.item.tool.ItemNTP32Bit)3 ItemNTP8Bit (club.nsdn.nyasamarailway.item.tool.ItemNTP8Bit)3 TileEntityActuator (club.nsdn.nyasamatelecom.api.tileentity.TileEntityActuator)3 BufferedImage (java.awt.image.BufferedImage)3 IChatComponent (net.minecraft.util.IChatComponent)3 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)3 Int3 (WayofTime.alchemicalWizardry.api.Int3)2 TEReagentConduit (WayofTime.alchemicalWizardry.common.tileEntity.TEReagentConduit)2 TrainPacket (club.nsdn.nyasamarailway.network.TrainPacket)2