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.

Featured Replies

Posted

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?

  • Author

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.

I don't know what line 44 is, but I'm guessing it's

 

MinecraftForgeClient.registerItemRenderer(TF2Mod.RocketLauncher, new RenderRocketLauncher());

 

Try putting that code in your client proxy.

BEFORE ASKING FOR HELP READ THE EAQ!

 

I'll help if I can. Apologies if I do something obviously stupid. :D

 

If you don't know basic Java yet, go and follow these tutorials.

  • Author

That method actually renders that item into a custom 3D model, puting that into the Client Proxy actually disabled it...

Is there another way?

Well, that's client code, and rendering should ONLY go on the client through the client proxy. When you put it in the proxy, did the game still crash?

BEFORE ASKING FOR HELP READ THE EAQ!

 

I'll help if I can. Apologies if I do something obviously stupid. :D

 

If you don't know basic Java yet, go and follow these tutorials.

  • Author

The game never really crashed from the start. I should've said that the SERVER crashed, not the game.

  • Author

I forgot how to call certain methods -.-

How do I call the code from the Client proxy?

proxy.yourMethod();

 

This method should exist in both common/server proxy, and client proxy, but should be empty in the common/server proxy.

BEFORE ASKING FOR HELP READ THE EAQ!

 

I'll help if I can. Apologies if I do something obviously stupid. :D

 

If you don't know basic Java yet, go and follow these tutorials.

  • Author

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

 

  • Author

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() {


}

}

 

  • Author

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 :/

Could you show your render code? I don't mess much with rendering, but if the proxy get's called then it has to be a problem with the renderer.

BEFORE ASKING FOR HELP READ THE EAQ!

 

I'll help if I can. Apologies if I do something obviously stupid. :D

 

If you don't know basic Java yet, go and follow these tutorials.

  • Author

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;
	}


}
}

  • Author

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!");
	}

You really should try clean your code and use correct indentation, because it helps you to see what part some if-statement handles for example.

 

and what is this about??

 

GL11.glPopMatrix();

default: break;

case EQUIPPED:

{

 

Check all your brackets and fix your switch-loop.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

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.