Jump to content

Recommended Posts

Posted

Hello, i'm new to modding and also this forum.

I'm also new to java, but i have a basic understanding of c++. It looks alot the same in my opinion!

I looked into several tutorials and learned alot in a short time.

I've recently started creating my own mod and it goes pretty well atm.(been busy for 3 weeks now).

I made a bunch of new stones and stairs and slabs (and yes the slabs work like they should).

 

But now i want to know how to start for making an addon for an existing mod.

I want to make an addon for Biomes O' Plenty, just because i like this mod very very much.

I just don't know where to start and how?

 

For example:

 

I want to make stairs for let's say ashstone. I know how to make stairs, but how to load in into my mod?

I hope someone can help me showing me the direction.

 

greetz

 

Posted

I don't really have time to dig into that mod's forum/whatever, but you should find it.

 

Look for either API or decompiled source.

For source - just add it and you are fine.

For API - throw it somewhere, go to Build Path -> "Libraries -> Add JARs.... Add API.jar.

Then (as any API should) you can attach source to API (find it in list and add API-src.zip/jar.

Any how-to can be found on google.

 

Add dependency to your @Mod.

@Mod(dependencies = "required-after:APIModID@[1.0.0.0,);") // adding @ defines "minimal version".

There are also other dependency keys - google them.

 

Above is how to get references to actual mod. If you want mod to just run in background - throw it into /mods/.

Note - you should never do both (add to /mods/ and libraries) - it will attempts to load twice.

 

Note: There were some changes in 1.8+ regarding running obfuscated mods - still in your case you need API/decomp src.

  Quote

1.7.10 is no longer supported by forge, you are on your own.

  • 3 weeks later...
Posted

Now i can see the biome o plenty mod in the reference lib, and everything is there. I can see in all classes etc etc.

But when i start the game now i get this error:

There was a severe problem during mod loading that has caused the game to fail

cpw.mods.fml.common.LoaderException: java.lang.NoSuchMethodError: net.minecraft.client.Minecraft.func_71410_x()Lnet/minecraft/client/Minecraft;

 

in the error i see this too:

 

Caused by: java.lang.NoSuchMethodError: net.minecraft.client.Minecraft.func_71410_x()Lnet/minecraft/client/Minecraft;

at biomesoplenty.ClientProxy.<init>(ClientProxy.java:49)

Can i fix this?

Posted

I fixed it with installing code chicken core. it does the deobf while running it. Now it works fine.

How do i use now an existing block from that mod ?

For example i want to make stairs from ashStone.

I tried this:

GameRegistry.registerBlock(ashstonestairs = new Customstairs(GameData.getBlockRegistry().getObject("BiomesOPlenty:ashStone"), 0).setBlockName("ashstonestairs"),"ashstonestairs" ).setCreativeTab(TemBlocks.extrastairs);

The game starts but the block has no textures. Even when setting manually a texture with .setBlockTextureName("something") it has no texture.

I made a class for the addon, here i add all the stuff i want to add when having the mod installed.

I did a check in the class where i register all my own blocks if the mod is present and if yes then load all the "additions" for it.

if(Loader.isModLoaded("BiomesOPlenty")){
	BOPBlocksAddon.init();
	}

This works all fine, i just have no textures. So what am i doing wrong?

 

Posted
  On 4/22/2016 at 8:37 PM, winnetrie said:

I fixed it with installing code chicken core. it does the deobf while running it. Now it works fine.

How do i use now an existing block from that mod ?

For example i want to make stairs from ashStone.

I tried this:

GameRegistry.registerBlock(ashstonestairs = new Customstairs(GameData.getBlockRegistry().getObject("BiomesOPlenty:ashStone"), 0).setBlockName("ashstonestairs"),"ashstonestairs" ).setCreativeTab(TemBlocks.extrastairs);

The game starts but the block has no textures. Even when setting manually a texture with .setBlockTextureName("something") it has no texture.

I made a class for the addon, here i add all the stuff i want to add when having the mod installed.

I did a check in the class where i register all my own blocks if the mod is present and if yes then load all the "additions" for it.

if(Loader.isModLoaded("BiomesOPlenty")){
	BOPBlocksAddon.init();
	}

This works all fine, i just have no textures. So what am i doing wrong?

 

Are you sure you have the right directory / folder and everything?

 

The texture name would be: :modid/ + name

e.g. for something mymod with a block called baddirt

setBlockTextureName(":mymod/baddirt");

 

while if you used a subfolder it would be:  :modid/ + subdirectory + name

e.g. fro something with a graphic at

src/main/resources/assets/mf1inmf2/textures/blocks/slate0.png

setBlockTextureName(":mf1inmf2/basic/slate0");

 

Note that I've yet to make stairs, so I don't know about them specifically, so if its a stairs thing that's going wrong I probably can't help -- so far I've just made basic blocks and meta-block varieties, since most of my experience in modding is world gen.

Developer of Doomlike Dungeons.

Posted

this is what i see in the console when i start up and load a world:

 

  Reveal hidden contents

 

in my opinion nothing special.

As for the texture i do not apply 1, because i make stairs out of that block and that block has a texture.

At least this works for my own blocks. If i change the biome o plenty block into 1 of my own blocks or 1 of minecraft, it then works.

But just in case i tested it with supplying a texture of my own and also tested it with supplying the texture it from BOP.

It also see no error saying it has no texture. So somehow it knows the texture but does not apply it.

 

Posted

So i tried something new, based on some info i found.

public static final void init(){

	 GameRegistry.registerBlock(ashstonestairs = new Customstairs(getBlock("BiomesOPlenty:ashStone"), 0).setBlockName("ashstonestairs"),"ashstonestairs" ).setCreativeTab(TemBlocks.extrastairs);


}
public static Block getBlock(String name) {
	Block block = (Block) Block.blockRegistry.getObject(name);
	if (block == null || block == Blocks.air)
		throw new NullPointerException("Could not find any blocks named " + name);
	return block;
}

But now it gives me that error, wich is weird because the block IS there.

If i try to supply a block from minecraft or 1 of mine it works! What am i doing wrong?

Why can't it find the block, i'm very sure the name is correct. I can also find the block ingame in the bop tab.

 

EDIT:

I tried initializing it in the postinit of my proxy, because you never know and it worked...

 

package winnetrie.tem;

import winnetrie.tem.block.BOPBlocksAddon;
import winnetrie.tem.block.TemBlocks;
import winnetrie.tem.block.ColoredSlab;
import winnetrie.tem.crafting.TemRecipes;
import winnetrie.tem.item.TemItems;
import winnetrie.tem.item.TemTools;
import cpw.mods.fml.common.Loader;
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;

public class CommonProxy {
public void preInit(FMLPreInitializationEvent event) {
	TemItems.init();
	TemBlocks.init();
	TemTools.init();





    }

    public void init(FMLInitializationEvent event) {
    	TemRecipes.init();
    	GameRegistry.registerWorldGenerator(new ChalkStoneGenerator(), 1);

    }

    public void postInit(FMLPostInitializationEvent event) {
    	if(Loader.isModLoaded("BiomesOPlenty")){
		BOPBlocksAddon.init();
		}
    }



}

I have all my own block in the preinit

Why do i have to put the addon block in the postinit to let it work?

Is this because the mod has to be loaded first before you can qeue something?

It now works but if something is still not good or wrong i'll be happy to hear it.

Posted

Ah!  Now I know what's happening, though should have thought of it before.  Its about the order the mods load.  Your mod was being loaded before BoP, so the BoP resources weren't there yet.  By moving it to post init it insured that all other mods had been at least loaded (and should have gone through pre-init and init as well).  By putting it in pre-init it meant that some mods might not even have been loaded.

 

You should try defining and registering blocks in init -- technically pre-init is for things like reading in config files and setting options.  Init is for initializing your main content, like including blocks, and post init is there to allow for inter-mod compatibility, by allowing things to be done after other mods have initialized.  Register in init should work, since BoP resources should be loaded by then, but if not you can always go back to post-init.  But doing this in pre-init was not the correct place and probably cause the problem.

 

EDIT: The reason post-init might not be the best place is that it could cause problem if another mod wants to use your block -- for example, I have Doomlike Dungeons read in themes in post-init so blocks from other mods can be used -- if you're block didn't exist yet then my mod might crash if someone had added it to a theme.

Developer of Doomlike Dungeons.

Posted

Blocks and items should be registered in preInit, not init.

 

Use the

dependencies

attribute of your

@Mod

annotation (as Ernio said) to ensure your mod loads after BoP.

 

Edit: It was Ernio who originally mentioned the

dependencies

attribute, not diesieben07 as I said previously.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted
  On 4/25/2016 at 10:42 PM, Choonster said:

 

Use the

dependencies

attribute of your

@Mod

annotation (as diesieben07 said) to ensure your mod loads after BoP.

wouldn't that make my mod depending on BOP? If so, i don't want that.

My mod is a mod on his own, but whenever BOP is installed too you have the extra stuff

Posted
  On 4/26/2016 at 1:05 PM, winnetrie said:

  Quote

 

Use the

dependencies

attribute of your

@Mod

annotation (as diesieben07 said) to ensure your mod loads after BoP.

wouldn't that make my mod depending on BOP? If so, i don't want that.

My mod is a mod on his own, but whenever BOP is installed too you have the extra stuff

 

That is true.  If your mod really is an add-on it should have the other as a dependency, but if its not that's a problem.  I know there is a way to make a mod a "soft" dependency, that doesn't require the other but loads after it because Lycanite did that with my mod -- but I don't know how (its something I've been wanting to learn myself).  But if its not technically an add-on, if its its own mod, it really shouldn't have a hard dependency.

Developer of Doomlike Dungeons.

Posted
  On 4/26/2016 at 3:10 PM, diesieben07 said:

before:xyz means "load before xyz if it present"

required-before:xyz "load before xyz and fail if it's missing"

 

Same with after.

 

Ow,this is nice. I didn't know you can do "before" and "after" alone.

I always thought it has to be "required-after" or "required-before".

 

thank you very much!! Seems to work all fine now!

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.