Topic category: Help with MCreator software
I'm trying to spawn a dropped item where a specific item entity is on the ground after being struck by lightning. (Basically simulating an item transformation)
The issue I'm facing is the procedure block meant to drop the item is seemingly refusing to work when it should. The only reason I'm confident about that is because the other blocks after that in the same column respond every time after lightning strikes the item and the debugger shows that the block is being called on every time.
Here's the entire procedure.
If the extra context helps, the only time this block does work is when the item entity name isn't being checked in the if section but as a result it means every single item on the ground can change if its struck by lightning. Changing the X Y Z coordinates of the spawn location to a declared number instead of the entity position apparently allows the item to spawn as well and I don't know what problem that indicates.
I'm relatively new to Mcreator and haven't used procedures all that much so any help is much appreciated on this.
Check entity type using "is entity of (sub)type" or using tag procedures and not by name
Actually, for checking the type of an item, there is a procedure block that allows you to get the itemstack from an item entity, then you can use that to compare if the itemstack matches the item you want to be converted.
"Is entity of (sub)type" is already being used and has been. Without the name check at all it just activates on every item entity on the ground no matter what it is which isn't what I want. I did try the nbt tag procedures however (via giving a tag through a "Entity spawns" event trigger) but unfortunately they produce the same result with the "spawn dropped item" procedure block just not doing anything regardless of what data type it is.
Normal tags do not work because they categorize item entities as a whole as just "items" instead of letting me pick a specific item and this is also the reason "is entity of (sub)type" alone does not work either.
Also thank you catnip i'll see if that works right now.
Unfortunately the itemstack check alternative didn't work either.
Btw let me reiterate that the problem isn't checking for what the item on the ground is. That's actually returning the value correctly and all the suggested methods filter out for an item correctly in the threads. It's that the "Spawn dropped item" procedure block does not spawn a dropped item, despite the rest of the checks returning a valid activation.
It completely skips that block but activates the "spawn particles" and "play sound" procedure blocks. I suspect the position blocks is the issue but I have no idea how to go about fixing that and storing variables alternatives did not work for that.
I misread the initial post, and I thought that it was a problem with checking the name. Now that I realize what is actually going on, I think that the item might actually be spawning, but because lightning strikes in Minecraft hit the area multiple times, the newly spawned item is being destroyed by lighting. A possible solution would be to make a secondary if block that checks if the new item is being struck by lighting, and if so, spawn in another copy of it. Alternatively, you could use the wait 20 ticks procedure block around the spawn item block only, possibly changing the time to 30 ticks, the wait procedure block isn't usually the best solution to problems, but I think it could work well for what you want in this case.
It worked, 20 ticks is just about the perfect timing and turns out that's the only block i needed so no new if block was required. Thank you!
I'm glad I was able to help.