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("}"));
}
}
}
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();
}
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));
}
}
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);
}
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);
}
Aggregations