Closed KioProject123 closed 1 year ago
public class MaterialTagsTest extends AbstractTestingBase {
@Test
public void testEnchantables() {
for (final Item item : BuiltInRegistries.ITEM) {
boolean hasMatch = false;
Set<EnchantmentCategory> matched = new HashSet<>();
for (final EnchantmentCategory value : EnchantmentCategory.values()) {
if (value.canEnchant(item)) {
hasMatch = true;
matched.add(value);
}
}
boolean isTagged = MaterialTags.ENCHANTABLE.isTagged(CraftMagicNumbers.getMaterial(item));
if (hasMatch != isTagged) {
System.out.println("Item: " + item.getDescriptionId() + " matchedEnch: " + hasMatch + " tagged: " + isTagged + " :" + matched);
}
}
}
}
output:
MaterialTagsTest > testEnchantables() STANDARD_OUT
[08:39:10 INFO]: [STDOUT]: Item: block.minecraft.carved_pumpkin matchedEnch: true tagged: false :[cat: WEARABLE, cat: VANISHABLE]
[08:39:10 INFO]: [STDOUT]: Item: item.minecraft.compass matchedEnch: true tagged: false :[cat: VANISHABLE]
[08:39:10 INFO]: [STDOUT]: Item: block.minecraft.skeleton_skull matchedEnch: true tagged: false :[cat: WEARABLE, cat: VANISHABLE]
[08:39:10 INFO]: [STDOUT]: Item: block.minecraft.wither_skeleton_skull matchedEnch: true tagged: false :[cat: WEARABLE, cat: VANISHABLE]
[08:39:10 INFO]: [STDOUT]: Item: block.minecraft.player_head matchedEnch: true tagged: false :[cat: WEARABLE, cat: VANISHABLE]
[08:39:10 INFO]: [STDOUT]: Item: block.minecraft.zombie_head matchedEnch: true tagged: false :[cat: WEARABLE, cat: VANISHABLE]
[08:39:10 INFO]: [STDOUT]: Item: block.minecraft.creeper_head matchedEnch: true tagged: false :[cat: WEARABLE, cat: VANISHABLE]
[08:39:10 INFO]: [STDOUT]: Item: block.minecraft.dragon_head matchedEnch: true tagged: false :[cat: WEARABLE, cat: VANISHABLE]
[08:39:10 INFO]: [STDOUT]: Item: block.minecraft.piglin_head matchedEnch: true tagged: false :[cat: WEARABLE, cat: VANISHABLE]
[08:39:10 INFO]: [STDOUT]: Item: item.minecraft.brush matchedEnch: true tagged: false :[cat: BREAKABLE, cat: VANISHABLE]
I think ideally a fix for this would also see if we can get a test working for some of this stuff, I had to manually hack MaterialTags into not blowing up due to the lack of registries from the seems of it
Hello hello! I'm a java junior dev and I'd be interested in helping out. Could I be assigned to this?
We generally don't assign issues, you are free to open a PR however to resolve this! As cat said, we might want to look into creating tests for this to prevent us from missing stuff in the future, however I think it would be fine to merge a PR only fixing this specific issue too if you don't feel comfortable in creating test cases.
We can always open a new issue to create test cases later.
I'll have a look then! Thank you very much.
if you need any assitance just join #paper-dev on our discord (https://discord.gg/papermc) and I am sure people will be happy to help :)
Expected behavior
The brush is enchantable, so
MaterialTags.ENCHANTABLE.isTagged(Material.BRUSH)
should return trueObserved/Actual behavior
MaterialTags.ENCHANTABLE.isTagged(Material.BRUSH)
return falseSteps/models to reproduce
.
Plugin and Datapack List
.
Paper version
I am not using Paper, but I confirm that this occurred on the latest Paper
Other
No response