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.

Spyeedy

Forge Modder
  • Joined

  • Last visited

Everything posted by Spyeedy

  1. It used to be part of the code last time. Thanks for the reminder, I'm removing it.
  2. For some reason, it ain't showing on the slots.
  3. IInventory#getStackInSlot? What method do I call to render the Item in the slot?
  4. I see, but how do will my overlay know what item is in the gui slot so as to render my item in either slot 1 or slot 2?
  5. So I am wondering how the hotbar works as I have an overlay, that has been made, that I want to be connected to my GUI's slot. Here's my code for that Overlay I was talking about: [spoiler=Gui Overlay] public class GuiWeaponSlots extends Gui { private static final ResourceLocation texture = new ResourceLocation(Reference.MOD_ID + ":textures/gui/weaponSlots.png"); @SubscribeEvent(priority=EventPriority.NORMAL) public void onRenderGameOverlay(RenderGameOverlayEvent.Post event) { if (event.isCancelable() || event.type != ElementType.EXPERIENCE) { Minecraft mc = Minecraft.getMinecraft(); ScaledResolution sr = new ScaledResolution(mc); int i = sr.getScaledWidth() / 2; ItemStack stack = mc.thePlayer.inventory.getItemStack(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); mc.getTextureManager().bindTexture(texture); this.drawTexturedModalRect(i - 121, sr.getScaledHeight() - 22, 0, 0, 22, 22); this.drawTexturedModalRect(i + 101, sr.getScaledHeight() - 22, 0, 0, 22, 22); } } } [spoiler=GUI (slots)] public class GuiWeapons extends GuiContainer { private float xSize_lo; private float ySize_lo; private static ResourceLocation slot = new ResourceLocation(Reference.MOD_ID + ":textures/gui/gui_heroesWeapons.png"); public GuiWeapons(EntityPlayer player, InventoryPlayer invPlayer, InventoryWeapons invWeapons) { super(new ContainerWeapons(player, invPlayer, invWeapons)); this.xSize = 256; this.ySize = 146; } @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { super.drawScreen(mouseX, mouseY, partialTicks); this.xSize_lo = mouseX; this.ySize_lo = mouseY; } @Override protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { int i = (this.width - this.xSize) / 2; int j = (this.height - this.ySize) / 2; int x = i + this.xSize / 2; int y = j + this.ySize / 2 + 25; this.mc.getTextureManager().bindTexture(slot); this.drawTexturedModalRect(i, j, 0, 0, xSize, ySize); drawEntityOnScreen(x, y, 40, (float)(i + 51) - this.xSize_lo, (float)(j + 75 - 50) - this.ySize_lo, mc.thePlayer); } public static void drawEntityOnScreen(int posX, int posY, int scale, float mouseX, float mouseY, EntityLivingBase ent) { GlStateManager.enableColorMaterial(); GlStateManager.pushMatrix(); GlStateManager.translate((float)posX, (float)posY, 50.0F); GlStateManager.scale((float)(-scale), (float)scale, (float)scale); GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); float f = ent.renderYawOffset; float f1 = ent.rotationYaw; float f2 = ent.rotationPitch; float f3 = ent.prevRotationYawHead; float f4 = ent.rotationYawHead; GlStateManager.rotate(135.0F, 0.0F, 1.0F, 0.0F); RenderHelper.enableStandardItemLighting(); GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(-((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F); ent.renderYawOffset = (float)Math.atan((double)(mouseX / 40.0F)) * 20.0F; ent.rotationYaw = (float)Math.atan((double)(mouseX / 40.0F)) * 40.0F; ent.rotationPitch = -((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F; ent.rotationYawHead = ent.rotationYaw; ent.prevRotationYawHead = ent.rotationYaw; GlStateManager.translate(0.0F, 0.0F, 0.0F); RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager(); rendermanager.setPlayerViewY(180.0F); rendermanager.setRenderShadow(false); rendermanager.renderEntityWithPosYaw(ent, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); rendermanager.setRenderShadow(true); ent.renderYawOffset = f; ent.rotationYaw = f1; ent.rotationPitch = f2; ent.prevRotationYawHead = f3; ent.rotationYawHead = f4; GlStateManager.popMatrix(); RenderHelper.disableStandardItemLighting(); GlStateManager.disableRescaleNormal(); GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); GlStateManager.disableTexture2D(); GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); } } Thanks in advance.
  6. Just vomiting copy-pasta code into your post is not encouraged as a form of answering in this forum, thank you. Oh sorry! I will keep that in mind in future posts
  7. Here's how: RenderingRegistry.registerEntityRenderingHandler(EntityGreenGoblinGlider.class, new IRenderFactory<EntityGreenGoblinGlider>() { @Override public Render<? super EntityGreenGoblinGlider> createRenderFor(RenderManager manager) { return new RenderGreenGoblinGlider(manager); } });
  8. No, it's specified in the block model JSON, code below is an example of a vanilla's block model [spoiler=Beacon Block Model JSON] { "ambientocclusion": false, "textures": { "particle": "blocks/glass", "glass": "blocks/glass", "obsidian": "blocks/obsidian", "beacon": "blocks/beacon" }, "elements": [ { "__comment": "Glass shell", "from": [ 0, 0, 0 ], "to": [ 16, 16, 16 ], "faces": { "down": { "uv": [ 0, 0, 16, 16 ], "texture": "#glass" }, "up": { "uv": [ 0, 0, 16, 16 ], "texture": "#glass" }, "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#glass" }, "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#glass" }, "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#glass" }, "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#glass" } } }, { "__comment": "Obsidian base", "from": [ 2, 0.1, 2 ], "to": [ 14, 3, 14 ], "faces": { "down": { "uv": [ 2, 2, 14, 14 ], "texture": "#obsidian" }, "up": { "uv": [ 2, 2, 14, 14 ], "texture": "#obsidian" }, "north": { "uv": [ 2, 13, 14, 16 ], "texture": "#obsidian" }, "south": { "uv": [ 2, 13, 14, 16 ], "texture": "#obsidian" }, "west": { "uv": [ 2, 13, 14, 16 ], "texture": "#obsidian" }, "east": { "uv": [ 2, 13, 14, 16 ], "texture": "#obsidian" } } }, { "__comment": "Inner beacon texture", "from": [ 3, 3, 3 ], "to": [ 13, 14, 13 ], "faces": { "down": { "uv": [ 3, 3, 13, 13 ], "texture": "#beacon" }, "up": { "uv": [ 3, 3, 13, 13 ], "texture": "#beacon" }, "north": { "uv": [ 3, 2, 13, 13 ], "texture": "#beacon" }, "south": { "uv": [ 3, 2, 13, 13 ], "texture": "#beacon" }, "west": { "uv": [ 3, 2, 13, 13 ], "texture": "#beacon" }, "east": { "uv": [ 3, 2, 13, 13 ], "texture": "#beacon" } } } ] } It's specified above all the other textures used for the block's appearance, "particle": "modid:blocks/texture_name",.
  9. My Entity for some reason I do not know does not move when the player is riding it. Purpose of the Entity: A mode of transportation for the player, it can fly and no fall damage is to be received when mid-flight fall. [spoiler=Entity Class] public class EntityGreenGoblinGlider extends EntityCreature { /** AI task for player control. */ private final EntityAIControlledByPlayer aiControlledByPlayer; public EntityGreenGoblinGlider(World worldIn) { super(worldIn); this.tasks.addTask(0, this.aiControlledByPlayer = new EntityAIControlledByPlayer(this, 10.0F)); } @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D); } @Override public boolean canBeSteered() { return true; } @Override public boolean interact(EntityPlayer player) { if (super.interact(player)) { return true; } else if (this.worldObj.isRemote || this.riddenByEntity != null && this.riddenByEntity != player) { return false; } else { player.mountEntity(this); return true; } } /** * Return the AI task for player control. */ public EntityAIControlledByPlayer getAIControlledByPlayer() { return this.aiControlledByPlayer; } } Where did I go wrong?
  10. Trust me, very very bad idea.
  11. Don't start an argument on whether idea is better than eclipse and vice versa.
  12. Thanks, sometimes the simplest things can be overlooked.
  13. I'm not sure where I went wrong in my Model class as it's giving out a NullPointerException. Gist here. Error in console: Thanks in advance!
  14. Well yeah, if you didn't pick sub-event and type, then you are scaling everything. You need to scale and then revert (and/or use push/pop matrix). For any other question related to GL I will autoomatically send you to google and Gui.class and a LOT of other vanilla sources which give examples. Thanks for the push/pop matrix advice, it worked! Sorry for the trouble, first time working with GL11 and RenderGameOverlayEvent
  15. Using GL11.glScalef in the method increaes the entire overlay, the hotbar, health etc
  16. What do you mean "Post sub-event" and "PHASE (event.phase)"?
  17. Typo error, anyway.. i have yet to create the class, what do you mean "draw inside event"? My question was where do I call the gui and how do I have it displayed as a gui overlay when the player wears a particular armor?
  18. So I created a class which extends Gui and apply the texture etc, but where do I call the gui from to have it as a gui overlay when the player wears his armor?
  19. Is it possible to make my gui overlay bigger without modifying the scale in the texture image? Code here.
  20. In your BlockGrinder class, in the onBlockActivated method, you should not be using EntityPlayer#displayGUIChest, you should be using EntityPlayer#openGui
  21. For the life of me, I can't figure why my custom dimension is empty. Github here. I registered my dimensions in Main.preInit while biomes are registered in CommonProxy.preInit. The files (worldProvider, biome etc) are located in the dimensions folder.
  22. Ah, so that's how they do it, smart, so the armors are basically a layered armor above the player's skin but a larger scale than the player, fascinating. Thanks Choonster
  23. Is there a ModelArmor? If not, then how do Minecraft render the armor bigger than the player?
  24. And why should I use tabula? It's for 1.8.0, I'm working on 1.8.9. Besides, Techne is easy to use and I can always fix the rotation point myself, gives a little more "hands-on".

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.