Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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!

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.