Posted November 27, 20186 yr Here is my code: RenderItem Class: https://hastebin.com/ofugirorey.java but when I launch client it doesn't show the hand I need http://prntscr.com/lnefos want it to look like that. ItemMeele class: https://hastebin.com/bopenumete.java Edited November 27, 20186 yr by FireIsH0t
November 27, 20186 yr Author 19 minutes ago, V0idWa1k3r said: Why are you extending ItemRenderer? You need to use a TEISR, not ItemRenderer. Are you sure? Now when I click ctrl + o I am limited to these methods. http://prntscr.com/lnf97o
November 27, 20186 yr Author Just now, V0idWa1k3r said: Yes, everything is correct. What are you concerned about? On which method I should use and to put my previous code in
November 27, 20186 yr Author package net.arsenalnetwork.arsenalmod.client.render.item; import net.arsenalnetwork.arsenalmod.item.tools.ItemMelee; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderPlayer; import net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import org.lwjgl.opengl.GL12; public class RenderItem extends TileEntityItemStackRenderer { @Override public void renderByItem(ItemStack itemStackIn) { Minecraft mc = Minecraft.getMinecraft(); final EntityPlayer player = Minecraft.getMinecraft().player; if (itemStackIn != null) { GlStateManager.pushMatrix(); if (itemStackIn.getItem() instanceof ItemMelee) { if (!player.isSwingInProgress) { /** * For the right hand */ GlStateManager.pushMatrix(); GlStateManager.glEnableClientState(GL12.GL_RESCALE_NORMAL); mc.getTextureManager().bindTexture(((EntityPlayerSP) player).getLocationSkin()); GlStateManager.translate(1F, 1F, 0F); GlStateManager.rotate(125.0F, 0.0F, 0.0F, 1.0F); GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F); GlStateManager.scale(1.0F, 1.8F, 1.0F); GlStateManager.translate(0.19F, -1.14F, 0.3F); Render render = Minecraft.getMinecraft().getRenderManager().getEntityRenderObject(mc.player); mc.getRenderManager().getEntityRenderObject(mc.player); RenderPlayer renderPlayer = (RenderPlayer)render; float f11 = 1.0F; GlStateManager.scale(f11, f11, f11); renderPlayer.renderRightArm(mc.player); GlStateManager.popMatrix(); } this.renderItemThirdPerson((EntityPlayer) player, itemStackIn); GlStateManager.popMatrix(); return; } } } public void renderItemThirdPerson(EntityPlayer player, ItemStack itemStack) { GlStateManager.translate(0.0F, 0.0F, -0.05F); GlStateManager.rotate(180, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(-15, 0.0F, 0.0F, 1.0F); GlStateManager.rotate(78, 0.0F, 1.0F, 0.0F); GlStateManager.translate(0.0F, 0.7F, 0.25F); GlStateManager.rotate(15, 0.0F, 0.0F, 1.0F); double scale = 1.2D; GlStateManager.scale(scale, scale, scale); } }
November 27, 20186 yr renderByItem. The one that takes in partialTicks aswell as the ItemStack but both work. You are not actually rendering the item in the code you've provided.
November 27, 20186 yr Author 1 minute ago, V0idWa1k3r said: renderByItem. The one that takes in partialTicks aswell as the ItemStack but both work. You are not actually rendering the item in the code you've provided. wym?
November 27, 20186 yr Apart from messing with GL matrix this Quote public void renderItemThirdPerson(EntityPlayer player, ItemStack itemStack) does nothing in your implementation.
November 27, 20186 yr Also 9 minutes ago, FireIsH0t said: if (itemStackIn != null) Which version of the game are you using?
November 27, 20186 yr Author Just now, V0idWa1k3r said: Apart from messing with GL matrix this does nothing in your implementation. So yeah if (itemStackIn.getItem() instanceof ItemMelee) trying to get all the melee items that are created and render that hand. Why doesn't it work like what am i doing wrong?
November 27, 20186 yr Author 1 minute ago, V0idWa1k3r said: Also Which version of the game are you using? 1.12.2
November 27, 20186 yr 5 minutes ago, FireIsH0t said: Why doesn't it work like what am i doing wrong? 7 minutes ago, V0idWa1k3r said: this Quote public void renderItemThirdPerson(EntityPlayer player, ItemStack itemStack) does nothing in your implementation. Also show where you assign the TEISR to your item. 4 minutes ago, FireIsH0t said: 1.12.2 ItemStack can't be null in 1.12.2. It can only be empty. But you already know that not to be the case if the render method is even executed. This check is pointless
November 27, 20186 yr Author 1 minute ago, V0idWa1k3r said: Also show where you assign the TEISR to your item. ItemStack can't be null in 1.12.2. It can only be empty. But you already know that not to be the case if the render method is even executed. This check is pointless @Override public void renderByItem(ItemStack itemStackIn) { Minecraft mc = Minecraft.getMinecraft(); final EntityPlayer player = Minecraft.getMinecraft().player; GlStateManager.pushMatrix(); if (itemStackIn.getItem() instanceof ItemMelee) { if (!player.isSwingInProgress) { /** * For the right hand */ GlStateManager.pushMatrix(); GlStateManager.glEnableClientState(GL12.GL_RESCALE_NORMAL); mc.getTextureManager().bindTexture(((EntityPlayerSP) player).getLocationSkin()); GlStateManager.translate(1F, 1F, 0F); GlStateManager.rotate(125.0F, 0.0F, 0.0F, 1.0F); GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F); GlStateManager.scale(1.0F, 1.8F, 1.0F); GlStateManager.translate(0.19F, -1.14F, 0.3F); Render render = Minecraft.getMinecraft().getRenderManager().getEntityRenderObject(mc.player); mc.getRenderManager().getEntityRenderObject(mc.player); RenderPlayer renderPlayer = (RenderPlayer)render; float f11 = 1.0F; GlStateManager.scale(f11, f11, f11); renderPlayer.renderRightArm(mc.player); GlStateManager.popMatrix(); } this.renderItemThirdPerson((EntityPlayer) player, itemStackIn); GlStateManager.popMatrix(); return; } } Removed that null thing "Also show where you assign the TEISR to your item." ?
November 27, 20186 yr 4 minutes ago, FireIsH0t said: "Also show where you assign the TEISR to your item." ? Exactly as it sounds. a TEISR needs to be assigned to the item using Item#setTileEntityItemStackRenderer(one of the options anyway). Code isn't magic, it's not going to just work because you've made some classes.
November 27, 20186 yr Author @SideOnly(Side.CLIENT) @Nullable private net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer teisr; @SideOnly(Side.CLIENT) public void setTileEntityItemStackRenderer(@Nullable net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer teisr) { this.teisr = teisr; } this right?
November 27, 20186 yr You've shown the methods I told you about. Yes, this is the method you could use.
November 27, 20186 yr Author package net.arsenalnetwork.arsenalmod.client.render.item; import net.arsenalnetwork.arsenalmod.item.tools.ItemMelee; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderPlayer; import net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import org.lwjgl.opengl.GL12; import javax.annotation.Nullable; public class RenderItem extends TileEntityItemStackRenderer { @Override public void renderByItem(ItemStack itemStackIn) { Minecraft mc = Minecraft.getMinecraft(); final EntityPlayer player = Minecraft.getMinecraft().player; GlStateManager.pushMatrix(); if (itemStackIn.getItem() instanceof ItemMelee) { if (!player.isSwingInProgress) { /** * For the right hand */ GlStateManager.pushMatrix(); GlStateManager.glEnableClientState(GL12.GL_RESCALE_NORMAL); mc.getTextureManager().bindTexture(((EntityPlayerSP) player).getLocationSkin()); GlStateManager.translate(1F, 1F, 0F); GlStateManager.rotate(125.0F, 0.0F, 0.0F, 1.0F); GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F); GlStateManager.scale(1.0F, 1.8F, 1.0F); GlStateManager.translate(0.19F, -1.14F, 0.3F); Render render = Minecraft.getMinecraft().getRenderManager().getEntityRenderObject(mc.player); mc.getRenderManager().getEntityRenderObject(mc.player); RenderPlayer renderPlayer = (RenderPlayer)render; float f11 = 1.0F; GlStateManager.scale(f11, f11, f11); renderPlayer.renderRightArm(mc.player); GlStateManager.popMatrix(); } this.renderItemThirdPerson((EntityPlayer) player, itemStackIn); GlStateManager.popMatrix(); return; } } public void renderItemThirdPerson(EntityPlayer player, ItemStack itemStack) { GlStateManager.translate(0.0F, 0.0F, -0.05F); GlStateManager.rotate(180, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(-15, 0.0F, 0.0F, 1.0F); GlStateManager.rotate(78, 0.0F, 1.0F, 0.0F); GlStateManager.translate(0.0F, 0.7F, 0.25F); GlStateManager.rotate(15, 0.0F, 0.0F, 1.0F); double scale = 1.2D; GlStateManager.scale(scale, scale, scale); } @SideOnly(Side.CLIENT) @Nullable private net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer teisr; @SideOnly(Side.CLIENT) public void setTileEntityItemStackRenderer(@Nullable net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer teisr) { this.teisr = teisr; } } ok boom.
November 27, 20186 yr I didn't tell you "Oh, see these methods in the Item class? Yeah, copy them into your TEISR class, it will magically find your class by these methods and just work". I told you 11 minutes ago, V0idWa1k3r said: a TEISR needs to be assigned to the item using Item#setTileEntityItemStackRenderer(one of the options anyway). Code isn't magic, it's not going to just work because you've made some classes. This means "invoke Item#setTileEntityItemStackRenderer to bind your TEISR to the item". No, don't invoke it in your TEISR. Do it somewhere that makes sense, somewhere where you know it will be executed by the game. Like in your client proxy.
November 27, 20186 yr What’s wrong with just using a JSON model? About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
November 27, 20186 yr 5 minutes ago, Cadiboo said: What’s wrong with just using a JSON model? I don't think you can draw a player's hand with a json model since, well, the game renders the quads you provide with the default texture atlas. The player's hand on the other hand uses the player's skin as it's texture, which is a separate texture object. I mean, I can kinda see how you might be able to do it with a custom IBakedModel but it would be breaking multiple things and borderline a dirty hack. I think that a TEISR is a solution here, but feel free to disagree.
November 27, 20186 yr Author 5 minutes ago, V0idWa1k3r said: I don't think you can draw a player's hand with a json model since, well, the game renders the quads you provide with the default texture atlas. The player's hand on the other hand uses the player's skin as it's texture, which is a separate texture object. I mean, I can kinda see how you might be able to do it with a custom IBakedModel but it would be breaking multiple things and borderline a dirty hack. I think that a TEISR is a solution here, but feel free to disagree. I am a bit confused now lol
November 28, 20186 yr Author Alright Update: New RenderBaseBall Class: https://hastebin.com/yatirebome.java And have this in my ClientEventSubscriber: @SubscribeEvent public static void onRegisterModelsEvent(final ModelRegistryEvent event) { ModItems.BASEBALL_BAT.setTileEntityItemStackRenderer(new RenderBaseBallBat()); but the hand still doesnt render onto the baseball bat item
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.