Jump to content

[Help] Crafting Handler


Triplitz88

Recommended Posts

I'm having a huge issue understanding just what I am supposed to do with the crafting handler.

 

The whole system works perfectly in single player but in multi player the item will show up in the crafting-out box but cannot be moved from there into my inventory.

 

Here is the code I have so far:

 

package mod_DefenseGunPack;

import java.util.ArrayList;
import java.util.List;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.src.ModLoader;
import cpw.mods.fml.common.ICraftingHandler;
import cpw.mods.fml.common.Mod.Item;
import cpw.mods.fml.common.modloader.BaseModProxy;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class CraftingHandlerDefenseGun3x3v1 implements ICraftingHandler {

//	private BaseModProxy mod;

    private BaseModProxy mod;

    public CraftingHandlerDefenseGun3x3v1(BaseModProxy mod)
    {
        this.mod = mod;
    }

@Override
public void onCrafting(EntityPlayer player, ItemStack item,
		IInventory craftMatrix) {
	// TODO Auto-generated method stub
	if(item.itemID == 5000) //if item is ItemDefenseGun3x3v1
	{
//			craftMatrix.setInventorySlotContents(5000, item);
		mod.takenFromCrafting(player, item, craftMatrix);
		//player.inventory.addItemStackToInventory(item);
		System.out.println("onCrafting");
	}


}

@Override
public void onSmelting(EntityPlayer player, ItemStack item) {
	// TODO Auto-generated method stub

}

}

 

public static ICraftingHandler craftingHandlerDG3x3v1 = new CraftingHandlerDefenseGun3x3v1(proxy);

 

@Init

GameRegistry.registerCraftingHandler(craftingHandlerDG3x3v1);

 

 

Can anyone tell me what I'm doing wrong and how I should be doing it?

 

I got pointed to a guide here: http://www.minecraftforge.net/wiki/How_to_add_an_Achievement

which was helpful in setting it up but not in telling it to do the right thing.

 

Thanks!

Link to comment
Share on other sites

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.