use the new GLIDER DataComponent

This commit is contained in:
hyperdefined
2025-07-23 12:19:40 -04:00
parent 86cbdd58ff
commit 525df4bcf6
3 changed files with 34 additions and 8 deletions

View File

@@ -17,6 +17,8 @@
package lol.hyper.toolstats.tools;
import io.papermc.paper.datacomponent.DataComponentType;
import io.papermc.paper.datacomponent.DataComponentTypes;
import lol.hyper.toolstats.ToolStats;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
@@ -116,6 +118,22 @@ public class ItemChecker {
return mineItems.contains(itemType);
}
/**
* In newer versions of Minecraft, you can make items glide, which works
* like an Elytra.
*
* @param itemStack The item to check.
* @return True/false if the item can glide like an Elytra.
*/
public boolean canGlide(ItemStack itemStack) {
// if it's an elytra, we are good
if (itemStack.getType() == Material.ELYTRA) {
return true;
}
// otherwise if it has the GLIDER data
return itemStack.hasData(DataComponentTypes.GLIDER);
}
/**
* Check a given item for a target token.
*