
[Fabric] Flight Modifier attribute not found when having a colytra equiped
ricksouth opened this issue ยท 3 comments
Versions (Be specific, do not write "latest"):
- Colytra: colytra-fabric-6.0.0+1.19.2.jar
- Caelus (for Forge): N/A
- Forge/Fabric: Fabric
Observed Behavior:
Using the following code in the Forge version of Colytra, I am able to find the "flight modifier" value when having a Colytra equiped:
Collection<AttributeInstance> atrb = player.getAttributes().getSyncableAttributes();
for (AttributeInstance ai : atrb) {
for (AttributeModifier m : ai.getModifiers()) {
String name = m.getName().toLowerCase();
However this does not seem to work in the Fabric version. I assume this would also be the case for the elytra curio modifier value, but I haven't tested that.
Expected Behavior:
I would expect the flight modifier value to show up with a colytra equiped, to add compatibility.
Steps to Reproduce:
- Equip a Colytra
- Run the code shown above
- It only shows the following values when having a diamond colytra equiped, the same as a normal diamond chestplate:
[13:23:18] [Server thread/INFO]: [STDOUT]: armor toughness
[13:23:18] [Server thread/INFO]: [STDOUT]: armor modifier
If I should be using another way to check if the Colytra is equiped, please let me know. I used this code quite a long time ago to add compatibility with Easy Elytra Takeoff in Forge. I'd prefer if I don't have to add the mod as a dependency in my build.gradle.
Thanks for your time!
Serilum/.issue-tracker#1310 for reference
This is due to Forge and Fabric having different ecosystems for elytra flight. The Forge version uses Caelus, which is where the attribute modifiers are implemented. The Fabric version uses Fabric API's EntityElytraEvents.CUSTOM
event to grant elytra flight instead.
I'm not familiar with your code exactly, so I'm just taking a guess, but on Fabric you can likely implement the compatibility for this by invoking the event yourself and checking if it returns true (also making sure that tickElytra
is false to avoid actually using the elytra in the process).
Appreciate it! I did as you said and it's working like a charm. Thank you.
boolean foundelytra = EntityElytraEvents.CUSTOM.invoker().useCustomElytra(player, false);