Update to use new ChatUtils
This commit is contained in:
parent
7e3cfbe946
commit
8fffe67f17
5 changed files with 35 additions and 16 deletions
|
@ -1,11 +1,6 @@
|
||||||
package techreborn.blocks;
|
package techreborn.blocks;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import me.modmuss50.jsonDestroyer.api.ITexturedBlock;
|
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.properties.PropertyInteger;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
import net.minecraft.block.state.IBlockState;
|
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.math.BlockPos;
|
||||||
import net.minecraft.util.text.TextComponentString;
|
import net.minecraft.util.text.TextComponentString;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
import net.minecraft.util.text.translation.I18n;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import reborncore.common.blocks.BlockMachineBase;
|
import reborncore.common.blocks.BlockMachineBase;
|
||||||
|
import reborncore.common.util.ChatUtils;
|
||||||
import techreborn.client.TechRebornCreativeTab;
|
import techreborn.client.TechRebornCreativeTab;
|
||||||
|
import techreborn.lib.MessageIDs;
|
||||||
import techreborn.tiles.TilePlayerDectector;
|
import techreborn.tiles.TilePlayerDectector;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class BlockPlayerDetector extends BlockMachineBase implements ITexturedBlock
|
public class BlockPlayerDetector extends BlockMachineBase implements ITexturedBlock
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -121,17 +122,19 @@ public class BlockPlayerDetector extends BlockMachineBase implements ITexturedBl
|
||||||
switch (newMeta)
|
switch (newMeta)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
message = TextFormatting.GREEN + "Detects all Players";
|
message = TextFormatting.GREEN + I18n.translateToLocal("techreborn.message.allPlayers");
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
message = TextFormatting.RED + "Detects only other Players";
|
message = TextFormatting.RED + I18n.translateToLocal("techreborn.message.onlyOtherPlayers");
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
message = TextFormatting.BLUE + "Detects only you";
|
message = TextFormatting.BLUE + I18n.translateToLocal("techreborn.message.onlyYou");
|
||||||
}
|
}
|
||||||
if (!world.isRemote)
|
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);
|
// world.setBlockMetadataWithNotify(x, y, z, newMeta, 2);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -18,6 +18,7 @@ import reborncore.RebornCore;
|
||||||
import reborncore.common.util.ChatUtils;
|
import reborncore.common.util.ChatUtils;
|
||||||
import techreborn.client.TechRebornCreativeTabMisc;
|
import techreborn.client.TechRebornCreativeTabMisc;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
|
import techreborn.lib.MessageIDs;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -43,7 +44,7 @@ public class ItemFrequencyTransmitter extends ItemTextureBase implements ITextur
|
||||||
|
|
||||||
if (!world.isRemote && ConfigTechReborn.FreqTransmitterChat)
|
if (!world.isRemote && ConfigTechReborn.FreqTransmitterChat)
|
||||||
{
|
{
|
||||||
ChatUtils.sendNoSpamClient(new TextComponentString(
|
ChatUtils.sendNoSpamMessages(MessageIDs.freqTransmitterID, new TextComponentString(
|
||||||
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.setTo") + " X: " +
|
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.setTo") + " X: " +
|
||||||
TextFormatting.GOLD + pos.getX() +
|
TextFormatting.GOLD + pos.getX() +
|
||||||
TextFormatting.GRAY + " Y: " +
|
TextFormatting.GRAY + " Y: " +
|
||||||
|
@ -65,7 +66,7 @@ public class ItemFrequencyTransmitter extends ItemTextureBase implements ITextur
|
||||||
stack.setTagCompound(null);
|
stack.setTagCompound(null);
|
||||||
if (!world.isRemote && ConfigTechReborn.FreqTransmitterChat)
|
if (!world.isRemote && ConfigTechReborn.FreqTransmitterChat)
|
||||||
{
|
{
|
||||||
ChatUtils.sendNoSpamClient(new TextComponentString(
|
ChatUtils.sendNoSpamMessages(MessageIDs.freqTransmitterID, new TextComponentString(
|
||||||
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.coordsHaveBeen") + " "
|
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.coordsHaveBeen") + " "
|
||||||
+ TextFormatting.GOLD + I18n.translateToLocal("techreborn.message.cleared")));
|
+ TextFormatting.GOLD + I18n.translateToLocal("techreborn.message.cleared")));
|
||||||
}
|
}
|
||||||
|
|
11
src/main/java/techreborn/lib/MessageIDs.java
Normal file
11
src/main/java/techreborn/lib/MessageIDs.java
Normal 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;
|
||||||
|
}
|
|
@ -1,7 +1,6 @@
|
||||||
package techreborn.parts.fluidPipes;
|
package techreborn.parts.fluidPipes;
|
||||||
|
|
||||||
import mcmultipart.MCMultiPartMod;
|
import mcmultipart.MCMultiPartMod;
|
||||||
import mcmultipart.block.TileMultipartContainer;
|
|
||||||
import mcmultipart.microblock.IMicroblock;
|
import mcmultipart.microblock.IMicroblock;
|
||||||
import mcmultipart.multipart.*;
|
import mcmultipart.multipart.*;
|
||||||
import mcmultipart.raytrace.PartMOP;
|
import mcmultipart.raytrace.PartMOP;
|
||||||
|
@ -16,7 +15,6 @@ import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.network.PacketBuffer;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.*;
|
import net.minecraft.util.*;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
@ -34,8 +32,10 @@ import net.minecraftforge.fluids.FluidTankInfo;
|
||||||
import net.minecraftforge.fluids.IFluidHandler;
|
import net.minecraftforge.fluids.IFluidHandler;
|
||||||
import reborncore.common.misc.Functions;
|
import reborncore.common.misc.Functions;
|
||||||
import reborncore.common.misc.vecmath.Vecs3dCube;
|
import reborncore.common.misc.vecmath.Vecs3dCube;
|
||||||
import reborncore.common.packets.PacketHandler;
|
import reborncore.common.util.ChatUtils;
|
||||||
import reborncore.common.util.*;
|
import reborncore.common.util.Tank;
|
||||||
|
import reborncore.common.util.WorldUtils;
|
||||||
|
import techreborn.lib.MessageIDs;
|
||||||
import techreborn.parts.TechRebornParts;
|
import techreborn.parts.TechRebornParts;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -409,7 +409,7 @@ public abstract class MultipartFluidPipe extends Multipart implements INormallyO
|
||||||
newPipe.tank = tank;
|
newPipe.tank = tank;
|
||||||
MultipartHelper.addPart(world, pos, newPipe);
|
MultipartHelper.addPart(world, pos, newPipe);
|
||||||
|
|
||||||
ChatUtils.sendNoSpamClient(new TextComponentString(
|
ChatUtils.sendNoSpamMessages(MessageIDs.fluidPipeID, new TextComponentString(
|
||||||
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.setTo") + " " +
|
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.setTo") + " " +
|
||||||
type.colour + reborncore.common.util.StringUtils.toFirstCapital(type.getName())));
|
type.colour + reborncore.common.util.StringUtils.toFirstCapital(type.getName())));
|
||||||
}
|
}
|
||||||
|
|
|
@ -986,6 +986,10 @@ techreborn.message.in=in
|
||||||
techreborn.message.noCoordsSet=No Coordinates Set
|
techreborn.message.noCoordsSet=No Coordinates Set
|
||||||
techreborn.message.coordsHaveBeen=Coordinates have been
|
techreborn.message.coordsHaveBeen=Coordinates have been
|
||||||
techreborn.message.cleared=Cleared
|
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
|
#Cables
|
||||||
Cable.copperCable.name=Copper Cable
|
Cable.copperCable.name=Copper Cable
|
||||||
|
|
Loading…
Add table
Reference in a new issue