Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.15.2] [SOLVED] How do you use clearMatchingItems?


ketchup_god
 Share

Recommended Posts

(I'm used to coding with other languages but Java is kind of new for me) I'm trying to create a totem of undying-ish item that gets used upon death. Everything is working, except I can't remove the item using clearMatchingItems. On the docs (https://skmedix.github.io/ForgeJavaDocs/javadoc/forge/1.9.4-12.17.0.2051/net/minecraft/entity/player/InventoryPlayer.html#clearMatchingItems-net.minecraft.item.Item-int-int-net.minecraft.nbt.NBTTagCompound-) it says that the method needs an item, a metadata, and an int, but in my IDE (Eclipse) it says I need a predicate <itemstack> instead of an item (maybe the docs I'm looking at are outdated). My question is, how am I supposed to use predicate with Itemstack, and if I need a metadata how I would use it?

Edited by ketchup_god
Link to comment
Share on other sites

3 hours ago, ketchup_god said:

how am I supposed to use predicate with Itemstack, and if I need a metadata how I would use it?

Metadata is old you are looking at outdated docs. A predicate is just an interface with one function you can use a lambda for it. The predicate is supposed to determine if the ItemStack passed as a parameter matches the item you want to remove.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

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

 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.