Jump to content

DaNatin

Members
  • Posts

    55
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    New, but I have some experience with java...

DaNatin's Achievements

Stone Miner

Stone Miner (3/8)

0

Reputation

  1. Is it possible to make an update method in my mod's main class? I want to check for stuff such as if a player is wearing iron armor, or if they're outside. Most update methods I know of are in custom item/block classes themselves, I don't want that. So, is it possible to have an update method in the main class?
  2. I found the problem: renderItem's message was never mentioned in the console Meaning this whole chunk of code is being ignored for some reason @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { switch(type) { case EQUIPPED_FIRST_PERSON: { GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("tf2mod", "textures/models/RocketLauncher.png")); //ResourceLocation Texture = new ResourceLocation(BattleOfTheBeastsMod.modid, "/textures/entity/RocketLauncher.png"); boolean isFirstPerson = true; if(data[1] != null && data[1] instanceof EntityPlayer) { if(!((EntityPlayer)data[1] == Minecraft.getMinecraft().renderViewEntity && Minecraft.getMinecraft().gameSettings.thirdPersonView == 0 && !((Minecraft.getMinecraft().currentScreen instanceof GuiInventory || Minecraft.getMinecraft().currentScreen instanceof GuiContainerCreative) && RenderManager.instance.playerViewY == 0.0F))) isFirstPerson = true; GL11.glTranslatef(0.5F, 0.8F, 0.1F); //position GL11.glRotatef(-10F, 1.0F, 0.0F, 0.0F); //X GL11.glRotatef(165F, 0.0F, 1.0F, 0.0F); //y GL11.glRotatef(160F, 1.0F, 0.0F, 1.0F); //z //Size rocketlaunchermodel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.07F); } } GL11.glPopMatrix(); default: break; case EQUIPPED: { GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("tf2mod", "textures/models/RocketLauncher.png")); //ResourceLocation Texture = new ResourceLocation(BattleOfTheBeastsMod.modid, "/textures/entity/RocketLauncher.png"); boolean isFirstPerson = false; if(data[1] != null && data[1] instanceof EntityPlayer) { if(!((EntityPlayer)data[1] == Minecraft.getMinecraft().renderViewEntity && Minecraft.getMinecraft().gameSettings.thirdPersonView == 1 && !((Minecraft.getMinecraft().currentScreen instanceof GuiInventory || Minecraft.getMinecraft().currentScreen instanceof GuiContainerCreative) && RenderManager.instance.playerViewY == 180.0F || RenderManager.instance.playerViewY == 0.0F))) { isFirstPerson = false; GL11.glTranslatef(0.4F, 0.5F, 0.08F); //position GL11.glRotatef(-26F, 1.0F, 0.0F, 0.0F); //X GL11.glRotatef(165F, 0.0F, 1.0F, 0.0F); //y GL11.glRotatef(140F, 1.0F, 0.0F, 1.0F); //z //Size rocketlaunchermodel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.07F); } } GL11.glPopMatrix(); } System.out.println("Item renderer loaded!"); }
  3. RenderRocketLauncher package com.natin.tf2mod.render; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainerCreative; import net.minecraft.client.gui.inventory.GuiInventory; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumAction; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.IItemRenderer; import org.lwjgl.opengl.GL11; import com.natin.tf2mod.models.RocketLauncherModel; public class RenderRocketLauncher implements IItemRenderer { //public static final ResourceLocation Texture = new ResourceLocation(BattleOfTheBeastsMod.modid, "/textures/entity/RocketLauncher.png"); protected RocketLauncherModel rocketlaunchermodel; public RenderRocketLauncher() { rocketlaunchermodel = new RocketLauncherModel(); } // protected ResourceLocation func_110832_a(RocketLauncherModel par1EntitySpiderQueen) //{ // return Texture; //} @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { switch(type) { case EQUIPPED_FIRST_PERSON: return true; case EQUIPPED: return true; default: return false; } } @Override public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { return false; } public EnumAction EQUIPPED(ItemStack par1ItemStack) { return EnumAction.bow; } @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { switch(type) { case EQUIPPED: { GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("tf2mod", "textures/models/RocketLauncher.png")); //ResourceLocation Texture = new ResourceLocation(BattleOfTheBeastsMod.modid, "/textures/entity/RocketLauncher.png"); boolean isFirstPerson = false; if(data[1] != null && data[1] instanceof EntityPlayer) { if(!((EntityPlayer)data[1] == Minecraft.getMinecraft().renderViewEntity && Minecraft.getMinecraft().gameSettings.thirdPersonView == 1 && !((Minecraft.getMinecraft().currentScreen instanceof GuiInventory || Minecraft.getMinecraft().currentScreen instanceof GuiContainerCreative) && RenderManager.instance.playerViewY == 180.0F))) { isFirstPerson = false; GL11.glTranslatef(0.4F, 0.5F, 0.08F); //position GL11.glRotatef(-26F, 1.0F, 0.0F, 0.0F); //X GL11.glRotatef(165F, 0.0F, 1.0F, 0.0F); //y GL11.glRotatef(140F, 1.0F, 0.0F, 1.0F); //z //Size rocketlaunchermodel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.07F); } } GL11.glPopMatrix(); } case EQUIPPED_FIRST_PERSON: { GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("tf2mod", "textures/models/RocketLauncher.png")); //ResourceLocation Texture = new ResourceLocation(BattleOfTheBeastsMod.modid, "/textures/entity/RocketLauncher.png"); boolean isFirstPerson = true; if(data[1] != null && data[1] instanceof EntityPlayer) { if(!((EntityPlayer)data[1] == Minecraft.getMinecraft().renderViewEntity && Minecraft.getMinecraft().gameSettings.thirdPersonView == 0 && !((Minecraft.getMinecraft().currentScreen instanceof GuiInventory || Minecraft.getMinecraft().currentScreen instanceof GuiContainerCreative) && RenderManager.instance.playerViewY == 0.0F))) isFirstPerson = true; GL11.glTranslatef(0.5F, 0.8F, 0.1F); //position GL11.glRotatef(-10F, 1.0F, 0.0F, 0.0F); //X GL11.glRotatef(165F, 0.0F, 1.0F, 0.0F); //y GL11.glRotatef(160F, 1.0F, 0.0F, 1.0F); //z //Size rocketlaunchermodel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.07F); } } GL11.glPopMatrix(); default: break; } } }
  4. I've made this in the Client Proxy @Override public void registerItemRenderer() { MinecraftForgeClient.registerItemRenderer(TF2Mod.RocketLauncher, new RenderRocketLauncher()); System.out.println("[TF2 Mod]TF2 Items Rendered!"); } The message I applied showed up in the console, some how the render code isn't working
  5. Client Proxy package com.natin.tf2mod.client; import net.minecraftforge.client.MinecraftForgeClient; import com.natin.tf2mod.common.TF2ModCommonProxy; import com.natin.tf2mod.render.RenderRocketLauncher; public class TF2ClientProxy extends TF2ModCommonProxy { @Override public void registerRenderThings() { // This is for rendering entities and so forth later on } @Override public void registerItemRenderer() { MinecraftForgeClient.registerItemRenderer(TF2Mod.RocketLauncher, new RenderRocketLauncher()); } } Common Proxy package com.natin.tf2mod.common; public class TF2ModCommonProxy { public void registerRenderThings() { // Nothing here as the server doesn't render graphics or entities! } public void registerItemRenderer() { } }
  6. The item still isn't rendered in 3D here's what I've done: -made a method in both proxies -put ItemRenderer into Client Proxy -called proxy.something() into the main file
  7. I forgot how to call certain methods -.- How do I call the code from the Client proxy?
  8. The game never really crashed from the start. I should've said that the SERVER crashed, not the game.
  9. That method actually renders that item into a custom 3D model, puting that into the Client Proxy actually disabled it... Is there another way?
  10. Mkay, Here is the main file: package com.natin.tf2mod.client; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.common.MinecraftForge; import com.natin.tf2mod.common.TF2ModCommonProxy; import com.natin.tf2mod.items.guns.Rocket; import com.natin.tf2mod.items.guns.RocketLauncher; import com.natin.tf2mod.render.RenderRocketLauncher; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = TF2Mod.MODID, version = TF2Mod.VERSION) public class TF2Mod { @SidedProxy(clientSide="com.natin.tf2mod.client.TF2ClientProxy", serverSide="com.natin.tf2mod.common.TF2ModCommonProxy") public static TF2ModCommonProxy proxy; public static final String MODID = "tf2mod"; public static final String VERSION = "v0.4"; /**Items**/ public static Item RocketLauncher; public static Item Rocket; @EventHandler public void init(FMLInitializationEvent event) { proxy.registerRenderThings(); RocketLauncher = new RocketLauncher().setUnlocalizedName("RocketLauncher"); MinecraftForgeClient.registerItemRenderer(TF2Mod.RocketLauncher, new RenderRocketLauncher()); GameRegistry.registerItem(RocketLauncher, "RocketLauncher"); GameRegistry.addRecipe(new ItemStack(RocketLauncher), new Object[] { "GRT", " S", 'T', Items.iron_ingot , 'G', Items.gunpowder, 'R', Items.redstone, 'S', Items.stick }); Rocket = new Rocket().setUnlocalizedName("Rocket"); GameRegistry.registerItem(Rocket, "Rocket"); GameRegistry.addRecipe(new ItemStack(Rocket), new Object[] { "SGS", 'S', Items.iron_ingot, 'G', Items.gunpowder }); } /** public static DamageSource causeMagnumDamage(EntityNormalBullet bullet, Entity par1Entity) { return par1Entity == null ? (new EntityDamageSourceIndirect("onFire", bullet, bullet)).setProjectile() : (new EntityDamageSourceIndirect("fireball", bullet, par1Entity)).setProjectile(); } **/ } The crash report really only mentions the main file, but if you need more just ask.
  11. After I've setup forge server and loaded my mod into it, it contained a crash report like this: Exception in server tick loop cpw.mods.fml.common.LoaderException: java.lang.NoClassDefFoundError: org/lwjgl/LWJGLException at cpw.mods.fml.common.LoadController.transition(LoadController.java:162) at cpw.mods.fml.common.Loader.initializeMods(Loader.java:692) at cpw.mods.fml.server.FMLServerHandler.finishServerLoading(FMLServerHandler.java:97) at cpw.mods.fml.common.FMLCommonHandler.onServerStarted(FMLCommonHandler.java:318) at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:210) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:387) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:685) Caused by: java.lang.NoClassDefFoundError: org/lwjgl/LWJGLException at net.minecraftforge.client.MinecraftForgeClient.getStencilBits(MinecraftForgeClient.java:51) at net.minecraftforge.client.MinecraftForgeClient.<clinit>(MinecraftForgeClient.java:55) at com.natin.tf2mod.client.TF2Mod.init(TF2Mod.java:44) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at cpw.mods.fml.common.Loader.initializeMods(Loader.java:691) ... 5 more Caused by: java.lang.ClassNotFoundException: org.lwjgl.LWJGLException at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:104) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ... 35 more It mentions my mod in a line, and also states that there was an exception in the server tick. So how do I make my mod server compatible?
  12. That actually fixed third person from the back, I still see two models when I'm in the front view third person. I can't seem what's causing the problem...
  13. I added an extra PushMatrix, but that still doesn't change the fact that it still renders two of the same model?
  14. I've made an item render as a custom 3D model, the problem is that I can see two of the same model (or a part of it) in third person. Here's what I see: This only happens when I'm in third person: [/img] Here is the rendering code: package com.natin.borderlands2mod.entities.render; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainerCreative; import net.minecraft.client.gui.inventory.GuiInventory; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumAction; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.IItemRenderer; import org.lwjgl.opengl.GL11; import com.natin.borderlands2mod.guns.models.RocketLauncherModel; public class RenderRocketLauncher implements IItemRenderer { //public static final ResourceLocation Texture = new ResourceLocation(BattleOfTheBeastsMod.modid, "/textures/entity/RocketLauncher.png"); protected RocketLauncherModel rocketlaunchermodel; public RenderRocketLauncher() { rocketlaunchermodel = new RocketLauncherModel(); } // protected ResourceLocation func_110832_a(RocketLauncherModel par1EntitySpiderQueen) //{ // return Texture; //} @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { switch(type) { case EQUIPPED: return true; case EQUIPPED_FIRST_PERSON: return true; default: return false; } } @Override public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { return false; } public EnumAction EQUIPPED(ItemStack par1ItemStack) { return EnumAction.bow; } @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { switch(type) { case EQUIPPED: { GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("borderlands2mod", "textures/models/RocketLauncher.png")); //ResourceLocation Texture = new ResourceLocation(BattleOfTheBeastsMod.modid, "/textures/entity/RocketLauncher.png"); boolean isFirstPerson = false; if(data[1] != null && data[1] instanceof EntityPlayer) { if(!((EntityPlayer)data[1] == Minecraft.getMinecraft().renderViewEntity && Minecraft.getMinecraft().gameSettings.thirdPersonView == 0 && !((Minecraft.getMinecraft().currentScreen instanceof GuiInventory || Minecraft.getMinecraft().currentScreen instanceof GuiContainerCreative) && RenderManager.instance.playerViewY == 180.0F))) { isFirstPerson = false; GL11.glTranslatef(0.4F, 0.5F, 0.08F); //position GL11.glRotatef(-26F, 1.0F, 0.0F, 0.0F); //X GL11.glRotatef(165F, 0.0F, 1.0F, 0.0F); //y GL11.glRotatef(140F, 1.0F, 0.0F, 1.0F); //z //Size rocketlaunchermodel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.07F); } } } case EQUIPPED_FIRST_PERSON: { GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("borderlands2mod", "textures/models/RocketLauncher.png")); //ResourceLocation Texture = new ResourceLocation(BattleOfTheBeastsMod.modid, "/textures/entity/RocketLauncher.png"); boolean isFirstPerson = true; if(data[1] != null && data[1] instanceof EntityPlayer) { if(!((EntityPlayer)data[1] == Minecraft.getMinecraft().renderViewEntity && Minecraft.getMinecraft().gameSettings.thirdPersonView == 0 && !((Minecraft.getMinecraft().currentScreen instanceof GuiInventory || Minecraft.getMinecraft().currentScreen instanceof GuiContainerCreative) && RenderManager.instance.playerViewY == 0.0F))) isFirstPerson = true; GL11.glTranslatef(0.5F, 0.8F, 0.1F); //position GL11.glRotatef(-10F, 1.0F, 0.0F, 0.0F); //X GL11.glRotatef(165F, 0.0F, 1.0F, 0.0F); //y GL11.glRotatef(160F, 1.0F, 0.0F, 1.0F); //z //Size rocketlaunchermodel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.07F); } } GL11.glPopMatrix(); default: break; } } } Also in the console, this message is spammed repeatedly when I go into third person: [13:51:44] [Client thread/ERROR]: ########## GL ERROR ########## [13:51:44] [Client thread/ERROR]: @ Post render [13:51:44] [Client thread/ERROR]: 1283: Stack overflow
  15. I should have phrased it a little differently, I already have the model done and ready to use. I'm adding its diff child parts and it can be pretty difficult not knowing how the model might end up. The debug client doesn't seem to update with the code, which is why I always have to reopen Minecraft every time I change something in the code (mainly child position/rotation).
×
×
  • Create New...

Important Information

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