Search in sources :

Example 36 with ITextComponent

use of net.minecraft.util.text.ITextComponent in project BloodMagic by WayofTime.

the class ModRecipes method addLivingArmourDowngradeRecipes.

public static void addLivingArmourDowngradeRecipes() {
    String messageBase = "ritual.bloodmagic.downgradeRitual.dialogue.";
    ItemStack bowStack = new ItemStack(Items.BOW);
    ItemStack bottleStack = new ItemStack(Items.POTIONITEM, 1, 0);
    ItemStack swordStack = new ItemStack(Items.STONE_SWORD);
    ItemStack goldenAppleStack = new ItemStack(Items.GOLDEN_APPLE);
    ItemStack fleshStack = new ItemStack(Items.ROTTEN_FLESH);
    ItemStack shieldStack = new ItemStack(Items.SHIELD);
    ItemStack pickStack = new ItemStack(Items.STONE_PICKAXE);
    ItemStack minecartStack = new ItemStack(Items.MINECART);
    ItemStack stringStack = new ItemStack(Items.STRING);
    Map<ItemStack, Pair<String, int[]>> dialogueMap = new HashMap<>();
    dialogueMap.put(bowStack, Pair.of("bow", new int[] { 1, 100, 300, 500 }));
    dialogueMap.put(bottleStack, Pair.of("quenched", new int[] { 1, 100, 300, 500 }));
    dialogueMap.put(swordStack, Pair.of("dulledBlade", new int[] { 1, 100, 300, 500, 700 }));
    dialogueMap.put(goldenAppleStack, Pair.of("slowHeal", new int[] { 1, 100, 300, 500, 700 }));
    for (Entry<ItemStack, Pair<String, int[]>> entry : dialogueMap.entrySet()) {
        ItemStack keyStack = entry.getKey();
        String str = entry.getValue().getKey();
        Map<Integer, List<ITextComponent>> textMap = new HashMap<>();
        for (int tick : entry.getValue().getValue()) {
            List<ITextComponent> textList = new ArrayList<>();
            textList.add(new TextComponentTranslation("\u00A74%s", new TextComponentTranslation(messageBase + str + "." + tick)));
            textMap.put(tick, textList);
        }
        LivingArmourDowngradeRecipeRegistry.registerDialog(keyStack, textMap);
    }
    LivingArmourDowngradeRecipeRegistry.registerRecipe(new LivingArmourUpgradeStormTrooper(0), bowStack, Items.ARROW, "string", "ingotIron", "ingotIron");
    LivingArmourDowngradeRecipeRegistry.registerRecipe(new LivingArmourUpgradeStormTrooper(1), bowStack, Items.SPECTRAL_ARROW, "ingotGold", "dustRedstone", "dustGlowstone", "gemLapis");
    LivingArmourDowngradeRecipeRegistry.registerRecipe(new LivingArmourUpgradeStormTrooper(2), bowStack, "gemDiamond", Items.FIRE_CHARGE, Items.BLAZE_ROD, "feather");
    LivingArmourDowngradeRecipeRegistry.registerRecipe(new LivingArmourUpgradeStormTrooper(3), bowStack, Items.PRISMARINE_SHARD, Items.BLAZE_ROD, "feather", "feather");
    LivingArmourDowngradeRecipeRegistry.registerRecipe(new LivingArmourUpgradeStormTrooper(4), bowStack, new ItemStack(Items.TIPPED_ARROW, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Items.TIPPED_ARROW, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Items.TIPPED_ARROW, 1, OreDictionary.WILDCARD_VALUE));
    // LivingArmourDowngradeRecipeRegistry.registerDialog(bowStack, bowMap);
    LivingArmourDowngradeRecipeRegistry.registerRecipe(new LivingArmourUpgradeQuenched(0), bottleStack, Items.DRAGON_BREATH);
    LivingArmourDowngradeRecipeRegistry.registerRecipe(new LivingArmourUpgradeCrippledArm(0), shieldStack, "gemDiamond");
    for (int i = 0; i < 10; i++) {
        addRecipeForTieredDowngrade(new LivingArmourUpgradeMeleeDecrease(i), swordStack, i);
        addRecipeForTieredDowngrade(new LivingArmourUpgradeSlowHeal(i), goldenAppleStack, i);
        addRecipeForTieredDowngrade(new LivingArmourUpgradeBattleHungry(i), fleshStack, i);
        addRecipeForTieredDowngrade(new LivingArmourUpgradeDigSlowdown(i), pickStack, i);
        addRecipeForTieredDowngrade(new LivingArmourUpgradeDisoriented(i), minecartStack, i);
        addRecipeForTieredDowngrade(new LivingArmourUpgradeSlowness(i), stringStack, i);
    }
}
Also used : LivingArmourUpgradeSlowHeal(WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeSlowHeal) LivingArmourUpgradeBattleHungry(WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeBattleHungry) TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) LivingArmourUpgradeSlowness(WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeSlowness) HashMap(java.util.HashMap) ITextComponent(net.minecraft.util.text.ITextComponent) ArrayList(java.util.ArrayList) LivingArmourUpgradeMeleeDecrease(WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeMeleeDecrease) LivingArmourUpgradeDigSlowdown(WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeDigSlowdown) LivingArmourUpgradeCrippledArm(WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeCrippledArm) LivingArmourUpgradeQuenched(WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeQuenched) List(java.util.List) ArrayList(java.util.ArrayList) ItemStack(net.minecraft.item.ItemStack) LivingArmourUpgradeStormTrooper(WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeStormTrooper) LivingArmourUpgradeDisoriented(WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeDisoriented) Pair(org.apache.commons.lang3.tuple.Pair)

Example 37 with ITextComponent

use of net.minecraft.util.text.ITextComponent in project pnc-repressurized by TeamPneumatic.

the class EntityDrone method onDeath.

@Override
public void onDeath(DamageSource par1DamageSource) {
    for (int i = 0; i < inventory.getSlots(); i++) {
        if (!inventory.getStackInSlot(i).isEmpty()) {
            entityDropItem(inventory.getStackInSlot(i), 0);
            inventory.setStackInSlot(i, ItemStack.EMPTY);
        }
    }
    if (!naturallySpawned) {
        ItemStack drone = getDroppedStack();
        if (hasCustomName())
            drone.setStackDisplayName(getCustomNameTag());
        entityDropItem(drone, 0);
        if (!world.isRemote) {
            EntityPlayer owner = getOwner();
            if (owner != null) {
                int x = (int) Math.floor(posX);
                int y = (int) Math.floor(posY);
                int z = (int) Math.floor(posZ);
                ITextComponent msg = hasCustomName() ? new TextComponentTranslation("death.drone.named", getCustomNameTag(), x, y, z) : new TextComponentTranslation("death.drone", x, y, z);
                msg = msg.appendSibling(new TextComponentString(" - ")).appendSibling(par1DamageSource.getDeathMessage(this));
                owner.sendStatusMessage(msg, false);
            }
        }
    }
    if (!world.isRemote)
        getFakePlayer().interactionManager.cancelDestroyingBlock();
    super.onDeath(par1DamageSource);
}
Also used : TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) ITextComponent(net.minecraft.util.text.ITextComponent) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemStack(net.minecraft.item.ItemStack) PathPoint(net.minecraft.pathfinding.PathPoint) TextComponentString(net.minecraft.util.text.TextComponentString)

Example 38 with ITextComponent

use of net.minecraft.util.text.ITextComponent in project LogisticsPipes by RS485.

the class LPChatListener method clientChat.

@SubscribeEvent
public void clientChat(ClientChatReceivedEvent event) {
    ITextComponent message = event.getMessage();
    if (message != null) {
        String realMessage = null;
        try {
            realMessage = message.getFormattedText();
        } catch (ClassCastException e) {
        // Ignore that
        } catch (Exception e) {
            e.printStackTrace();
        }
        if (realMessage != null) {
            if (realMessage.equals("%LPCLEARCHAT%")) {
                clearChat();
                event.setCanceled(true);
            }
            if (realMessage.equals("%LPSTORESENDMESSAGE%")) {
                storeSendMessages();
                event.setCanceled(true);
            }
            if (realMessage.equals("%LPRESTORESENDMESSAGE%")) {
                restoreSendMessages();
                event.setCanceled(true);
            }
            if (realMessage.startsWith("%LPADDTOSENDMESSAGE%")) {
                addSendMessages(realMessage.substring(20));
                event.setCanceled(true);
            }
            if (realMessage.contains("LPDISPLAYMISSING") && LogisticsPipes.isDEBUG()) {
                System.out.println("LIST:");
                StringUtils.UNTRANSLATED_STRINGS.forEach(System.out::println);
            }
        }
    }
}
Also used : ITextComponent(net.minecraft.util.text.ITextComponent) TextComponentString(net.minecraft.util.text.TextComponentString) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 39 with ITextComponent

use of net.minecraft.util.text.ITextComponent in project RecurrentComplex by Ivorforce.

the class GuiHider method hideGUI.

public static boolean hideGUI(Visualizer visualizer) {
    if (!canHide())
        return false;
    Minecraft mc = Minecraft.getMinecraft();
    hiddenGUI = mc.currentScreen;
    GuiHider.visualizer = visualizer;
    if (hiddenGUI == null)
        return false;
    mc.displayGuiScreen(null);
    ITextComponent reopen = new TextComponentString("/" + RCCommands.reopen.getName());
    reopen.getStyle().setColor(TextFormatting.GREEN);
    reopen.getStyle().setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/" + RCCommands.reopen.getName()));
    reopen.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, RecurrentComplex.translations.get("commands.rcreopen.run")));
    mc.player.sendMessage(RecurrentComplex.translations.format("commands.rc.didhide", reopen));
    return true;
}
Also used : HoverEvent(net.minecraft.util.text.event.HoverEvent) ClickEvent(net.minecraft.util.text.event.ClickEvent) ITextComponent(net.minecraft.util.text.ITextComponent) Minecraft(net.minecraft.client.Minecraft) TextComponentString(net.minecraft.util.text.TextComponentString)

Example 40 with ITextComponent

use of net.minecraft.util.text.ITextComponent in project RecurrentComplex by Ivorforce.

the class CommandSightInfo method execute.

@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
    Parameters parameters = Parameters.of(args, expect()::declare);
    WorldStructureGenerationData generationData = WorldStructureGenerationData.get(sender.getEntityWorld());
    WorldStructureGenerationData.Entry entry = generationData.getEntry(UUID.fromString(parameters.get(0).require()));
    if (entry == null)
        throw RecurrentComplex.translations.commandException("commands.rcsightinfo.unknown");
    else {
        ITextComponent area = RCTextStyle.area(RCBlockAreas.from(entry.getBoundingBox()));
        ITextComponent sight = RCTextStyle.sight(entry, true);
        if (entry instanceof WorldStructureGenerationData.StructureEntry) {
            WorldStructureGenerationData.StructureEntry structureEntry = (WorldStructureGenerationData.StructureEntry) entry;
            sender.sendMessage(new TextComponentTranslation("commands.rcsightinfo.structure", RCTextStyle.structure(structureEntry.getStructureID()), area, RCTextStyle.copy(String.valueOf(structureEntry.getSeed())), sight));
            Structure structure = StructureRegistry.INSTANCE.get(structureEntry.getStructureID());
            if (structure != null) {
                // TODO generateAsSource not accurate
                NBTStorable instanceData = structure.loadInstanceData(new StructureLoadContext(structureEntry.getTransform(), entry.getBoundingBox(), false), structureEntry.getInstanceData(), RCConfig.getUniversalTransformer());
                List<TextComponentBase> list = structure.instanceDataInfo(instanceData);
                for (TextComponentBase s : list) sender.sendMessage(s);
            }
        } else
            sender.sendMessage(new TextComponentTranslation("commands.rcsightinfo.get", entry.description(), area, sight));
    }
}
Also used : StructureLoadContext(ivorius.reccomplex.world.gen.feature.structure.context.StructureLoadContext) TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) Parameters(ivorius.mcopts.commands.parameters.Parameters) WorldStructureGenerationData(ivorius.reccomplex.world.gen.feature.WorldStructureGenerationData) ITextComponent(net.minecraft.util.text.ITextComponent) NBTStorable(ivorius.reccomplex.nbt.NBTStorable) Structure(ivorius.reccomplex.world.gen.feature.structure.Structure) TextComponentBase(net.minecraft.util.text.TextComponentBase)

Aggregations

ITextComponent (net.minecraft.util.text.ITextComponent)96 TextComponentString (net.minecraft.util.text.TextComponentString)54 EntityPlayer (net.minecraft.entity.player.EntityPlayer)26 TextComponentTranslation (net.minecraft.util.text.TextComponentTranslation)25 ClickEvent (net.minecraft.util.text.event.ClickEvent)16 ItemStack (net.minecraft.item.ItemStack)11 Style (net.minecraft.util.text.Style)8 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)8 HoverEvent (net.minecraft.util.text.event.HoverEvent)7 World (net.minecraft.world.World)7 ArrayList (java.util.ArrayList)6 BlockPos (net.minecraft.util.math.BlockPos)6 DimensionInformation (mcjty.rftoolsdim.dimensions.DimensionInformation)5 RfToolsDimensionManager (mcjty.rftoolsdim.dimensions.RfToolsDimensionManager)5 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)5 Minecraft (net.minecraft.client.Minecraft)4 Text (org.spongepowered.api.text.Text)4 MagicBook (cavern.magic.MagicBook)3 SpecialMagic (cavern.magic.SpecialMagic)3 Matcher (java.util.regex.Matcher)3