Jump to content

Recommended Posts

Posted

Hi Guys,

 

I´m DealerJoe and I´m new on this forum so please correct me if I do anything wrong.

Yesterday, I tried to change over from ModLoader to Forge.

 

Now my Problem:

 

I´ve got a mod which creates a new Block with a custom rendered BlockModel. Everything works in Singleplayer, but when I try to start the server with my mod, I get the following exception :

 

Description: Exception in server tick loop

java.lang.NoClassDefFoundError: net/minecraft/src/TileEntitySpecialRenderer
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Unknown Source)
   at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:407)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
   at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
   at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
   at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
   at com.google.common.eventbus.EventBus.post(EventBus.java:268)
   at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:124)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
   at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
   at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
   at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
   at com.google.common.eventbus.EventBus.post(EventBus.java:268)
   at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:81)
   at cpw.mods.fml.common.Loader.loadMods(Loader.java:466)
   at cpw.mods.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:80)
   at cpw.mods.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:340)
   at net.minecraft.src.DedicatedServer.startServer(DedicatedServer.java:49)
   at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:433)
   at net.minecraft.src.ThreadServerApplication.run(ThreadServerApplication.java:18)
Caused by: java.lang.ClassNotFoundException: net.minecraft.src.TileEntitySpecialRenderer
   at cpw.mods.fml.relauncher.RelaunchClassLoader.findClass(RelaunchClassLoader.java:125)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   ... 29 more
Caused by: java.lang.NullPointerException
   at cpw.mods.fml.relauncher.RelaunchClassLoader.findClass(RelaunchClassLoader.java:119)
   ... 31 more

 

So, I already looked at the sourcecode of a few other mods which also add custom block models but I couldn´t figure out where I did the mistake.

 

So, these are the Files I have (If I forgot something, please tell me, I´ll show you)

 

 

Mod-Files

 

My mod-file


package farmersfriends.common;


import java.net.Proxy;


import net.minecraft.src.Block;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraft.src.ModLoader;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.common.SidedProxy;


@Mod(modid="DealerJoeFM", name="Farmers Friends", version="1.0")
@NetworkMod(clientSideRequired=true, serverSideRequired=false)


public class mod_farmersfriends {


   public static final Block blockChopper = (new BlockChopper(250, TileEntityChopper.class)).setHardness(0.5F).setBlockName("chopperBlock");
   
   public static final Item chopper = (new ItemChopper(5500, blockChopper).setItemName("chopper").setIconIndex(0));
   public static final Item sawmeal = (new ItemSawmeal(5501).setItemName("sawmeal").setIconIndex(1));
   public static final Item farmersScythe = (new ItemScythe(5502).setItemName("farmersScythe").setIconIndex(2));
   public static final Item farmersScytheBloody = (new ItemScythe(5503).setItemName("farmersScytheBloody").setIconIndex(3));


   
   @Init
   public void load(FMLInitializationEvent e){
      GameRegistry.registerFuelHandler(new FuelHandler());
      
      RenderChopper renderChopper = new RenderChopper();


      ClientRegistry.registerTileEntity(TileEntityChopper.class, "TileEntityChopper", renderChopper);
      
      LanguageRegistry.addName(chopper, "Chopper");
      LanguageRegistry.addName(sawmeal, "Sawmeal");
      LanguageRegistry.addName(farmersScythe, "Farmers Scythe");
      LanguageRegistry.addName(farmersScytheBloody, "Farmers Bloody Scythe");
      
      GameRegistry.addRecipe(new ItemStack(chopper, 1), new Object[]{
         "  S","IIW","ILR", 'S', Item.stick, 'I', Item.ingotIron, 'W', Block.wood, 'R', Item.redstone, 'L', Item.leather
      });
      
      CommonProxyFm.proxy.registerRenderThings();
   }
   
}


 

 

My BlockFile

 


package farmersfriends.common;


import java.util.Random;


import net.minecraft.src.Block;
import net.minecraft.src.BlockContainer;
import net.minecraft.src.IBlockAccess;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraft.src.Material;
import net.minecraft.src.TileEntity;
import net.minecraft.src.World;


public class BlockChopper extends BlockContainer{
   private boolean isRunning = false;
   private int time;
   private int timeout = 80;
   
   private Class ChopperEntityClass;
   
   protected BlockChopper(int i, Class gClass){
      super(i, Material.wood);
      ChopperEntityClass = gClass;
   }
   
    public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random)
    {
       if(isRunning){
          time++;
          System.out.println(time);
       }
       if(time>timeout){
          time = 0;
          isRunning = false;
       }
       
       if(isRunning){
          par1World.spawnParticle("smoke", par2+0.5, par3+1.5, par4+0.5, 0.0D, 0.0D, 0.0D);
       }
    }
    
    public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5)
    {
       int blockId = par1World.getBlockId(par2, par3+1, par4);
       
       if(blockId == Block.wood.blockID ||blockId == Block.planks.blockID||blockId == Block.sapling.blockID )
       {
          this.isRunning = true;
          
          if(new Random().nextInt(10) < 4){
             ItemStack is = new ItemStack(mod_farmersfriends.sawmeal, 1);
             this.dropBlockAsItem_do(par1World, par2, par3+1, par4, is);
          }
          
          par1World.setBlock(par2, par3+1, par4, 0);
          
            /*mc.installResource("newsound/fm/chopper.ogg", 
                    new File(mc.mcDataDir, "resources/newsound/fm/chopper.ogg"));
          
          mc.sndManager.playSoundFX("fm.chopper", 5.0F, 1.0F);*/
          
          par1World.spawnParticle("smoke", par2, par3, par4, 0.0D, 0.0D, 0.0D);
       }
    }
   
   public int idDropped(int i, Random rand, int j){
      return mod_farmersfriends.chopper.shiftedIndex;
   }
   
   public int quantityDropped(Random rand){
      return 1;
   }
   
   public int getRenderType(){
      return -1;
   }
   
   public boolean isOpaqueCube(){
      return false;
   }
   
   public boolean renderAsNormalBlock(){
      return false;
   }


   @Override
   public TileEntity createNewTileEntity(World var1) {
      return new TileEntityChopper();
   }
}


 

My Render File

 




package farmersfriends.common;


import net.minecraft.src.TileEntity;
import net.minecraft.src.TileEntitySignRenderer;
import net.minecraft.src.TileEntitySpecialRenderer;
import net.minecraftforge.client.ForgeHooksClient;


import org.lwjgl.opengl.GL11;




public class RenderChopper extends TileEntitySpecialRenderer{


   private ModelChopper chopperModel;
   
   public RenderChopper(){
      chopperModel = new ModelChopper();
   }
   
   public void renderChopperModelAt(TileEntityChopper tileentity1, double d, double d1, double d2, float f){
      GL11.glPushMatrix();
      GL11.glTranslatef((float) d + 0.5F,(float) d1 + 1.5F,(float) d2 + 0.5F);
      GL11.glRotatef(180, 0, 0, 180);
      ForgeHooksClient.bindTexture("/farmer/chopper.png", 0);
      GL11.glPushMatrix();
      chopperModel.renderModel(0.0625F);
      GL11.glPopMatrix();
      GL11.glPopMatrix();
   }


   public void renderTileEntityAt(TileEntity var1, double var2, double var4, double var6, float var8) {
      renderChopperModelAt((TileEntityChopper)var1, var2, var4, var6, var8);
   }


}


 

My TileEntityFile

 


package farmersfriends.common;


import net.minecraft.src.TileEntity;


public class TileEntityChopper extends TileEntity
{
   
}


 

The Common Proxy

 


package farmersfriends.common;


import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.registry.GameRegistry;


public class CommonProxyFm {
   @SidedProxy(clientSide = "farmersfriends.client.ClientProxyFm", serverSide = "farmersfriends.common.CommonProxyFm")
   public static CommonProxyFm proxy;   
   
   public void registerRenderThings(){   }
}


 

The Client Proxy

 


package farmersfriends.client;


import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import net.minecraftforge.client.MinecraftForgeClient;
import farmersfriends.common.CommonProxyFm;
import farmersfriends.common.RenderChopper;
import farmersfriends.common.TileEntityChopper;


public class ClientProxyFm extends CommonProxyFm{
   @Override
    public void registerRenderThings()
    {
      MinecraftForgeClient.preloadTexture("/farmer/items.png");
      MinecraftForgeClient.preloadTexture("/farmer/blocks.png");
      MinecraftForgeClient.preloadTexture("/farmer/chopper.png");
   
      ClientRegistry.bindTileEntitySpecialRenderer(TileEntityChopper.class, new RenderChopper());
      //ClientRegistry.bindTileEntitySpecialRenderer(TileEntityChopper.class, new RenderChopper());
    }


}

 

 

 

 

I would be glad if anybody could help me with that problem.

 

 

Thanks

DealerJoe

Posted

This:

   @SidedProxy(clientSide = "farmersfriends.client.ClientProxyFm", serverSide = "farmersfriends.common.CommonProxyFm")
   public static CommonProxyFm proxy;  

 

goes into your mod class, not in the CommonProxy class.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

This:

   @SidedProxy(clientSide = "farmersfriends.client.ClientProxyFm", serverSide = "farmersfriends.common.CommonProxyFm")
   public static CommonProxyFm proxy;  

 

goes into your mod class, not in the CommonProxy class.

 

You´re right, but I still get the same error.

Any other Ideas ?

Posted

I see that your render file is in the common package. Move it into the src / client package

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

I actually saw these lines in your mod file:

      
      RenderChopper renderChopper = new RenderChopper();


      ClientRegistry.registerTileEntity(TileEntityChopper.class, "TileEntityChopper", renderChopper);

 

This has to go into your ClientProxy, maybe into your registerRenderStuff() method.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

okay guys !

 

I figured out how to do it.

I had to add an

@SideOnly(Side.CLIENT);

at the top of the RenderChopper class, which I had to move to the src package.

The

RenderChopper render = new RenderChopper(); 

is not needed anymore. Now it works fine.

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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