Jump to content

Recommended Posts

Posted

Hi!

A friend recently pointed out to me that my mod is basically made out of 2 parts, a technic orientated part and a magic orientated part(that requires items from the other part) and that most likely not all users want to play with both of them.

So he said that i maybe should split my mod in two parts; sounds like a good idea, eh?(more adfly links! ;))

 

I think that i should be able to share most items and using the ore dictionary. But what about adding crafting recipes to my main mods special containers?

After studying the buildcraft source i realized that i have to create an api first.

 

But what exactly do i have to put in my api and, even more important, how do i have to set up my file tree in eclipse to have everything in one workspace?

Maybe i am blind, but i didn't find any helpful documentation or tutorial anywhere. Can someone please help me to get started?

 

thx a lot in advance for every helpful answer, Jacky

Here could be your advertisement!

Posted

nah, the science stuff should be in the core mod.

 

Already read that tutorial. i know how to use an api (actually i am already using some) but i don't know how to create one.

Here could be your advertisement!

Posted

If it is only ItemStack you need to pass, you can use FML InterModCom messages.

Or make custom child classes of fml.Event for your containers to post ?

What do you mean with "custom child classes of fml.Event for your containers to post" i am not sure what you mean with that. (I have no forgesrc available right now)

If i geht this right you mean that i should not try to create an API but to do everything in the submod.

This could maybe work out fine with just one submod, but what if i decide to add another one(i have lots of ideas)? I think it would be easier, and more interesting, to do this via an api.

 

Also i believe that i will need an api to register new recipes to my ItemWasher(yeah, i am not good in naming things)

The crafting class look like this(its based on the furnance):

 

 

package net.dimensionshift.mod;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFishFood;
import net.minecraft.item.ItemStack;

public class WashingRecipes
{
    private static final WashingRecipes washingBase = new WashingRecipes();
    /** The list of washing results. */
    private Map washingList = new HashMap();
    private Map experienceList = new HashMap();
    private static final String __OBFID = "CL_00000085";


    public static WashingRecipes washing()
    {
        return washingBase;
    }

    private WashingRecipes()
    {
        this.addBlocks(DimensionShift.blockInfectedDirt, new ItemStack(Blocks.dirt), 0.1F);
        this.addBlocks(DimensionShift.blockInfectedGrass, new ItemStack(Blocks.grass), 0.2F);
        
    }

    public void addBlocks(Block block, ItemStack itemstack, float xp)
    {
        this.addItems(Item.getItemFromBlock(block), itemstack, xp);
    }

    public void addItems(Item item, ItemStack itemstack, float xp)
    {
        this.addToWashingList(new ItemStack(item, 1, 32767), itemstack, xp);
    }

    public void addToWashingList(ItemStack itemstack1, ItemStack itemstack2, float xp)
    {
        this.washingList.put(itemstack1, itemstack2);
        this.experienceList.put(itemstack2, Float.valueOf(xp));
    }

    /**
     * Returns the washing result of an item.
     */
    public ItemStack getWashingResult(ItemStack itemstack)
    {
        Iterator iterator = this.washingList.entrySet().iterator();
        Entry entry;

        do
        {
            if (!iterator.hasNext())
            {
                return null;
            }

            entry = (Entry)iterator.next();
        }
        while (!this.func_151397_a(itemstack, (ItemStack)entry.getKey()));

        return (ItemStack)entry.getValue();
    }

    private boolean func_151397_a(ItemStack itemstack1, ItemStack itemstack2)
    {
        return itemstack2.getItem() == itemstack1.getItem() && (itemstack2.getItemDamage() == 32767 || itemstack2.getItemDamage() == itemstack1.getItemDamage());
    }

    public Map getwashingList()
    {
        return this.washingList;
    }

    
    //returns  xp of an
    public float getXP(ItemStack itemstack)
    {
        float ret = itemstack.getItem().getSmeltingExperience(itemstack);
        if (ret != -1) return ret;

        Iterator iterator = this.experienceList.entrySet().iterator();
        Entry entry;

        do
        {
            if (!iterator.hasNext())
            {
                return 0.0F;
            }

            entry = (Entry)iterator.next();
        }
        while (!this.func_151397_a(itemstack, (ItemStack)entry.getKey()));

        return ((Float)entry.getValue()).floatValue();
    }
}

 

 

How can i use WashingRecipes.addSOMETHING in the submod without an api?

 

 

Sry if there are any German/not english words, i still have some problems with my Smartphones autocorrection.

 

    Jacky

Here could be your advertisement!

Posted

Sounds like what you need is 3 separate mods - a core mod with the shared content, a magic mod and a science mod. You'll be able to access content across mods by importing their packages.

 

Have a look at this for help: http://www.minecraftforge.net/wiki/Developing_Addons_for_Existing_Mods

What? Wait! This tutorial is different to the one i read.

Looks good. but where do i have to put my mains mod src?

i neither have a mcp folder nor do i need it(already have the src). but where should i put the core's src now?

 

 

EDIT:

 

ok, i tried around a little bit: now i have a new package net.testmod.mod next to my net.dimensionshift.mod... classes. And this setup works surprisingly well.

 

But how should i export each one of this mods on its own? Or can i somehow spilt them up in 2 projects?

And somehow the testmod is not marked as a childmod of my main mod. How can i make it to a "real" child mo?

Here could be your advertisement!

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.