use of net.minecraft.util.text.TextComponentTranslation in project pnc-repressurized by TeamPneumatic.
the class PacketAmadronTradeAdd method handleServerSide.
@Override
public void handleServerSide(PacketAmadronTradeAdd message, EntityPlayer player) {
AmadronOfferCustom offer = message.getOffer();
offer.updatePlayerId();
if (AmadronOfferManager.getInstance().hasOffer(offer.copy().invert())) {
player.sendStatusMessage(new TextComponentTranslation("message.amadron.duplicateReversedOffer"), false);
} else if (AmadronOfferManager.getInstance().addStaticOffer(offer)) {
if (AmadronOfferSettings.notifyOfTradeAddition)
NetworkHandler.sendToAll(message);
try {
AmadronOfferStaticConfig.INSTANCE.writeToFile();
} catch (IOException e) {
e.printStackTrace();
}
} else {
player.sendStatusMessage(new TextComponentTranslation("message.amadron.duplicateOffer"), false);
}
}
use of net.minecraft.util.text.TextComponentTranslation in project BuildCraft by BuildCraft.
the class CommandHelpers method sendLocalizedChatMessage.
public static void sendLocalizedChatMessage(ICommandSender sender, Style chatStyle, String locTag, Object... args) {
TextComponentTranslation chat = new TextComponentTranslation(locTag, args);
chat.setStyle(chatStyle);
sender.addChatMessage(chat);
}
use of net.minecraft.util.text.TextComponentTranslation in project BiomeTweaker by superckl.
the class CommandListBiomes method execute.
@Override
public void execute(final MinecraftServer server, final ICommandSender sender, final String[] args) throws CommandException {
sender.sendMessage(new TextComponentTranslation("biometweaker.msg.listbiomes.output.text").setStyle(new Style().setColor(TextFormatting.AQUA)));
final Iterator<Biome> it = Biome.REGISTRY.iterator();
while (it.hasNext()) {
final Biome gen = it.next();
if (gen != null) {
final String message = new StringBuilder().append(Biome.getIdForBiome(gen)).append(" - ").append(gen.getBiomeName()).toString();
sender.sendMessage(new TextComponentString(message).setStyle(new Style().setColor(TextFormatting.GOLD)));
}
}
}
use of net.minecraft.util.text.TextComponentTranslation in project BiomeTweaker by superckl.
the class CommandSetBiome method execute.
@Override
public void execute(final MinecraftServer server, final ICommandSender sender, final String[] args) throws CommandException {
final BlockPos coord = sender.getPosition();
final World world = sender.getEntityWorld();
if ((coord != null) && (world != null)) {
if ((args.length < 2) || (args.length > 3)) {
sender.sendMessage(new TextComponentTranslation("biometweaker.msg.setbiome.invalargs.text").setStyle(new Style().setColor(TextFormatting.RED)));
return;
}
Biome gen = null;
Integer i = Ints.tryParse(args[0]);
if (i != null)
gen = Biome.getBiome(i);
else {
final Iterator<Biome> it = Biome.REGISTRY.iterator();
while (it.hasNext()) {
final Biome biome = it.next();
if ((biome != null) && biome.getBiomeName().equals(args[0])) {
gen = biome;
break;
}
}
}
if (gen == null) {
sender.sendMessage(new TextComponentTranslation("biometweaker.msg.setbiome.invalargs.text").setStyle(new Style().setColor(TextFormatting.RED)));
return;
}
final int id = Biome.getIdForBiome(gen);
i = Ints.tryParse(args[1]);
if (i == null) {
sender.sendMessage(new TextComponentTranslation("biometweaker.msg.setbiome.invalargs.text").setStyle(new Style().setColor(TextFormatting.RED)));
return;
}
boolean blocks = true;
if (args.length == 3)
if (args[2].equalsIgnoreCase("block"))
blocks = true;
else if (args[2].equalsIgnoreCase("chunk"))
blocks = false;
else {
sender.sendMessage(new TextComponentTranslation("biometweaker.msg.setbiome.invalargs.text").setStyle(new Style().setColor(TextFormatting.RED)));
return;
}
int count = 0;
if (blocks) {
for (int x = coord.getX() - i; x <= (coord.getX() + i); x++) for (int z = coord.getZ() - i; z <= (coord.getZ() + i); z++) {
final int realX = x & 15;
final int realZ = z & 15;
/*if(x < 0)
realX = 15-realX;
if(z < 0)
realZ = 15-realZ;*/
final Chunk chunk = world.getChunkFromBlockCoords(new BlockPos(x, 0, z));
chunk.getBiomeArray()[(realZ * 16) + realX] = (byte) id;
chunk.markDirty();
count++;
}
sender.sendMessage(new TextComponentTranslation("biometweaker.msg.setbiome.blocksuccess.text", count, gen.getBiomeName()).setStyle(new Style().setColor(TextFormatting.GOLD)));
} else {
final byte[] biomeArray = new byte[256];
Arrays.fill(biomeArray, (byte) id);
final int chunkX = coord.getX() >> 4;
final int chunkZ = coord.getZ() >> 4;
for (int x = chunkX - i; x <= (chunkX + i); x++) for (int z = chunkZ - i; z <= (chunkZ + i); z++) {
final Chunk chunk = world.getChunkFromChunkCoords(x, z);
chunk.setBiomeArray(Arrays.copyOf(biomeArray, biomeArray.length));
chunk.markDirty();
count++;
}
sender.sendMessage(new TextComponentTranslation("biometweaker.msg.setbiome.chunksuccess.text", count, gen.getBiomeName()).setStyle(new Style().setColor(TextFormatting.GOLD)));
}
} else
sender.sendMessage(new TextComponentTranslation("biometweaker.msg.info.invalsender.text").setStyle(new Style().setColor(TextFormatting.RED)));
}
use of net.minecraft.util.text.TextComponentTranslation in project BiomeTweaker by superckl.
the class CommandOutput method execute.
@Override
public void execute(final MinecraftServer server, final ICommandSender sender, final String[] args) throws CommandException {
try {
BiomeTweaker.getInstance().generateOutputFiles();
sender.sendMessage(new TextComponentTranslation("biometweaker.msg.output.success.text").setStyle(new Style().setColor(TextFormatting.AQUA)));
} catch (final IOException e) {
sender.sendMessage(new TextComponentTranslation("biometweaker.msg.output.failure.text").setStyle(new Style().setColor(TextFormatting.RED)));
LogHelper.error("Failed to regenerate output files!");
e.printStackTrace();
}
}
Aggregations