Plugin for ItemStacks

Started by SomeoneElse on

Topic category: Plugins and third-party tools

Last seen on 14:12, 3. Jun 2023
Joined Nov 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Plugin for ItemStacks
Wed, 07/01/2020 - 15:14 (edited)

This plugin adds some procedure blocks to declare itemstack variables and work with them. The variables are compatible with the base MCreator procedures.

06/07 patch for 2020.3 version: removed the itemstack variable blocks and the "Is item enchanted/enchantable" blocks. Make sure to replace them with the default MCreator ones before installing the update!

How to use

Start by declaring a new itemstack variable. This is the same as adding a text/logic/number local variable, except it's done with a block. You can then reference the variable using the "Get/set itemstack" blocks. You can declare as many itemstack variables as you want, provided they have different names. Avoid using the name itemstack  because it's used by the itemstack dependency. In versions 2020.3 and above, itemstack variables can be used the same way as logic/number/text variables.

Declaring a new variable
Declaring a new itemstack variable

If you declare a variable inside a loop or an if statement, the variable will exist only inside that loop. For example, this procedure will cause a recompilation error, because stack2 doesn't exist outside the if block
Recompilation error
 

List of features

Some of these blocks might seem redundant, but they allow for any itemstack instead of only the dependency one. For the same reason, the 2020.3 adds less procedure blocks

  • Itemstack variable procedures (2020.2)
    • Declare an itemstack variable
    • Get/set an itemstack variable
    • Create a new item stack given an item and an amount
  • Size procedures (2020.2)
    • Get/set the size of an item stack
    • Increase/Decrease the size of an item stack
  • Enchantment procedures
    • Check if the item stack is enchanted or enchantable (2020.2)
    • Add a specific enchantment to any item stack (2020.2)
    • Create an item stack with a random enchantment
  • Attribute modifier procedures
    • Add a vanilla attribute modifier to the itemstack
    • Check if an itemstack has a vanilla attribute modifier
  • Entity procedures
    • Get/set the stack in a player's inventory slot
    • Get/set the stack in a living entity's armor slots
    • Get/set the stack of a dropped item
    • Get/set the stack of an item frame
  • Comparison procedures
    • Compare the items (with or without damage) of different itemstacks
    • Compare the NBT tags of different itemstacks
  • Damage procedures
    • Get/Set the damage of any item stack (2020.2)
    • Check if an item stack is damageable
    • Get the max damage of any item stack (2020.2)
    • Deal damage to any itemstack (2020.2)
  • Other procedures
    • Create an itemstack with a potion effect
    • Set the custom name of any item stack (2020.2)
    • Remove the custom name of an item stack
    • Get/set the repair cost of an item stack (to use with anvils)

Download link

Version for MCreator 2020.2: https://drive.google.com/open?id=18WOg4HgVkUYDHjYKpOJrSzweB6PdVv2y
Version for MCreator 2020.3 (latest snapshot): https://drive.google.com/open?id=13cX6__apKZFVriKY0TM7UBqnlIAHZc3J

Example procedures

  • Consume the used item (and not the leftmost stack)
    Consume itemstack
     
  • Wear the held item as a hat
    Hat procedure
     
  • Count the amount of a certain item in a player's inventory. The inventory of a player has 41 slots: 0-35 are the default slots, 36-39 are the armor slots and 40 is the offhand slot. (There's a mistake in the image, the first block should be "Set Local:counter to: 0")
    Counting procedure
     
  • Turn dropped iron ingots to gold ingots
    Midas procedure
     
  • Add speed V for 3 seconds to an invisibility potion in the current open gui
    Speed potion procedure
     
  • Create an enchanter block powered by emeralds
    Emerald enchanter block
     

 

Edited by SomeoneElse on Wed, 07/01/2020 - 15:14
Last seen on 14:12, 3. Jun 2023
Joined Nov 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks! Added a few more…
Tue, 03/17/2020 - 10:20

Thanks! Added a few more procedures to the plugin: get/set the itemstack in an entity's hand, change the display name of an item stack, add an enchantment to an item stack, check if enchanted/enchantable and give item stack to player:
Example procedure

Last seen on 03:10, 19. Feb 2022
Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
can you give me the donwload…
Tue, 03/17/2020 - 10:34

can you give me the donwload and make it for 1.14?

Last seen on 14:12, 3. Jun 2023
Joined Nov 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Done! The plugin is…
Tue, 03/17/2020 - 15:16

Done! The plugin is available for download, and most things done so far work in 1.14 too

Last seen on 00:51, 3. Nov 2020
Joined Apr 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
could a get item stack from…
Wed, 03/18/2020 - 22:33

could a get item stack from certain inventory slots be possible/armor slots or would the create item stack with the get item from armour slot work?

Last seen on 14:12, 3. Jun 2023
Joined Nov 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It is possible: the next…
Wed, 03/18/2020 - 23:19

It is possible: the next version will have "Get/set item stack in inventory slot" procedure blocks

Last seen on 00:51, 3. Nov 2020
Joined Apr 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
question since you said they…
Thu, 03/19/2020 - 00:25

question since you said they are like local variables that means they would get cleared once the procedure is finished correct? 

Last seen on 14:12, 3. Jun 2023
Joined Nov 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yes, that's how local…
Thu, 03/19/2020 - 16:35

Yes, that's how local variables work in general

Last seen on 00:51, 3. Nov 2020
Joined Apr 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Shoot k well still this is…
Thu, 03/19/2020 - 19:41

Shoot k well still this is an awesome plugin. Maybe a way to store item stacks on other items Idk much about java but this forum seems to do that. https://www.minecraftforge.net/forum/topic/13213-savingloading-an-items…; it would be sweet to be able to store items somewhere it would allow for backpacks and such to be made. 

Last seen on 14:12, 3. Jun 2023
Joined Nov 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
New update is out, featuring…
Fri, 03/20/2020 - 18:44

New update is out, featuring:

  • Name procedures working in 1.14
  • Comparison procedures
  • Damage procedures
  • Attribute modifiers procedures
  • Random enchantment (similar to an enchanting table)
  • Get/Set stack in inventory/armor slot
Last seen on 03:10, 19. Feb 2022
Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
All vanilla attributes?
Sun, 03/22/2020 - 09:32

All vanilla attributes?

Last seen on 09:48, 26. Sep 2022
Joined Jun 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Where is the counting of…
Mon, 04/06/2020 - 03:02

Where is the counting of items in inve, I meant if I have 2+ of this item, I want it to automatically remove it (itemstack size max is 1)

 

Last seen on 14:12, 3. Jun 2023
Joined Nov 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@crispy_chips1234 Sorry for…
Wed, 04/08/2020 - 15:08

@crispy_chips1234 Sorry for the late reply, but yes, it supports all the vanilla attributes, except for some mob specific ones (e.g. parrot flying speed)

@minheragon12345 There's no "Count items in inventory" procedure because you can recreate it with local variables and for loops (check the last image of the post for an example that counts the amount of diamonds)