Update to use new ChatUtils

This commit is contained in:
Prospector 2016-05-21 21:51:26 -07:00
parent 7e3cfbe946
commit 8fffe67f17
5 changed files with 35 additions and 16 deletions

View file

@ -1,11 +1,6 @@
package techreborn.blocks;
import java.util.List;
import java.util.Random;
import me.modmuss50.jsonDestroyer.api.ITexturedBlock;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
@ -20,14 +15,20 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.util.ChatUtils;
import techreborn.client.TechRebornCreativeTab;
import techreborn.lib.MessageIDs;
import techreborn.tiles.TilePlayerDectector;
import java.util.List;
import java.util.Random;
public class BlockPlayerDetector extends BlockMachineBase implements ITexturedBlock
{
@ -121,17 +122,19 @@ public class BlockPlayerDetector extends BlockMachineBase implements ITexturedBl
switch (newMeta)
{
case 0:
message = TextFormatting.GREEN + "Detects all Players";
message = TextFormatting.GREEN + I18n.translateToLocal("techreborn.message.allPlayers");
break;
case 1:
message = TextFormatting.RED + "Detects only other Players";
message = TextFormatting.RED + I18n.translateToLocal("techreborn.message.onlyOtherPlayers");
break;
case 2:
message = TextFormatting.BLUE + "Detects only you";
message = TextFormatting.BLUE + I18n.translateToLocal("techreborn.message.onlyYou");
}
if (!world.isRemote)
{
entityPlayer.addChatComponentMessage(new TextComponentString(message));
ChatUtils.sendNoSpamMessages(MessageIDs.playerDetectorID, new TextComponentString(
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.detects") + " "
+ message));
// world.setBlockMetadataWithNotify(x, y, z, newMeta, 2);
}
return true;

View file

@ -18,6 +18,7 @@ import reborncore.RebornCore;
import reborncore.common.util.ChatUtils;
import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.config.ConfigTechReborn;
import techreborn.lib.MessageIDs;
import java.util.List;
@ -43,7 +44,7 @@ public class ItemFrequencyTransmitter extends ItemTextureBase implements ITextur
if (!world.isRemote && ConfigTechReborn.FreqTransmitterChat)
{
ChatUtils.sendNoSpamClient(new TextComponentString(
ChatUtils.sendNoSpamMessages(MessageIDs.freqTransmitterID, new TextComponentString(
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.setTo") + " X: " +
TextFormatting.GOLD + pos.getX() +
TextFormatting.GRAY + " Y: " +
@ -65,7 +66,7 @@ public class ItemFrequencyTransmitter extends ItemTextureBase implements ITextur
stack.setTagCompound(null);
if (!world.isRemote && ConfigTechReborn.FreqTransmitterChat)
{
ChatUtils.sendNoSpamClient(new TextComponentString(
ChatUtils.sendNoSpamMessages(MessageIDs.freqTransmitterID, new TextComponentString(
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.coordsHaveBeen") + " "
+ TextFormatting.GOLD + I18n.translateToLocal("techreborn.message.cleared")));
}

View file

@ -0,0 +1,11 @@
package techreborn.lib;
/**
* @author Prospector on 21/05/16
*/
public class MessageIDs
{
public static int freqTransmitterID = 0;
public static int fluidPipeID = 1;
public static int playerDetectorID = 2;
}

View file

@ -1,7 +1,6 @@
package techreborn.parts.fluidPipes;
import mcmultipart.MCMultiPartMod;
import mcmultipart.block.TileMultipartContainer;
import mcmultipart.microblock.IMicroblock;
import mcmultipart.multipart.*;
import mcmultipart.raytrace.PartMOP;
@ -16,7 +15,6 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.math.AxisAlignedBB;
@ -34,8 +32,10 @@ import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import reborncore.common.misc.Functions;
import reborncore.common.misc.vecmath.Vecs3dCube;
import reborncore.common.packets.PacketHandler;
import reborncore.common.util.*;
import reborncore.common.util.ChatUtils;
import reborncore.common.util.Tank;
import reborncore.common.util.WorldUtils;
import techreborn.lib.MessageIDs;
import techreborn.parts.TechRebornParts;
import java.util.*;
@ -409,7 +409,7 @@ public abstract class MultipartFluidPipe extends Multipart implements INormallyO
newPipe.tank = tank;
MultipartHelper.addPart(world, pos, newPipe);
ChatUtils.sendNoSpamClient(new TextComponentString(
ChatUtils.sendNoSpamMessages(MessageIDs.fluidPipeID, new TextComponentString(
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.setTo") + " " +
type.colour + reborncore.common.util.StringUtils.toFirstCapital(type.getName())));
}

View file

@ -986,6 +986,10 @@ techreborn.message.in=in
techreborn.message.noCoordsSet=No Coordinates Set
techreborn.message.coordsHaveBeen=Coordinates have been
techreborn.message.cleared=Cleared
techreborn.message.detects=Detects
techreborn.message.allPlayers=All Players
techreborn.message.onlyOtherPlayers=Only Other Players
techreborn.message.onlyYou=Only You
#Cables
Cable.copperCable.name=Copper Cable