@SubscribeEvent public void RenderTickEvent(RenderTickEvent event) { if ((event.type == Type.RENDER || event.type == Type.CLIENT) && event.phase == Phase.END) { Minecraft mc = Minecraft.getMinecraft(); if (!ticked && mc.ingameGUI != null) { mc.ingameGUI = new GuiAdvancedHUD(mc); ticked = true; } if (firstload && mc != null) { if (!SaveController.loadConfig("config")) { HUDRegistry.checkForResize(); HUDRegistry.resetAllDefaults(); SaveController.saveConfig("config"); } firstload = false; } // TODO Add notification on main menu when an update for advancedhud is available :) // if (mc.currentScreen instanceof GuiMainMenu) { // int mouseX = Mouse.getX() * mc.currentScreen.width / mc.displayWidth; // int mouseY = mc.currentScreen.height - Mouse.getY() * mc.currentScreen.height / mc.displayHeight - 1; // RenderAssist.drawCircle(mouseX, mouseY, 3, 24, 0xFFFFFFFF); // RenderAssist.drawRect(1, 1, 70, 11, 0x608f3eff); // mc.currentScreen.drawString(mc.fontRenderer, "AdvancedHUD!", 2, 2, 0x48dce9); // } } }
@Override public boolean canExecute(Event event) { if (event instanceof TickEvent && ((TickEvent) event).side == Side.CLIENT && ((TickEvent) event).type == Type.PLAYER && ((TickEvent) event).phase == Phase.END) { return ((PlayerTickEvent) event).player.worldObj.provider.dimensionId == this.dimension && ((PlayerTickEvent) event).player.getUniqueID().equals(this.playerUUID); } return false; }
@SubscribeEvent public void tick(TickEvent event) { if(event.phase == Phase.START && (event.type == Type.CLIENT || event.type == Type.SERVER)) { for (int i = 0; i < maxPacketsPerTick; i++) { PacketRequest request = null; if(packetrequest.size() > 0) request = packetrequest.get(0); if(request != null) { boolean issended = false; if(request.toServer && event.side == Side.CLIENT) { PacketHandler.sendPacketToServer(request.packet); issended = true; }else if(!request.toServer && event.side == Side.SERVER){ if(request.player == null) PacketHandler.sendPacketToAllPlayers(request.packet); else PacketHandler.sendPacketToPlayer(request.packet, (EntityPlayerMP) request.player); issended = true; } if(packetrequest.size() > 0 && issended) packetrequest.remove(0); } } } }
@Override public void keyUp(Type types, KeyBinding kb, boolean tickEnd) { }
public abstract void keyDown(Type types, KeyBinding kb, boolean tickEnd, boolean isRepeat);
public abstract void keyUp(Type types, KeyBinding kb, boolean tickEnd);