Jump to content

Recommended Posts

Posted

Hello,

 

I'm new to the Forge modding community and I have been working on a small project for a couple days, and I have been able to troubleshoot every issue I had until now. Simply put, I need an item to use as a reusable crafting ingredient (see Botania's Mortar and Pestle). My original idea was for the item to have itself as containerItem, but as it turns out, that (obviously) isn't a possibility.

 

Looking for help on the internet, all similar threads I have found are, at least, dated 2017 and make use of the hasContainerItem() and getContainerItem() methods, which have since been deprecated. The comments on the Deprecated tag point me to an "ItemStack sensitive version", which I haven't been able to find. Also, the Forge docs don't mention ItemStack and, apart from this, I haven't been able to find any documentation on it.

 

I would be very thankful.If any of you could point me to either ItemStack documentation or the right methods to use for my problem.

 

Thanks in advance.

Posted
  On 5/14/2020 at 5:19 PM, Cerezo said:

see Botania's Mortar and Pestle

Expand  

You know Botania's code is open source, right? If you don't here's it's GitHub page.

It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".

Posted

Sadly, almost all of the documentation (even the JavaDocs in the code) is horribly outdated or lacking, as you mentioned.

For your case, the "ItemStack sensitive version" comment refers to the hasContainerItem and getContainerItem in IForgeItem, which Item implements. Basically, just add an ItemStack parameter to the deprecated versions and it will override the new versions.

I'm eager to learn and am prone to mistakes. Don't hesitate to tell me how I can improve.

Posted

Are you saying you are returning the original ItemStack reference in the getContainerItem method? I'm pretty sure you have to return a new/copy ItemStack, not just the same reference

Have you ever want the new operator to return a type that you didn't ask for? Well, now you can!

Posted
  On 5/14/2020 at 8:27 PM, Vinyarion said:

Are you saying you are returning the original ItemStack reference in the getContainerItem method? I'm pretty sure you have to return a new/copy ItemStack, not just the same reference

Expand  

Depends on what you're doing.

If you're using a tool as an "ingredient" and want to damage the tool, yes, you return the same stack that was passed in (after calling AttemptDamage on it).

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
  On 5/14/2020 at 8:27 PM, Vinyarion said:

returning the original ItemStack

Expand  

I'm saying I can't find any docs on ItemStack usage, so I'm not using it at all. imacatlol's comment helped. The tool will not recieve damage, by the way.

Posted
  On 5/14/2020 at 8:39 PM, Cerezo said:

I can't find any docs on ItemStack usage

Expand  

ItemStack is a vanilla class. It represents a (enchant-able, stack-able, damage-able) form of an Item (which is a prototypical singleton).

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Looking for unbeatable savings on Temu in 2025? Our exclusive Temu code [ald244107] is your key to unlocking a $100 OFF discount, plus much more! This verified promo code works for both new and existing customers, giving you up to 50% off your next order and even bigger savings on clearance items. With Temu coupon code [ald244107], you'll get a flat $100 discount on top of existing sales. First-time users can enjoy an extra 100% off select items, while returning shoppers automatically qualify for the $100 OFF when applying the code at checkout. Imagine saving up to 90% on your favorite products across the USA, Canada, UK, and many other countries! 🔥 Temu Coupon Highlights with Code [ald244107]:  * Temu New User Offer: Use ald244107 for 50% off your first order + $100 OFF.  * Temu Existing Customer Promo: Apply ald244107 to get an instant $100 OFF.  * Global Reach: Valid in the USA, UK, Canada, Germany, France, Japan, Chile, Colombia, Malaysia, Mexico, South Korea, Philippines, Saudi Arabia, Qatar, Pakistan, and more.  * Top 2025 Deal: Secure $200 OFF plus 100% bonus discounts with ald244107. Maximize Your Savings: Top Temu Deals for 2025 (Code: ald244107)  * ✅ Temu Memorial Day Sale: Save $100 with ald244107  * ✅ Temu First Order Special: Use ald244107 for 50% + $100 OFF  * ✅ Temu USA Exclusive: Get $100 off instantly with ald244107  * ✅ International Temu Codes: ald244107 works in Japan, Germany, Chile, and many others.  * ✅ Temu Reddit Discount: Enjoy $100 OFF for both new and old users.  * ✅ Temu Coupon Bundle 2025: Combine $100 OFF with up to 50% slash deals.  * ✅ 100% OFF Free Gift Code: Use ald244107 – no invitation needed!  * ✅ Temu Sign-Up Bonus: Instantly get a welcome $100 OFF.  * ✅ Free Temu Code for New Users: Apply ald244107 – no referral required.  * ✅ Temu Clearance Codes 2025: Use ald244107 for 85–100% discounts. This Temu code [ald244107] is more than just a discount; it's your ticket to free shipping, exclusive first-order deals, and stackable coupon bundles across electronics, fashion, home goods, and beauty products. You can truly unlock up to 90% OFF plus an additional $100 OFF on qualified orders. 💡 Pro Tip: Don't forget to apply ald244107 during checkout on the Temu app or website to activate your instant $100 discount, even if you’re a returning customer! Temu $100 OFF Code by Country (All Use ald244107):  * 🇺🇸 Temu USA – ald244107  * 🇯🇵 Temu Japan – ald244107  * 🇲🇽 Temu Mexico – ald244107  * 🇨🇱 Temu Chile – ald244107  * 🇨🇴 Temu Colombia – ald244107  * 🇲🇾 Temu Malaysia – ald244107  * 🇵🇭 Temu Philippines – ald244107  * 🇰🇷 Temu Korea – ald244107  * 🇵🇰 Temu Pakistan – ald244107  * 🇫🇮 Temu Finland – ald244107  * 🇸🇦 Temu Saudi Arabia – ald244107  * 🇶🇦 Temu Qatar – ald244107  * 🇫🇷 Temu France – ald244107  * 🇩🇪 Temu Germany – ald244107 Real Shoppers, Real Savings: User Reviews We love hearing about your experiences! Here’s what some happy shoppers are saying about using the Temu code [ald244107]:  * Alice W., USA ⭐️⭐️⭐️⭐️⭐️ (5/5) "Great experience! Temu's promo code {ald244107} saved me a lot on my first order. Highly recommend this offer!"  * James T., UK ⭐️⭐️⭐️⭐️ (4/5) "Very happy with the quality and prices on Temu. The $100 credits offer was a nice bonus using {ald244107}. Will shop again."  * Sara M., Canada ⭐️⭐️⭐️ (3/5) "Got some decent deals with the {ald244107} code, though shipping took a bit longer than expected. Overall satisfied with the credits."
    • Thank you so much! I didnt see it in the log😭😭  
    • So im completely new to modding in general, i have some experience in Behavior packs in minecraft bedrock and i would like to modify entities stats and attributes like in a behavior pack (health, damage, speed, xp drop...). The problem is that i cant find any information online on how to do that, and I have no clue on what to do and where to start. I am currently modding in 1.20.4 with IntelliJ if that helps. My final objective is to buff mobs health and damage (double it for exemple), but since there is no entity file anywhere i don't know how to change it... 😢
    • Hey there, nothing to do with the code, I am just suggesting you use Intelij IDEA. Trust me, it is the best.
    • Hey there, nothing to do with the code, I am just suggesting you use Intelij IDEA. Trust me, it is the best.
  • Topics

×
×
  • Create New...

Important Information

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