
AubriTheHuman
Members-
Content Count
4 -
Joined
-
Last visited
Community Reputation
0 NeutralAbout AubriTheHuman
-
Rank
Tree Puncher
Converted
-
Gender
Undisclosed
-
Personal Text
I am new!
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
I'm trying to create a HUD overlay to display a timer to the player. However whenever it is rendering it causes the vanilla overlay to do THIS. The player is in survival in that image, and no matter the status effect they look the same. If I remove the lines for drawing text, then the second image is the result. I think the issue may be binding the texture, but given the results of the text drawing I have no idea. Any help here is appreciated this has got me stumped for the past 2 days or so. This is the code for the GuiHUDCoro class. @SideOnly(Side.CLIENT) public class GuiHUDCoro extends Gui { private boolean showGui = true; private int overlayW = 138; private int overlayH = 29; private int barW = 118; private int barH = 16; private int barOffx = 10; private int barOffy = 6; private static ResourceLocation backgroundLocation = new ResourceLocation("corolis:textures/gui/overlay.png"); /** Minecraft instance */ protected Minecraft mc = Minecraft.getMinecraft(); public int chatOffset = 0; //packeted field from packet public static int timeRemain = 0; public static int currMax = 0; public static int sync = 0; @SubscribeEvent public void renderOverlay(RenderGameOverlayEvent event) { if(timeRemain > 0) { GlStateManager.enableAlpha(); mc.getTextureManager().bindTexture(backgroundLocation); this.zLevel = 0.0f; drawTexturedModalRect((event.getResolution().getScaledWidth() / 2) - (overlayW / 2), 0, 0, 0, overlayW, overlayH); //mc.getTextureManager().bindTexture(backgroundLocation); int i = getTimeScale(barW); drawTexturedModalRect((event.getResolution().getScaledWidth() / 2) - (overlayW / 2) + barOffx + (barW - i), barOffy, barW - i, 29, i, barH); //mc.getTextureManager().bindTexture(backgroundLocation); drawTexturedModalRect((event.getResolution().getScaledWidth() / 2) - (overlayW / 2) + barOffx, barOffy, 0, 45, barW, barH); this.zLevel = 20.0f; String s = parseTime(); mc.fontRenderer.drawString(s, (event.getResolution().getScaledWidth() / 2) - mc.fontRenderer.getStringWidth(s) / 2, 10, Integer.parseInt("FFFFFF", 16), true); mc.fontRenderer.drawString(parseMaxTime(), (event.getResolution().getScaledWidth() / 2) + 74, 3, Integer.parseInt("FFFFFF", 16), true); } sync++; sync %= 10; if (sync == 0) { PacketHandler.INSTANCE.sendToServer(new PacketTimeUpdateRequest("com.aubrithehuman.corolis.gui.GuiHUDCoro", "timeRemain", "currMax")); //System.out.println(timeRemain + " | " + currMax); } } private int getTimeScale(int pixels) { int i = currMax; if (i == 0) { i = 18000; } return timeRemain * pixels / i +1; } private String parseTime() { String s = String.format("%02d:%02d", (int) timeRemain / 1200, (int) (timeRemain - ((int) (timeRemain / 1200) * 1200)) / 20, timeRemain); return s; } private String parseMaxTime() { String s = String.format("Max: %02d:%02d", (int) currMax / 1200, (int) (currMax - ((int) (currMax / 1200) * 1200)) / 20, currMax); return s; } } I have registered the render event with the event bus, is there anywhere else I should have registered it? Given its a Gui and not a GuiScreen I don't know if that was necessary.
-
[1.8.9] Data packet not being received by server?
AubriTheHuman replied to AubriTheHuman's topic in Modder Support
Thanks! This was very helpful, not quite working but i'm definitely going to figure this out now! -
[1.8.9] Data packet not being received by server?
AubriTheHuman replied to AubriTheHuman's topic in Modder Support
So does this mean that I cannot send data from client to server period or just not over this type of channel, and also, if those methods cannot send data from client to the server, then what ones do I use? i can find next to nothing on this... I also have a container class that i'm opening on the server side through the GUI handler. If that has to do with anything id like to know, thanks. Container Class http://pastebin.com/32E3WeVD -
Hello everyone, thank you for reading. I am having a bit of a dilemma with sending a data packet nine times each containing a different string to sync information on the gui textboxes in the gui on the client to the tileentities on the client and the server. The client side works fine and everything is dandy but nothing is being received on the server side I believe. any help will be appreciated! GUI Class http://pastebin.com/GAM3QZfn Tile Entity Class http://pastebin.com/sqSpge2F Packet class http://pastebin.com/nhqe7cUP Handler Class http://pastebin.com/4dVLYF2N How I register the channel? http://pastebin.com/qySazBc1 How I register the packet? http://pastebin.com/xcrA8TPu After some looking, I found that the tile entity calls for an S35PacketUpdateTileEntity and Im giving it my custom package (PacketCPU) so is that the problem and is there any way to convert it or am I sending the wrong form of data? Thanks!