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.

P0rtal

Members
  • Joined

  • Last visited

Everything posted by P0rtal

  1. Just abandon replying. I some how managed to fix it (must of been when I changed the name of the needle_used item while adding a new item) thanks for helping!
  2. Alright so I changed it from the container to a new itemstack: package p0rtal.items; import p0rtal.main.Strings; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.oredict.OreDictionary; public class needle extends Item { { this.setUnlocalizedName("needle"); this.setTextureName(Strings.modid + ":" + "needle"); this.setMaxStackSize(1); } public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ if(stack != null){ --stack.stackSize; player.attackTargetEntityWithCurrentItem(player); player.inventory.addItemStackToInventory(new ItemStack(smItems.needle_use)); } return stack; } } It spawns in the item now, yes, but it deletes it also at the same time. They don't share the same ID too...
  3. Alright, so I'm trying to make a mod where blood is basically the essence of life, and the most important item is not working correctly. What I'm trying to do is make it so that onItemRightClick the Item removes itself, hurts the player and gives itself an other Item. My Item Class: package p0rtal.items; import p0rtal.main.Strings; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.oredict.OreDictionary; public class needle extends Item { { this.setUnlocalizedName("needle"); this.setTextureName(Strings.modid + ":" + "needle"); this.setMaxStackSize(1); setContainerItem(smItems.needle_use); } public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ if(stack != null){ --stack.stackSize; getContainerItem(); player.attackTargetEntityWithCurrentItem(player); } return stack; } } I've tried adding the setContainerItem() inside the if Statement (where the --stack.stackSize; and stuff is)and right before the return line, same thing with getContainerItem(). Each time I use the item though, it only damages me and gets rid of the item. Is there a way to do this? Thanks in advance, P0rtal.
  4. Put this code near the bottom of your item class: @Override public ItemStack getContainerItem(ItemStack stack) { if (stack.attemptDamageItem(1, itemRand)) { return null; } return stack; } And if you want it to stay in your crafting grid add this under the last one: @Override public boolean doesContainerItemLeaveCraftingGrid(ItemStack par1ItemStack) { return false; } and in your crafting manager, use it like this for simplicity: GameRegistry.addShapelessRecipe(new ItemStack(IronRod.iRod, 4), new ItemStack(IronFile.iFile, 1, OreDictionary.WILDCARD_VALUE), (IronPlate.iPlate)); Hope this helps.

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.