Jump to content

Recommended Posts

Posted

Hey, I'm having problems with my mod that simply adds a few items with crafting recipes and has vanilla mobs drop them.

 

My crash report is as follows:

 

  Reveal hidden contents

 

 

This happens whenever I try to play in a Single Player world, but not on a Server.

 

If I could have some help on how to solve this, that would be great as the crash report doesn't list any of my classes or processes as creating the problem. Maybe I'm missing a class that handles this stuff?

 

EDIT: I'm aware the problem occurs when the game tries to save the world chunks, but I have no idea how to resolve it.

Posted
  On 3/11/2014 at 2:35 PM, stijnhero said:

Something in your code is null I think can I see some source?

 

HaggisMain.java

 

  Reveal hidden contents

 

 

CustomDrops.java

 

  Reveal hidden contents

 

Posted

Looks normal too me only that you should register the food in the preinit.

 

Do your proxy's have any code?

or is there anything else that could create an error.

I'm always happy to help others!

 

Java is not my main programming language but I have alot experience in PHP/HTML/JS/CSS3/C#/SQL

Posted

Can you provide the full log? (ForgeModLoader-client-0.log / ForgeModLoader-server-0.log)

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

  Quote

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
  On 3/11/2014 at 2:55 PM, stijnhero said:

Looks normal too me only that you should register the food in the preinit.

 

Do your proxy's have any code?

or is there anything else that could create an error.

 

The food is registered in the PreInit and the proxies are the same as they've always been:

CommonProxy.java

 

  Reveal hidden contents

 

 

ClientProxy.java

 

  Reveal hidden contents

 

 

The only thing I can think of is the fact that my custom drops don't work even though I've now added this line to the PreInit in my main class:

MinecraftForge.EVENT_BUS.register(new CustomDrops());

Posted

you need to put @SubscribeEvent above this line: public void onEntityDrop(LivingDropsEvent event)

I'm always happy to help others!

 

Java is not my main programming language but I have alot experience in PHP/HTML/JS/CSS3/C#/SQL

Posted
  On 3/11/2014 at 3:47 PM, stijnhero said:

you need to put @SubscribeEvent above this line: public void onEntityDrop(LivingDropsEvent event)

 

Thanks, that fixed the problem of the mob drops, but I still have the crashes.

Posted

Sorry that I can't provide a solution but I can provide a quick tip: move the registration of your crafting recipes from the preInit-method to the init-method. It's nothing severe but more common to register advance stuff (things that require items or such already registered) in the init method.

Posted
  On 3/11/2014 at 6:25 PM, WorldsEnder said:

Sorry that I can't provide a solution but I can provide a quick tip: move the registration of your crafting recipes from the preInit-method to the init-method. It's nothing severe but more common to register advance stuff (things that require items or such already registered) in the init method.

 

Do you mean in:

@EventHandler // used in 1.6.2
//@Init       // used in 1.5.2
public void load(FMLInitializationEvent event) {
        proxy.registerRenderers();
}

 

I was registering my stuff in there at first but it didn't actually work until I moved it to PreInit

Posted

I just don't advice registering all your items in your main class file this is how I do it:

@EventHandler
public void preInit(FMLPreInitializationEvent event){
	BlocksItems.InitItems();
	BlocksItems.InitBlocks();
	BlocksItems.WorldGen();
	Config.InitRecipes();
	Config.registerMolecules();
	Config.registerSamples();
	Config.registerMineralProps();
	Config.registerTileEntity();
        proxy.registerRenderers();
}

 

and then in my blockitems file(sorry it's a mess i need to clean it up more)

public class BlocksItems {
//items
public static Item Emptyjar;
public static Item Sample;
public static Item Mineral;

//blocks
public static Block OrePlutonium;
public static Block Evaporite;
public static Block BlockSlowHeatConductant;
public static Block BlockMediumHeatConductant;
public static Block BlockFastHeatConductant;
//	public static Block ResearchTableIdle;
//	public static Block ResearchTableActive;

public static void WorldGen(){
	GameRegistry.registerWorldGenerator(new WorldGen(), 1);

}

public static void InitItems(){
	Emptyjar = new ItemEmptyjar().setUnlocalizedName("Emptyjar").setCreativeTab(MolecularScience.MItems);
        Sample = new ItemSample().setUnlocalizedName("sample");
        Mineral = new ItemMineral().setUnlocalizedName("Mineral");
        
        GameRegistry.registerItem(Emptyjar,"Emptyjar");
        GameRegistry.registerItem(Sample,"Sample");
        GameRegistry.registerItem(Mineral,"Mineral");
}

public static void InitBlocks(){
        OrePlutonium = new BlockOre(Material.rock, 2).setHardness(3.0F).setBlockName("Plutoniumore");
        Evaporite = new BlockEvaporite(Material.rock).setHardness(3.0F).setBlockName("Evaporite");
        BlockSlowHeatConductant = new BlockHeatConductant(Material.rock, 50).setHardness(3.0F).setBlockName("BlockSlowHeatConductant");
        BlockMediumHeatConductant = new BlockHeatConductant(Material.rock, 25).setHardness(3.0F).setBlockName("BlockMediumHeatConductant");
        BlockFastHeatConductant = new BlockHeatConductant(Material.rock, 5).setHardness(3.0F).setBlockName("BlockFastHeatConductant");
//        ResearchTableIdle = new ResearchTable(false).setBlockName("ResearchTableIdle").setCreativeTab(MolecularScience.Blocks);
//        ResearchTableActive = new ResearchTable(true).setBlockName("ResearchTableActive");
        
        GameRegistry.registerBlock(OrePlutonium, "Plutoniumore");
        GameRegistry.registerBlock(Evaporite, "Evaporite");
        GameRegistry.registerBlock(BlockSlowHeatConductant, "BlockSlowHeatConductant");
        GameRegistry.registerBlock(BlockMediumHeatConductant, "BlockMediumHeatConductant");
        GameRegistry.registerBlock(BlockFastHeatConductant, "BlockFastHeatConductant");
//        GameRegistry.registerBlock(ResearchTableIdle, "ResearchTableIdle");
//        GameRegistry.registerBlock(ResearchTableActive, "ResearchTableActive");
}
}

 

I'm always happy to help others!

 

Java is not my main programming language but I have alot experience in PHP/HTML/JS/CSS3/C#/SQL

Posted
  On 3/11/2014 at 8:35 PM, stijnhero said:

I just don't advice registering all your items in your main class file this is how I do it:

@EventHandler
public void preInit(FMLPreInitializationEvent event){
	BlocksItems.InitItems();
	BlocksItems.InitBlocks();
	BlocksItems.WorldGen();
	Config.InitRecipes();
	Config.registerMolecules();
	Config.registerSamples();
	Config.registerMineralProps();
	Config.registerTileEntity();
        proxy.registerRenderers();
}

 

and then in my blockitems file(sorry it's a mess i need to clean it up more)

public class BlocksItems {
//items
public static Item Emptyjar;
public static Item Sample;
public static Item Mineral;

//blocks
public static Block OrePlutonium;
public static Block Evaporite;
public static Block BlockSlowHeatConductant;
public static Block BlockMediumHeatConductant;
public static Block BlockFastHeatConductant;
//	public static Block ResearchTableIdle;
//	public static Block ResearchTableActive;

public static void WorldGen(){
	GameRegistry.registerWorldGenerator(new WorldGen(), 1);

}

public static void InitItems(){
	Emptyjar = new ItemEmptyjar().setUnlocalizedName("Emptyjar").setCreativeTab(MolecularScience.MItems);
        Sample = new ItemSample().setUnlocalizedName("sample");
        Mineral = new ItemMineral().setUnlocalizedName("Mineral");
        
        GameRegistry.registerItem(Emptyjar,"Emptyjar");
        GameRegistry.registerItem(Sample,"Sample");
        GameRegistry.registerItem(Mineral,"Mineral");
}

public static void InitBlocks(){
        OrePlutonium = new BlockOre(Material.rock, 2).setHardness(3.0F).setBlockName("Plutoniumore");
        Evaporite = new BlockEvaporite(Material.rock).setHardness(3.0F).setBlockName("Evaporite");
        BlockSlowHeatConductant = new BlockHeatConductant(Material.rock, 50).setHardness(3.0F).setBlockName("BlockSlowHeatConductant");
        BlockMediumHeatConductant = new BlockHeatConductant(Material.rock, 25).setHardness(3.0F).setBlockName("BlockMediumHeatConductant");
        BlockFastHeatConductant = new BlockHeatConductant(Material.rock, 5).setHardness(3.0F).setBlockName("BlockFastHeatConductant");
//        ResearchTableIdle = new ResearchTable(false).setBlockName("ResearchTableIdle").setCreativeTab(MolecularScience.Blocks);
//        ResearchTableActive = new ResearchTable(true).setBlockName("ResearchTableActive");
        
        GameRegistry.registerBlock(OrePlutonium, "Plutoniumore");
        GameRegistry.registerBlock(Evaporite, "Evaporite");
        GameRegistry.registerBlock(BlockSlowHeatConductant, "BlockSlowHeatConductant");
        GameRegistry.registerBlock(BlockMediumHeatConductant, "BlockMediumHeatConductant");
        GameRegistry.registerBlock(BlockFastHeatConductant, "BlockFastHeatConductant");
//        GameRegistry.registerBlock(ResearchTableIdle, "ResearchTableIdle");
//        GameRegistry.registerBlock(ResearchTableActive, "ResearchTableActive");
}
}

 

You mean set up and register my items in a class and then just call it in the PreInit method?

 

I originally did something like that but decided just to do it in less classes. Was that a bad decision? xD

Posted
  On 3/11/2014 at 9:34 PM, stijnhero said:

No but why would you want that?

 

It bothers me that I can almost spawn in items on a normal bukkit server but nobody can see them and if i try to click or take them out of the inventory GUI they disappear. It just doesn't seem neat or practical. I also don't know many servers that will want to use it as a server mod.

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.