Elytra Slot (Fabric/Forge/Quilt)

Elytra Slot (Fabric/Forge/Quilt)

64M Downloads

Add Flight Modifier Attribute on Elytra in slot

ricksouth opened this issue ยท 2 comments

commented

Hi! I've had a lot of requests to make Easy Elytra Takeoff compatible, which I succeeded in with the Colytra mod without depending by checking for the "flight modifier" attribute. In case of 1.16.2 this is the code I use:

Collection<ModifiableAttributeInstance> atrb = player.func_233645_dx_().func_233789_b_();
for (ModifiableAttributeInstance ai : atrb) {
	for (AttributeModifier m : ai.func_225505_c_()) {
		if (m.getName().equalsIgnoreCase("flight modifier")) {
			if (m.getAmount() >= 1.0) {
				foundelytra = true;
			}
		}
	}
}

I was wondering if it's possible to add the same flight modifier attribute when an Elytra is equiped in the Curious slot? There might be a reason why this isn't the case which I of course understand. Just thought I'd ask! Love your mods.

Due to the way I currently have my dev environment setup depending on specific mods is quite difficult. Might be something I have to change in the future though.

commented

Thanks! Worked like a charm.

commented

Curious Elytra and Colytra use the same elytra library, Caelus, so it actually does use an attribute modifier already in exactly the same way.
https://github.com/TheIllusiveC4/CuriousElytra/blob/70055d95a2a22a82896935edf7e7d8d4e498f97b/src/main/java/top/theillusivec4/curiouselytra/CurioElytra.java#L40-L42

I imagine you can just check for "elytra curio modifier" as well and that'd be it.