-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3fd22fe
commit aa7febd
Showing
2 changed files
with
39 additions
and
39 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
src/main/java/com/lambda/EntityLivingBaseFireworkHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.lambda; | ||
|
||
import com.lambda.client.module.modules.movement.ElytraFlight; | ||
import com.lambda.mixin.accessor.AccessorEntityFireworkRocket; | ||
import com.lambda.mixin.entity.MixinEntityLivingBase; | ||
import net.minecraft.client.entity.EntityPlayerSP; | ||
import net.minecraft.entity.EntityLivingBase; | ||
|
||
/** | ||
* Using {@link AccessorEntityFireworkRocket} in {@link MixinEntityLivingBase} causes a crash on older | ||
* Mixin versions (like the one Impact uses). Putting the methods using AccessorEntityFireworkRocket outside | ||
* the MixinEntityLivingBase seems to fix the issue. | ||
*/ | ||
public class EntityLivingBaseFireworkHelper { | ||
public static boolean shouldWork(EntityLivingBase entity) { | ||
return EntityPlayerSP.class.isAssignableFrom(entity.getClass()) | ||
&& ElytraFlight.INSTANCE.isEnabled() | ||
&& ElytraFlight.INSTANCE.getMode().getValue() == ElytraFlight.ElytraFlightMode.VANILLA; | ||
} | ||
|
||
public static boolean shouldModify(EntityLivingBase entity) { | ||
return shouldWork(entity) && entity.world.loadedEntityList.stream().anyMatch(firework -> { | ||
if (firework instanceof AccessorEntityFireworkRocket) { | ||
EntityLivingBase boosted = ((AccessorEntityFireworkRocket) firework).getBoostedEntity(); | ||
return boosted != null && boosted.equals(entity); | ||
} | ||
|
||
return false; | ||
} | ||
); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters