opssemnik Posted October 29, 2012 Posted October 29, 2012 Hi im making a mod, i´ve made a control which i want to render in 3d like the portal gun but the render is giving me a error here is the error 2012-10-29 19:30:22 [iNFO] [ForgeModLoader] Forge Mod Loader version 4.2.6.422 for Minecraft 1.4.2 loading 2012-10-29 19:30:23 [iNFO] [sTDOUT] 27 achievements 2012-10-29 19:30:23 [iNFO] [sTDOUT] 208 recipes 2012-10-29 19:30:23 [iNFO] [sTDOUT] Setting user: Player682, - 2012-10-29 19:30:23 [iNFO] [sTDERR] Client asked for parameter: server 2012-10-29 19:30:23 [iNFO] [sTDOUT] LWJGL Version: 2.4.2 2012-10-29 19:30:23 [iNFO] [ForgeModLoader] Attempting early MinecraftForge initialization 2012-10-29 19:30:23 [iNFO] [sTDOUT] MinecraftForge v6.0.1.347 Initialized 2012-10-29 19:30:23 [iNFO] [ForgeModLoader] MinecraftForge v6.0.1.347 Initialized 2012-10-29 19:30:23 [iNFO] [ForgeModLoader] Completed early MinecraftForge initialization 2012-10-29 19:30:24 [iNFO] [ForgeModLoader] Searching C:\Users\Antônio\Desktop\mcp717_pre3\jars\mods for mods 2012-10-29 19:30:24 [iNFO] [ForgeModLoader] Forge Mod Loader has identified 4 mods to load 2012-10-29 19:30:24 [iNFO] [ForgeModLoader] Configured a dormant chunk cache size of 0 2012-10-29 19:30:24 [iNFO] [sTDOUT] Starting up SoundSystem... 2012-10-29 19:30:25 [iNFO] [sTDOUT] Initializing LWJGL OpenAL 2012-10-29 19:30:25 [iNFO] [sTDOUT] (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) 2012-10-29 19:30:25 [iNFO] [sTDOUT] OpenAL initialized. 2012-10-29 19:30:25 [WARNING] [ForgeModLoader] Mod TheFunMod attempted to register a gui network handler during a construction phase 2012-10-29 19:30:25 [iNFO] [ForgeModLoader] Forge Mod Loader has successfully loaded 4 mods 2012-10-29 19:30:31 [iNFO] [ForgeModLoader] Loading dimension 0 (New World) (net.minecraft.src.IntegratedServer@625a643c) 2012-10-29 19:30:31 [iNFO] [ForgeModLoader] Loading dimension 7 (New World) (net.minecraft.src.IntegratedServer@625a643c) 2012-10-29 19:30:31 [iNFO] [ForgeModLoader] Loading dimension 1 (New World) (net.minecraft.src.IntegratedServer@625a643c) 2012-10-29 19:30:31 [iNFO] [ForgeModLoader] Loading dimension -1 (New World) (net.minecraft.src.IntegratedServer@625a643c) 2012-10-29 19:30:34 [iNFO] [ForgeModLoader] Unloading dimension 0 2012-10-29 19:30:34 [iNFO] [ForgeModLoader] Unloading dimension -1 2012-10-29 19:30:34 [iNFO] [ForgeModLoader] Unloading dimension 1 2012-10-29 19:30:34 [iNFO] [ForgeModLoader] Unloading dimension 7 2012-10-29 19:30:34 [iNFO] [sTDERR] java.lang.ClassCastException: net.minecraft.src.RenderBlocks cannot be cast to net.minecraft.src.Entity 2012-10-29 19:30:34 [iNFO] [sTDERR] at FunMod.cliente.ItemRenderControle.renderItem(ItemRenderControle.java:55) 2012-10-29 19:30:34 [iNFO] [sTDERR] at net.minecraftforge.client.ForgeHooksClient.renderInventoryItem(ForgeHooksClient.java:329) 2012-10-29 19:30:34 [iNFO] [sTDERR] at net.minecraft.src.RenderItem.func_82406_b(RenderItem.java:311) 2012-10-29 19:30:34 [iNFO] [sTDERR] at net.minecraft.src.GuiContainer.drawSlotInventory(GuiContainer.java:270) 2012-10-29 19:30:34 [iNFO] [sTDERR] at net.minecraft.src.GuiContainer.drawScreen(GuiContainer.java:81) 2012-10-29 19:30:34 [iNFO] [sTDERR] at net.minecraft.src.InventoryEffectRenderer.drawScreen(InventoryEffectRenderer.java:38) 2012-10-29 19:30:34 [iNFO] [sTDERR] at net.minecraft.src.GuiContainerCreative.drawScreen(GuiContainerCreative.java:551) 2012-10-29 19:30:34 [iNFO] [sTDERR] at net.minecraft.src.EntityRenderer.updateCameraAndRender(EntityRenderer.java:976) 2012-10-29 19:30:34 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:884) 2012-10-29 19:30:34 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.run(Minecraft.java:779) 2012-10-29 19:30:34 [iNFO] [sTDERR] at java.lang.Thread.run(Unknown Source) 2012-10-29 19:30:44 [iNFO] [sTDOUT] Stopping! 2012-10-29 19:30:44 [iNFO] [sTDOUT] SoundSystem shutting down... 2012-10-29 19:30:44 [iNFO] [sTDOUT] Author: Paul Lamb, www.paulscode.com 2012-10-29 19:30:58 [iNFO] [sTDERR] Someone is closing me! And here is the code package FunMod.cliente; import net.minecraft.client.Minecraft; import net.minecraft.src.Block; import net.minecraft.src.Entity; import net.minecraft.src.EntityItem; import net.minecraft.src.EntityLiving; import net.minecraft.src.EntityPlayer; import net.minecraft.src.GuiInventory; import net.minecraft.src.ItemStack; import net.minecraft.src.ModelBase; import net.minecraft.src.RenderBlocks; import net.minecraft.src.RenderManager; import net.minecraft.src.Tessellator; import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.client.IItemRenderer; import org.lwjgl.opengl.GL11; public class ItemRenderControle implements IItemRenderer { protected ModelBase gunModel = new ModelControle(); public boolean shouldUseRenderHelper(ItemRenderType var1, ItemStack var2, ItemRendererHelper var3) { return false; } public void renderItem(ItemRenderType var1, ItemStack var2, Object ... var3) { GL11.glPushMatrix(); ForgeHooksClient.bindTexture("/FunMod/cliente/texturas/modelos/controle.png", 0); if (var3[0] != null && var3[0] instanceof EntityPlayer) { if ((EntityPlayer)var3[0] == Minecraft.getMinecraft().renderViewEntity && Minecraft.getMinecraft().gameSettings.thirdPersonView == 0 && (!(Minecraft.getMinecraft().currentScreen instanceof GuiInventory) || RenderManager.instance.playerViewY != 180.0F)) { GL11.glTranslatef(0.45F, 0.75F, 0.0F); } else { GL11.glTranslatef(0.65F, 0.75F, 0.0F); } GL11.glScalef(1.8F, 1.8F, 1.8F); GL11.glRotatef(84.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-35.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(181.0F, 0.0F, 0.0F, 1.0F); } this.gunModel.render((Entity)var3[0], 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); ForgeHooksClient.unbindTexture(); Tessellator var4; float var5; GL11.glPopMatrix(); this.gunModel.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); } public void renderEntityItem(RenderBlocks var1, EntityItem var2) { GL11.glPushMatrix(); float var3 = 0.5F; GL11.glScalef(var3, var3, var3); this.renderInventoryItem(var1, var2.item); GL11.glPopMatrix(); } public void renderEquippedItem(RenderBlocks var1, EntityLiving var2, ItemStack var3) { GL11.glPushMatrix(); GL11.glTranslatef(0.5F, 0.5F, 0.5F); float var4 = 0.6F; if (var2 != Minecraft.getMinecraft().renderViewEntity || Minecraft.getMinecraft().gameSettings.thirdPersonView != 0 || Minecraft.getMinecraft().currentScreen instanceof GuiInventory && RenderManager.instance.playerViewY == 180.0F) { GL11.glScalef(var4, var4, var4); GL11.glRotatef(80.0F, 1.0F, 0.0F, 1.0F); float var5 = 0.55F; GL11.glTranslatef(var5, 0.25F, -var5); } this.renderInventoryItem(var1, var3); GL11.glPopMatrix(); } public void renderInventoryItem(RenderBlocks var1, ItemStack var2) { int var3 = var2.itemID; int var4 = var2.getItemDamage(); } public boolean handleRenderType(ItemStack item, ItemRenderType type) { // TODO Auto-generated method stub return true; } } PLSSS Help Quote
LordFokas Posted October 29, 2012 Posted October 29, 2012 It appears like you're using a RenderBlocks instance as an EntityItem instance on line 55 of that file. You may want to check that line out for the problem. Quote Did I help? Hitting 'Thank You' would be appreciated. Soon, the lost city will rise from the bottom of the ocean, and spread it's technology across Minecraft.
opssemnik Posted October 29, 2012 Author Posted October 29, 2012 renderEntityLine its correct, the line 55 is this.gunModel.render((Entity)var3[0], 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); Quote
LordFokas Posted October 29, 2012 Posted October 29, 2012 2 Questions: - what does that var3 represent? - why are making a cast from Object to Entity without checking if var3[0] is an instance of Entity? Quote Did I help? Hitting 'Thank You' would be appreciated. Soon, the lost city will rise from the bottom of the ocean, and spread it's technology across Minecraft.
opssemnik Posted October 29, 2012 Author Posted October 29, 2012 var3[0] is the Object and its casting i´ve changed my code but still wont work but here is the cast if (var3[0] != null && var3[0] instanceof EntityPlayer) Quote
LordFokas Posted October 30, 2012 Posted October 30, 2012 I know it is an Object, var3 is an array of Object. I wanted to know what each of those objects represents. Quote Did I help? Hitting 'Thank You' would be appreciated. Soon, the lost city will rise from the bottom of the ocean, and spread it's technology across Minecraft.
opssemnik Posted October 30, 2012 Author Posted October 30, 2012 its the object of entity if i dont use them i get an error lol. can u show me a example of one item render? Quote
LordFokas Posted October 30, 2012 Posted October 30, 2012 I never rendered items, only blocks, that's why I asked. I assumed you knew what you were doing, turns out you needed an entity so you just cast the first object you get your hands on to Entity and use it as a parameter on the function. I'm not able to help you any more, nor do I believe you are fit to be a modder, or any kind of programmer at all. This is probably my last reply on this thread. Please do yourself a favor and learn proper programming before attempting to make a Minecraft mod. Quote Did I help? Hitting 'Thank You' would be appreciated. Soon, the lost city will rise from the bottom of the ocean, and spread it's technology across Minecraft.
Recommended Posts
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.