Comparing item metadata in inventory slots

Published by Impshial on
Status
Works as designed
Issue description

I am currently trying to build a simple redstone-powered, automated fishing machine. I've gotten most everything to work, except for the fish appearing in the block's inventory.

I'm currently testing all of the functionality, so I'm using a simple random number generation to decide if a fish is caught. When I hit an update-tick, the procedure generates a random number between 1 and 10. If that number is < 1, the procedure randomly chooses between the 4 vanilla fish available and attempts to place 1 into an available slot in the GUI (it loops through the slots and adds to the stack if that fish has a stack < 64 and if not, adds 1 to the next available empty slot).

My issue is that the metadata of the fish I choose in the procedure interface isn't being translated over to code. So the fish just overwrite each other in the first slot.

I can't find anything in the procedure interface to check metadata, so I'm hoping there is a fix, or workaround available for this.

If I can't get around the metadata issue, I'm gonna stop moving forward on this block (adding weights for fish types and other non-fish items).

I have included the updateTick procedure and the code to this issue.

Thanks in advance!

Issue comments

Does this mean you won't be supporting 1.12.2 in the future?

My mod is designed for 1.12.2 packs.

We will for some more time, but we will not direct MCreator's features in 1.12.2 direction. Be warned that 1.12.2 was marked legacy by Minecraft Forge devs so 1.12.2 will become obsolete.

Ok, this is understandable.

Having said that, do you see any reason why the itemstack metadata shouldn't be working? I see the metadata values in the correct places in the code. I'm just wondering why they aren't being compared during the event? Can you think of a way to get around this?

It's not working properly at all. The fish are being overwritten after a comparison, unless there's something in the procedure I'm doing wrong... but I can't see anything wrong with it.

And this only affects fish. It doesn't overwrite items/blocks that aren't fish.

Why did you mark this topic resolved? The metadata isn't being read by the procedure during comparison in the procedure, but is showing up in the code. 

In 2020.1, we have removed metadata compare procedure block (==) so this is normal. 1.14.4 does not have metadata anymore so == and = blocks are not needed anymore.

You use = compare blocks which do not compare for metadata.

So in previous versions of MCreator, this would've worked?

I figured out a workaround. Works perfectly now, and I can use ==

Thanks!

Just an FYI, you can bring == procedure blocks into the 2020 snapshots by importing them from a 1.9.1 export.

Not sure if you were aware of this, just wanted to let you know.

This is normal since we want to offer backwards compatibility. I might add this to the list of procedure templates too.