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 solved my original issue, scroll down I ask another question about how to make my custom furnace have metadata sensitive input.

 

EDIT: SCROLL DOWN! MORE INFO ABOUT STUFF IS DOWN THERE|

                                                                                              V

Don't see anything random in your code...

Do you really want to duplicate your chisel when it is on the crafting bench ?  (stacksize = 2  ???)

And you are checking all slots here, without stopping at the first chisel found.

 

What is the recipe calling your crafting handler ? it should contain a chisel.

  • Author

Also, I have one more problem. If you look at my github a few posts up, I have a custom furnace called "Compression Chamber" I want to be able to smelt a materialOne with a damage of 1 into a materialOne with a damage of 3. Could anyone help me?

  • Author

I really don't know why people aren't answering MY question. :( I really need those two questions answered before I can release next version of my mod, or the next commit of my mod

 

  • Author

Ok, I've done my randomly breaking!! :D :D :D

 

I still need help with making my "Compression Chamber" have metadata sensitive input.

 

my code for randomly breaking the chisel or not breaking it is this:

package com.jmanpenilla.carbonmod.core.handlers;

import java.util.Random;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;

import com.jmanpenilla.carbonmod.item.Items;
import com.jmanpenilla.carbonmod.lib.Reference;

import cpw.mods.fml.common.ICraftingHandler;

/**
* CarbonMod
* 
* @author jmanpenilla
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
* 
*/

public class CraftingHandler implements ICraftingHandler{

@Override
public void onCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix) 
{

	final int x = 1;
	final int y = Reference.chiselBreakTime;
	int rand = new Random().nextInt(y-x) + x;

	for(int i=0; i < craftMatrix.getSizeInventory(); i++) //Checks all the slots
	{               
		if(craftMatrix.getStackInSlot(i) != null) //If there is an item
		{

			ItemStack j = craftMatrix.getStackInSlot(i); //Gets the item

			if(j.getItem() != null && j.getItem() == Items.chisel && j.getItemDamage() == 0 && rand == 2)
			{
				ItemStack l = new ItemStack(Items.chisel, 2, 1);
				craftMatrix.setInventorySlotContents(i, l);
			}

			else if(j.getItem() != null && j.getItem() == Items.chisel && j.getItemDamage() == 0)
			{
				ItemStack k = new ItemStack(Items.chisel, 2, (j.getItemDamage() + 0)); //Makes a new itemstack that's been damaged and has 2 items
				craftMatrix.setInventorySlotContents(i, k); //Sets the slot to the new item     
			}

		}
	}
}
@Override
public void onSmelting(EntityPlayer player, ItemStack item) {

}
}

Follow FurnaceRecipes lists example. Make your own metadata sensitive version and use it for your tile.

  • Author

I know that I need to make one, I'm just confused on how to go about that. I am sure someone has done it, and I was hoping someone could give me an example of how to go about that.

Guest
This topic is now closed to further replies.

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.