Search in sources :

Example 86 with ChatComponentText

use of v1_8_9.net.minecraft.util.ChatComponentText in project RFTools by McJty.

the class CmdDimletCfg method execute.

@Override
public void execute(ICommandSender sender, String[] args) {
    if (args.length > 1) {
        sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Too many parameters!"));
        return;
    }
    World world = sender.getEntityWorld();
    ItemStack heldItem = null;
    if (sender instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) sender;
        heldItem = player.getHeldItem();
    }
    if (heldItem == null || heldItem.getItem() != DimletSetup.knownDimlet) {
        sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "You need to hold a known dimlet in your hand!"));
        return;
    }
    DimletKey key = KnownDimletConfiguration.getDimletKey(heldItem, world);
    DimletEntry entry = KnownDimletConfiguration.getEntry(key);
    if (entry != null) {
        sender.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "In dimlets.cfg:"));
        sender.addChatMessage(new ChatComponentText("dimletsettings {"));
        DimletType type = key.getType();
        sender.addChatMessage(new ChatComponentText("    I:\"rarity." + type.dimletType.getName() + "." + key.getName() + "\"=" + entry.getRarity()));
        sender.addChatMessage(new ChatComponentText("    I:\"rfcreate." + type.dimletType.getName() + "." + key.getName() + "\"=" + entry.getRfCreateCost()));
        sender.addChatMessage(new ChatComponentText("    I:\"rfmaintain." + type.dimletType.getName() + "." + key.getName() + "\"=" + entry.getRfMaintainCost()));
        sender.addChatMessage(new ChatComponentText("    I:\"ticks." + type.dimletType.getName() + "." + key.getName() + "\"=" + entry.getTickCost()));
        if (entry.isRandomNotAllowed()) {
            sender.addChatMessage(new ChatComponentText("    B:\"expensive." + type.dimletType.getName() + "." + key.getName() + "\"=true"));
        }
        if (entry.isLootNotAllowed()) {
            sender.addChatMessage(new ChatComponentText("    B:\"noloot." + type.dimletType.getName() + "." + key.getName() + "\"=true"));
        }
        sender.addChatMessage(new ChatComponentText("}"));
        if (!entry.isRandomNotAllowed()) {
            if (type == DimletType.DIMLET_MATERIAL || type == DimletType.DIMLET_LIQUID) {
                sender.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "If you only want this for features (no terrain):"));
                sender.addChatMessage(new ChatComponentText("    B:\"expensive." + type.dimletType.getName() + "." + key.getName() + "\"=true"));
            } else {
                sender.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "If you don't want this dimlet to be generated random:"));
                sender.addChatMessage(new ChatComponentText("    B:\"expensive." + type.dimletType.getName() + "." + key.getName() + "\"=true"));
            }
        }
        if (!entry.isLootNotAllowed()) {
            sender.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "If you don't want this dimlet to be generated as loot:"));
            sender.addChatMessage(new ChatComponentText("    B:\"noloot." + type.dimletType.getName() + "." + key.getName() + "\"=true"));
        }
        sender.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "In dimlets.cfg, if you want to blacklist this dimlet:"));
        sender.addChatMessage(new ChatComponentText("knowndimlets {"));
        sender.addChatMessage(new ChatComponentText("    I:\"dimlet." + type.dimletType.getName() + "." + key.getName() + "\"=-1"));
        sender.addChatMessage(new ChatComponentText("}"));
        String modid = null;
        if (type == DimletType.DIMLET_MATERIAL) {
            BlockMeta blockMeta = DimletObjectMapping.idToBlock.get(key);
            if (blockMeta != null) {
                modid = RFToolsTools.getModidForBlock(blockMeta.getBlock());
            }
        } else if (type == DimletType.DIMLET_LIQUID) {
            Block block = DimletObjectMapping.idToFluid.get(key);
            if (block != null) {
                modid = RFToolsTools.getModidForBlock(block);
            }
        }
        if (modid != null && !"?".equals(modid)) {
            sender.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "In dimlets.cfg, if you want to blacklist the entire mod:"));
            sender.addChatMessage(new ChatComponentText("knowndimlets {"));
            sender.addChatMessage(new ChatComponentText("    B:\"modban." + type.dimletType.getName() + "." + modid + "\"=true"));
            sender.addChatMessage(new ChatComponentText("}"));
        }
    }
}
Also used : EntityPlayer(net.minecraft.entity.player.EntityPlayer) Block(net.minecraft.block.Block) World(net.minecraft.world.World) ItemStack(net.minecraft.item.ItemStack) ChatComponentText(net.minecraft.util.ChatComponentText) BlockMeta(mcjty.lib.varia.BlockMeta)

Example 87 with ChatComponentText

use of v1_8_9.net.minecraft.util.ChatComponentText in project RFTools by McJty.

the class CmdReset method execute.

@Override
public void execute(ICommandSender sender, String[] args) {
    if (args.length > 1) {
        sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Too many parameters!"));
        return;
    }
    if (!(sender instanceof EntityPlayer)) {
        sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "This command only works as a player!"));
        return;
    }
    EntityPlayer player = (EntityPlayer) sender;
    PlayerPreferencesProperties properties = PlayerPreferencesProperties.getProperties(player);
    properties.getPreferencesProperties().reset();
}
Also used : EntityPlayer(net.minecraft.entity.player.EntityPlayer) ChatComponentText(net.minecraft.util.ChatComponentText) PlayerPreferencesProperties(mcjty.lib.preferences.PlayerPreferencesProperties)

Example 88 with ChatComponentText

use of v1_8_9.net.minecraft.util.ChatComponentText in project RFTools by McJty.

the class CmdSaveDim method execute.

@Override
public void execute(ICommandSender sender, String[] args) {
    if (args.length < 3) {
        sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "The dimension and filename parameters are missing!"));
        return;
    } else if (args.length > 3) {
        sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Too many parameters!"));
        return;
    }
    int dim = fetchInt(sender, args, 1, 0);
    String filename = fetchString(sender, args, 2, null);
    World world = sender.getEntityWorld();
    RfToolsDimensionManager dimensionManager = RfToolsDimensionManager.getDimensionManager(world);
    if (dimensionManager.getDimensionDescriptor(dim) == null) {
        sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Not an RFTools dimension!"));
        return;
    }
    DimensionInformation information = dimensionManager.getDimensionInformation(dim);
    String error = information.buildJson(filename);
    if (error != null) {
        sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Error: " + error));
    }
}
Also used : World(net.minecraft.world.World) ChatComponentText(net.minecraft.util.ChatComponentText) DimensionInformation(mcjty.rftools.dimension.DimensionInformation) RfToolsDimensionManager(mcjty.rftools.dimension.RfToolsDimensionManager)

Example 89 with ChatComponentText

use of v1_8_9.net.minecraft.util.ChatComponentText in project RFTools by McJty.

the class CmdSetBuffBar method execute.

@Override
public void execute(ICommandSender sender, String[] args) {
    if (args.length > 3) {
        sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Too many parameters!"));
        return;
    }
    if (!(sender instanceof EntityPlayer)) {
        sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "This command only works as a player!"));
        return;
    }
    EntityPlayer player = (EntityPlayer) sender;
    PlayerPreferencesProperties properties = PlayerPreferencesProperties.getProperties(player);
    if (args.length < 3) {
        int buffX = properties.getPreferencesProperties().getBuffX();
        int buffY = properties.getPreferencesProperties().getBuffY();
        ((EntityPlayer) sender).addChatComponentMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "Current buffbar location: " + buffX + "," + buffY));
        return;
    }
    int x = fetchInt(sender, args, 1, 0);
    int y = fetchInt(sender, args, 2, 0);
    properties.getPreferencesProperties().setBuffXY(x, y);
}
Also used : EntityPlayer(net.minecraft.entity.player.EntityPlayer) ChatComponentText(net.minecraft.util.ChatComponentText) PlayerPreferencesProperties(mcjty.lib.preferences.PlayerPreferencesProperties)

Example 90 with ChatComponentText

use of v1_8_9.net.minecraft.util.ChatComponentText in project RFTools by McJty.

the class CmdSetPower method execute.

@Override
public void execute(ICommandSender sender, String[] args) {
    if (args.length > 2) {
        sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Too many parameters!"));
        return;
    }
    int rf = fetchInt(sender, args, 1, DimletConfiguration.MAX_DIMENSION_POWER);
    World world = sender.getEntityWorld();
    int dim = world.provider.dimensionId;
    RfToolsDimensionManager dimensionManager = RfToolsDimensionManager.getDimensionManager(world);
    DimensionInformation information = dimensionManager.getDimensionInformation(dim);
    if (information == null) {
        sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Not an RFTools dimension!"));
        return;
    }
    DimensionStorage storage = DimensionStorage.getDimensionStorage(world);
    storage.setEnergyLevel(dim, rf);
    storage.save(world);
}
Also used : DimensionStorage(mcjty.rftools.dimension.DimensionStorage) World(net.minecraft.world.World) ChatComponentText(net.minecraft.util.ChatComponentText) DimensionInformation(mcjty.rftools.dimension.DimensionInformation) RfToolsDimensionManager(mcjty.rftools.dimension.RfToolsDimensionManager)

Aggregations

ChatComponentText (net.minecraft.util.ChatComponentText)383 IChatComponent (net.minecraft.util.IChatComponent)55 EntityPlayer (net.minecraft.entity.player.EntityPlayer)43 ChatStyle (net.minecraft.util.ChatStyle)39 ItemStack (net.minecraft.item.ItemStack)36 ClickEvent (net.minecraft.event.ClickEvent)31 World (net.minecraft.world.World)28 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)26 TileEntity (net.minecraft.tileentity.TileEntity)25 ChatComponentTranslation (net.minecraft.util.ChatComponentTranslation)25 HoverEvent (net.minecraft.event.HoverEvent)23 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)21 ArrayList (java.util.ArrayList)17 RfToolsDimensionManager (mcjty.rftools.dimension.RfToolsDimensionManager)16 Block (net.minecraft.block.Block)15 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)15 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)14 Entity (net.minecraft.entity.Entity)14 DimensionInformation (mcjty.rftools.dimension.DimensionInformation)13 File (java.io.File)12