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

Please help me, I don't know what I did wrong. I am trying to make the item take durability damage on crafting in minecraft 1.7.10. (P.S I am new to modding)

 

 

 

package com.pikachu923.BananaCraft.Handler;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;

import org.apache.logging.log4j.Level;

import com.pikachu923.BananaCraft.init.*;
import com.pikachu923.BananaCraft.utility.LogHelper;

public class CraftingHandler {

@SubscribeEvent
    public void onItemCraftedEvent(PlayerEvent.ItemCraftedEvent event) {
	LogHelper.Log(Level.DEBUG, "onCrafting Loaded");
	for(int i = 0; i < event.craftMatrix.getSizeInventory(); i++) {
		//if  (event.craftMatrix.getStackInSlot(i) != null) {

			ItemStack item0 = event.craftMatrix.getStackInSlot(i);
					if(item0 != null && item0.getItem() == Tier1Items.BananaLifeCore) {
						Item l = event.craftMatrix.getStackInSlot(i).getItem();
						ItemStack k = new ItemStack(l, 1, (item0.getItemDamage() + 1));

						if(k.getItemDamage() >= k.getMaxDamage()) {
							k.stackSize = 0;

						}

						event.craftMatrix.setInventorySlotContents(i, k);
					}

			/*ItemStack item1 = event.craftMatrix.getStackInSlot(i);
					if(item1 != null && item1.getItem() == Tier1Items.BananaLifeCore) {
						ItemStack k = new ItemStack(Tier1Items.BananaLifeCore, 1, (item0.getItemDamage() + 1))

						if(k.getItemDamage() >= k.getMaxDamage()) {
							k.stackSize--;

						}

						event.craftMatrix.setInventorySlotContents(i, k);
					}*/

	}
}
}

 

 

 

Thanks in advanced

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.