Plugin for ItemStacks

Started by SomeoneElse on

Topic category: Plugins and third-party tools

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
Joined Feb 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This is a very nice work,…
Sun, 04/19/2020 - 20:53

This is a very nice work, but i have a question, there is a way to get/set itemstack in a block inventory slot ?

Joined Mar 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Wow, awesome plugin! But is…
Mon, 04/20/2020 - 08:38

Wow, awesome plugin! But is it possible to get itemstack from ItemEntity(minecraft:item)? It would find it very useful! :)

Joined Nov 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Sorry for the late reply,…
Sun, 04/26/2020 - 16:50

Sorry for the late reply, but both the "get/set stack in slot" and the "get stack from item" will be available in the next version. I'm waiting for the next MCreator snapshot, so I can test the plugin in 1.15 too

Joined Dec 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Nice plugin but will there…
Fri, 05/01/2020 - 13:14

Nice plugin but will there also be an option to Set/Get an Itemstack in a block and be usable even when the procedure is finished like NBT? 

Joined Nov 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
A new version of the plugin…
Sat, 05/02/2020 - 08:44

A new version of the plugin is now available. This one changes some important things on how item stacks are handled, so it's likely to break your procedures if you used an earlier version! Some important new features are:

  • Compatibility with the default MCreator item procedures (including the "Set/get NBT" and "Get/set item in slot")
  • Get/Set item from dropped item entity
  • Removed some redundant blocks. Some other blocks were kept in because they allow for any item stack and not just the dependency one

The upcoming MCreator snapshot will make some important changes to procedures, so there won't be a 2020.3 version until it's released

Joined Nov 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Uploaded a new version that…
Sun, 05/03/2020 - 10:51

Uploaded a new version that works with the latest 2020.3 snapshot. Some procedure blocks were removed because they're now part of the base MCreator plugin.

Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hey, looks pretty great…
Sat, 05/09/2020 - 20:49

Hey, looks pretty great. Where do I download the plugin?

Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hey bro. Sorry, Im kinda new…
Sat, 05/09/2020 - 21:02

Hey bro. Sorry, Im kinda new to MCreator, so after unzipping the file, how do I install the procedures into MCreator itself?

 

Thanks

Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ok, thanks man. I'll do that👍
Mon, 05/11/2020 - 04:34

Ok, thanks man. I'll do that👍

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I did this procedure for a…
Mon, 05/18/2020 - 13:17

I did this procedure for a recipe for my custom crafting bench with 2 input slots, but somehow every splash potion works instead of only splash potions of weakness :/ is this a bug or did I do something wrong?myprocedure

Joined Nov 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Sorry for the late reply,…
Sat, 05/23/2020 - 21:12

Sorry for the late reply, but you should use the "Item stack with potion effect" only to add more effects to potions. If you want to check for a specific potion, you'll have to:

  1. Check if the item is a potion
  2. Check if the NBT text tag "Potion" of the item is equal to "minecraft:weakness" (in your case)

This is an example of how to do it (replace "Provided itemstack" with "Get item in block slot")
Example

There's a list of "Potion" tag values on the Minecraft Wiki: https://minecraft.gamepedia.com/Potion#Data_values

Joined Jun 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
how would i go about making…
Thu, 05/28/2020 - 02:01

how would i go about making a procedure where, if i have 6 of an item, say a coin, if i right click a block, it takes all 6 from me and gives me a carrot, but if i have less than 6, it won't give me the carrot?