Java Code Examples for net.minecraft.client.Minecraft#getCurrentServerData()
The following examples show how to use
net.minecraft.client.Minecraft#getCurrentServerData() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IPCommand.java From seppuku with GNU General Public License v3.0 | 6 votes |
@Override public void exec(String input) { if (!this.clamp(input, 1, 1)) { this.printUsage(); return; } final Minecraft mc = Minecraft.getMinecraft(); if(mc.getCurrentServerData() != null) { final StringSelection contents = new StringSelection(mc.getCurrentServerData().serverIP); final Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(contents, null); Seppuku.INSTANCE.logChat("Copied IP to clipboard"); }else{ Seppuku.INSTANCE.errorChat("Error, Join a server"); } }
Example 2
Source File: WaypointsModule.java From seppuku with GNU General Public License v3.0 | 5 votes |
@Listener public void render2D(EventRender2D event) { final Minecraft mc = Minecraft.getMinecraft(); final String host = mc.getCurrentServerData() == null ? "localhost" : mc.getCurrentServerData().serverIP; for (WaypointData waypointData : Seppuku.INSTANCE.getWaypointManager().getWaypointDataList()) { if (waypointData != null) { if (host.equalsIgnoreCase(waypointData.getHost()) && mc.player.dimension == waypointData.dimension) { final double dist = mc.player.getDistance(waypointData.getX(), waypointData.getY(), waypointData.getZ()); if (dist >= 5.0f) { final GLUProjection.Projection projection = GLUProjection.getInstance().project(waypointData.getX() - mc.getRenderManager().viewerPosX, waypointData.getY() - mc.getRenderManager().viewerPosY, waypointData.getZ() - mc.getRenderManager().viewerPosZ, GLUProjection.ClampMode.NONE, false); if (projection != null && projection.getType() == GLUProjection.Projection.Type.INSIDE) { final String name = "\247f" + waypointData.getName() + " \247r(\2477" + new DecimalFormat("#.#").format(dist) + "m\247r)"; mc.fontRenderer.drawStringWithShadow(name, (float) projection.getX() - mc.fontRenderer.getStringWidth(name) / 2, (float) projection.getY() - mc.fontRenderer.FONT_HEIGHT / 2, waypointData.getColor()); } if (this.tracers.getValue()) { final GLUProjection.Projection screen = GLUProjection.getInstance().project(waypointData.getX() - mc.getRenderManager().viewerPosX, waypointData.getY() - mc.getRenderManager().viewerPosY, waypointData.getZ() - mc.getRenderManager().viewerPosZ, GLUProjection.ClampMode.NONE, true); if (screen != null) { RenderUtil.drawLine((float) screen.getX(), (float) screen.getY(), event.getScaledResolution().getScaledWidth() / 2, event.getScaledResolution().getScaledHeight() / 2, this.width.getValue(), -1); } } } } } } }