Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

HappyKiller1O1

Members
  • Joined

  • Last visited

Everything posted by HappyKiller1O1

  1. So, creating my own would render it over the items? I do not see how this would work.
  2. If you want to use "getUnlocalizedName" do this: this.setBlockName(MODID + ":" + this.getUnlocalizedName().substring(5)); This removes the first five characters of the unlocalized name so you get "someblock". Java won't read past characters like "." and ":" unless you use splitString() I believe.
  3. No, it doesn't. I fixed it by rendering the items on the gui after I rendered the overlay. But, the items overlap the overlay. How would I render the items behind the overlay?
  4. That works but, it's still doing what was shown above. Am I doing something wrong with OpenGL? public class GuiShopBlock extends GuiScreen { public static final ResourceLocation texture = new ResourceLocation(MR.TNAME + "textures/gui/crew_shop.png"); private static final ResourceLocation crewShopPurchase = new ResourceLocation(MR.TNAME + "textures/gui/crew_shop_purchase.png"); private int xSize; private int ySize; RenderItem renderedItem; private static boolean displayE; public GuiShopBlock() { this.xSize = 176; this.ySize = 166; renderedItem = new RenderItem(); displayE = false; } public void initGui() { int k = (this.width - this.xSize) / 2; int l = (this.height - this.ySize) / 2; buttonList.clear(); //buttonList.add(new GuiSlider(0, k + 25, l + 25, 30, 20, "", "", 1, 64, 1, false, true)); } public void actionPerformed(GuiButton button) { } public void drawScreen(int x, int y, float f) { //Add buttons for shop GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); int k = (this.width - this.xSize) / 2; int l = (this.height - this.ySize) / 2; mc.getTextureManager().bindTexture(texture); this.drawTexturedModalRect(k, l, 0, 0, xSize, ySize); this.drawString(mc.fontRenderer, "Crew Shop", k + 60, l + 4, 0xFFFFFF); this.renderItemOnGui(Items.emerald, 0, 0); this.renderItemOnGui(Items.diamond, 100, 0); this.drawToolTips(x, y); if(this.getDisplayE()) { this.drawPurchaseOverlay("Emerald", Items.emerald, 500); } super.drawScreen(x, y, f); } public void drawToolTips(int mouseX, int mouseY) { int boxX = (this.width - this.xSize) / 2 + 25; int boxY = (this.height - this.ySize) / 2 + 25; int defaultX = 16; int defaultY = 16; if(mouseX > boxX && mouseX < boxX + defaultX && mouseY > boxY && mouseY < boxY + defaultY) { List list = new ArrayList(); list.add("DEAFULT TEXT"); this.drawHoveringText(list, mouseX, mouseY, fontRendererObj); //System.out.println("SHOULD DRAW THE TEXT"); } } public void mouseClicked(int mouseX, int mouseY, int which) { int boxX = (this.width - this.xSize) / 2 + 25; int boxY = (this.height - this.ySize) / 2 + 25; int defaultX = 16; int defaultY = 16; if(mouseX > boxX && mouseX < boxX + defaultX && mouseY > boxY && mouseY < boxY + defaultY) { this.displayE = true; //FMLNetworkHandler.openGui(this.mc.thePlayer, CrewMod.instance, GuiId.guiPurchase, this.mc.theWorld, (int)this.mc.thePlayer.posX, (int)this.mc.thePlayer.posY, (int)this.mc.thePlayer.posZ); //System.out.println("SHOULD DISPLAY EMERALD SCREEN"); } super.mouseClicked(mouseX, mouseY, which); } public void renderItemOnGui(Item item, int mulX, int mulY) { int k = (this.width - this.xSize) / 2 + 25; int l = (this.height - this.ySize) / 2 + 25; GL11.glPushMatrix(); RenderHelper.enableGUIStandardItemLighting(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glEnable(GL11.GL_LIGHTING); //GL11.glScalef(2.00F, 2.00F, 2.00F); renderedItem.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), new ItemStack(item), k + mulX, l + mulY); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glPopMatrix(); } private void drawPurchaseOverlay(String title, Item itemForRender, int price) { GL11.glPushMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); int k = (this.width - this.xSize) / 2; int l = (this.height - this.ySize) / 2; mc.getTextureManager().bindTexture(crewShopPurchase); this.drawTexturedModalRect(k, l, 0, 0, this.width, this.height); this.drawCenteredString(mc.fontRenderer, "Purchase: " + title + "'s", k, l, 0xFFFFFF); RenderHelper.enableGUIStandardItemLighting(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glEnable(GL11.GL_LIGHTING); //GL11.glScalef(2.00F, 2.00F, 2.00F); renderedItem.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), new ItemStack(itemForRender), k + 25, l + 25); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glPopMatrix(); } public boolean doesGuiPauseGame() { return false; } public static boolean getDisplayE() { return displayE; } }
  5. I'm stupid huh? I'll go do that now
  6. Wait, are you making this mod for like a factions server or something?
  7. If you're wondering, when I click the Emerald is when it attempts to draw the texture overlay.
  8. So, I am trying to do what you told me Ernio but, this happens. ;-; http://i.imgur.com/Lqfv5jY.png http://i.imgur.com/eWQHSBh.png Here's where I render it in my EventForgeClient Class: @SubscribeEvent public void onGuiScreenDrawn(DrawScreenEvent event) { int width = event.gui.width; int height = event.gui.height; int xSize = 80; int ySize = 40; if(event.gui instanceof GuiShopBlock) { if(GuiShopBlock.getDisplayE()) { this.drawPurchaseOverlay("Emerald", Items.emerald, 500, width, height, xSize, ySize, event.gui.mc, event.gui); System.out.println("Emerald is True"); } } } private void drawPurchaseOverlay(String title, Item itemForRender, int price, int width, int height, int xSize, int ySize, Minecraft mc, GuiScreen gui) { GL11.glPushMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); int k = (width - xSize) / 2; int l = (height - ySize) / 2; mc.getTextureManager().bindTexture(crewShopPurchase); gui.drawTexturedModalRect(k, l, 0, 0, width, height); gui.drawCenteredString(mc.fontRenderer, "Purchase: " + title + "'s", k, l, 0xFFFFFF); RenderHelper.enableGUIStandardItemLighting(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glEnable(GL11.GL_LIGHTING); //GL11.glScalef(2.00F, 2.00F, 2.00F); renderedItem.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), new ItemStack(itemForRender), k + 25, l + 25); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glPopMatrix(); }
  9. That is so much work. ;-; I think I'll just have to deal with not having it drawn over. I have way too many gui's to display over.
  10. diesieben07 is right, you should register them like: setBlockTexture(ModResources.MODID + ":" + "TextureName");
  11. I didn't know using displayGuiScreen did that, but thanks. I already know how to make a gui handler, just thought that way was easier. And, how would I use those events to display a Gui over another? Maybe just a simple example would be nice.
  12. Is this simply a GuiScreen or, a GuiContainer?
  13. Hm. You load the entity texture in your client proxy, correct?
  14. Because this is a client class, you can get the instance of Minecraft "Minecraft mc = Minecraft.getMinecraft" and use the "thePlayer". I believe when you do sendToAll, it thinks there is more than one player. Just try my idea and see if it works. If it doesn't, then your packet is returning null.
  15. The TagCompound is like the "house" for data. The Tag is the "Category" and the Integer is a int or number that they are grabbing from that tag.
  16. You're sending the packet to the server. Just do "sendTo" not "sendToAll".
  17. NBT is the way Minecraft saves data to be collected in the future. Read this: http://www.minecraftforge.net/wiki/How_to_use_NBT_Tag_Compound
  18. The title says it all. I want to render a gui over another gui that is already displayed. I went to the Minecraft.displayGuiScreen to see if there is a work around but it seems to always close the gui if another is going to be displayed. Any way around this?
  19. If you go to your src folder, wherever it may be, you should be able to click main, resources, assets, YOURMODID, textures, blocks. I feel like you might of named "assets" "assets.sa".
  20. It's kinda funny because cpw made a GuiSlider class so you can easily implement it. Thanks for the explanation though.
  21. Actually, I can't use THAT one because it relays on GameSettings to work. I did find the GuiSlider class but, don't really know how to use it. See, I need it to set a value (like lets say 10) then take that value to be able to purchase 10 of that item.
  22. Hey, so all I want to do is add a slider (like minecraft does for the FOV and such) to my Gui and use it for my own purpose. I just can't figure out what to do.
  23. ScratchForFun on youtube actually made a few videos covering the creation of battery's and such. You should check them out!
  24. Well, go into the game and hold F3 + H (To bring up detailed item tooltips) then, get the wither skull metadata. After this, make the crafting recipe: ItemStack stack = new ItemStack(Items.skull, 1, metadata); //Crafting recipe
  25. I know it's a problem with eclipse but they have never helped me.

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.