use of net.minecraft.util.text.TextComponentTranslation in project VanillaTeleporter by dyeo.
the class BlockTeleporter method neighborChanged.
@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighbourBlock, BlockPos fromPos) {
if (!world.isRemote) {
TileEntityTeleporter tileentity = (TileEntityTeleporter) world.getTileEntity(pos);
if (tileentity != null) {
boolean isNowPowered = (world.isBlockIndirectlyGettingPowered(pos) > 0);
boolean isAlreadyPowered = tileentity.isPowered();
tileentity.setPowered(isNowPowered);
if (isNowPowered != isAlreadyPowered) {
// there is no way in forge to determine who activated/deactivated the teleporter, so we simply get the closest player
// works for _most_ cases
EntityPlayer player = world.getClosestPlayer(fromPos.getX(), fromPos.getY(), fromPos.getZ(), 32, false);
if (player != null) {
String translationKey = "message." + TeleporterMod.MODID + '_' + this.getClass().getSimpleName() + '.' + (isNowPowered ? "teleporterLocked" : "teleporterUnlocked");
TextComponentTranslation message = new TextComponentTranslation(translationKey);
player.sendMessage(message);
}
}
tileentity.markDirty();
}
}
}
use of net.minecraft.util.text.TextComponentTranslation in project MinecraftForge by MinecraftForge.
the class ClientCommandHandler method format.
//Couple of helpers because the mcp names are stupid and long...
private TextComponentTranslation format(TextFormatting color, String str, Object... args) {
TextComponentTranslation ret = new TextComponentTranslation(str, args);
ret.getStyle().setColor(color);
return ret;
}
use of net.minecraft.util.text.TextComponentTranslation in project MinecraftForge by MinecraftForge.
the class ForgeCommand method doTurnOnTileEntityTracking.
private void doTurnOnTileEntityTracking(MinecraftServer server, ICommandSender sender, int duration) {
ForgeTimeTracker.tileEntityTrackingDuration = duration;
ForgeTimeTracker.tileEntityTracking = true;
sender.sendMessage(new TextComponentTranslation("commands.forge.tracking.te.enabled", duration));
}
use of net.minecraft.util.text.TextComponentTranslation in project MinecraftForge by MinecraftForge.
the class ForgeCommand method displayTPS.
private void displayTPS(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
int dim = 0;
boolean summary = true;
if (args.length > 1) {
dim = parseInt(args[1]);
summary = false;
}
if (summary) {
for (Integer dimId : DimensionManager.getIDs()) {
double worldTickTime = ForgeCommand.mean(server.worldTickTimes.get(dimId)) * 1.0E-6D;
double worldTPS = Math.min(1000.0 / worldTickTime, 20);
sender.sendMessage(new TextComponentTranslation("commands.forge.tps.summary", String.format("Dim %d", dimId), timeFormatter.format(worldTickTime), timeFormatter.format(worldTPS)));
}
double meanTickTime = ForgeCommand.mean(server.tickTimeArray) * 1.0E-6D;
double meanTPS = Math.min(1000.0 / meanTickTime, 20);
sender.sendMessage(new TextComponentTranslation("commands.forge.tps.summary", "Overall", timeFormatter.format(meanTickTime), timeFormatter.format(meanTPS)));
} else {
double worldTickTime = ForgeCommand.mean(server.worldTickTimes.get(dim)) * 1.0E-6D;
double worldTPS = Math.min(1000.0 / worldTickTime, 20);
sender.sendMessage(new TextComponentTranslation("commands.forge.tps.summary", String.format("Dim %d", dim), timeFormatter.format(worldTickTime), timeFormatter.format(worldTPS)));
}
}
use of net.minecraft.util.text.TextComponentTranslation in project ImmersiveEngineering by BluSunrize.
the class TileEntityTurret method hammerUseSide.
@Override
public boolean hammerUseSide(EnumFacing side, EntityPlayer player, float hitX, float hitY, float hitZ) {
if (dummy) {
TileEntity te = worldObj.getTileEntity(getPos().offset(facing, -1));
if (te instanceof TileEntityTurret)
return ((TileEntityTurret) te).hammerUseSide(side, player, hitX, hitY, hitZ);
return false;
}
if (player.isSneaking()) {
redstoneControlInverted = !redstoneControlInverted;
ChatUtils.sendServerNoSpamMessages(player, new TextComponentTranslation(Lib.CHAT_INFO + "rsControl." + (redstoneControlInverted ? "invertedOn" : "invertedOff")));
markDirty();
this.markContainingBlockForUpdate(null);
}
return true;
}
Aggregations