Started by
Liam Jones
on
Topic category: Feature requests and ideas for MCreator
I am trying to make a block that combines the enchantments of two Items for cheap, but the problem is that there isn't a procedure block that detects which enchantment your item has. There is a block that detects whether the item is enchanted, and if it has a specific enchantment, but to find what enchantment exactly your item has, you need to have one of each "does the item have x enchantment?" blocks.
It would be quite useful to just be given that information with one block.
U mean combine checking if it is enchanted and checking if it has specific enchantment into one block?
I think that would be kinda pointless since im pretty sure that if item has enchantment x then it is enchanted, if it doesn't have, then it may be enchanted but it doesn't have your specific enchant.
No, you're right that that would be pointless. What I mean is a block that tells you *which* enchantment it does have. Not whether it has an enchantment or if it has a specific enchantment. Instead of asking "Does x have y enchantment?" It'd be asking "What enchantment does x have?" and it would return a text or number value.
A theoretical example would be in an anvil-like GUI with two slots to combine enchantments. You could say "copy slot 0 to the output slot, and enchant it with [get enchantment of item in slot 1]"
Uhh, it wouldn't return a number or text cause those are not enchantments (text can be name of the enchantment in game, but in programming its different thing).
You mean list of all enchantments that item has? Mcreator does not support lists (or maps in this case) so it wont be added (at least anytime soon). You can do it yourself but it will require custom code
Well, don't know how to respond to that
I did a similar thing before. these are the code parts I wrote
using this, you can get the "id" of your item's enchantments. they are like minecraft:sharpness (not completely sure about this)
for getting the enchantment by its id, it gets more difficult
this part of code is really not readable but it just works
I don't know why I used compareTo == 0. maybe it can be replaced by str1 == str2. test it yourself. also I recommend trying different things to find a better way to do this.
also I am gonna try to create procedures for this (get number of enchantments on item, get enchantment with index i from itemstack, also every procedure that takes enchantment as its input). I will reply to this post if I complete it.
That first part is exactly what I was thinking. A block that returns the ID of the enchantment. However, I realize that it would require a list if there were multiple enchantments on the item.