mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-19 03:49:31 +00:00
fix: infinite speed and altitude using glider with elytra (#240)
This commit is contained in:
1 parent
55928c5234
commit
554a08a515
5 files changed
+39
-4
No files matched your search
@@ -214,6 +214,7 @@ public class EnderIO {
|
||||
public static final boolean hasLwjgl3 = Loader.isModLoaded("lwjgl3ify");
|
||||
public static final boolean hasGT5 = Loader.isModLoaded("gregtech") && !Loader.isModLoaded("gregapi");
|
||||
public static final boolean hasHP = Loader.isModLoaded("hodgepodge");
|
||||
public static final boolean hasEtFuturum = Loader.isModLoaded("etfuturum");
|
||||
public static final boolean hasWailaPlugins = Loader.isModLoaded("wailaplugins");
|
||||
public static final boolean hasAutomagy = Loader.isModLoaded("Automagy");
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package crazypants.enderio.etfuturum;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import ganymedes01.etfuturum.elytra.IElytraPlayer;
|
||||
|
||||
public final class EtFuturumCompat {
|
||||
|
||||
private EtFuturumCompat() {}
|
||||
|
||||
public static boolean isElytraFlying(EntityPlayer player) {
|
||||
return EnderIO.hasEtFuturum && player instanceof IElytraPlayer
|
||||
&& ((IElytraPlayer) player).etfu$isElytraFlying();
|
||||
}
|
||||
|
||||
public static void stopElytraFlying(EntityPlayer player) {
|
||||
if (EnderIO.hasEtFuturum && player instanceof IElytraPlayer) {
|
||||
((IElytraPlayer) player).etfu$setElytraFlying(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -328,8 +328,10 @@ public class KeyTracker {
|
||||
}
|
||||
|
||||
private void handleGlide() {
|
||||
if (glideKey.isPressed()
|
||||
&& DarkSteelController.instance.isGliderUpgradeEquipped(Minecraft.getMinecraft().thePlayer)) {
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
if (glideKey.isPressed() && DarkSteelController.instance.isGliderUpgradeEquipped(player)
|
||||
&& (DarkSteelController.instance.isGlideActive(player)
|
||||
|| DarkSteelController.instance.canActivateGlide(player))) {
|
||||
toggleDarkSteelController(Type.GLIDE, "darksteel.upgrade.glider");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.etfuturum.EtFuturumCompat;
|
||||
import crazypants.enderio.item.darksteel.PacketUpgradeState.Type;
|
||||
import crazypants.enderio.item.darksteel.upgrade.EnergyUpgrade;
|
||||
import crazypants.enderio.item.darksteel.upgrade.GliderUpgrade;
|
||||
@@ -146,6 +147,8 @@ public class DarkSteelController {
|
||||
}
|
||||
|
||||
public void setActive(EntityPlayer player, Type type, boolean isActive) {
|
||||
if (type == Type.GLIDE && isActive && !canActivateGlide(player)) return;
|
||||
|
||||
EnumSet<Type> set = getActiveSet(player);
|
||||
if (isActive) {
|
||||
set.add(type);
|
||||
@@ -158,6 +161,10 @@ public class DarkSteelController {
|
||||
return isActive(player, Type.GLIDE);
|
||||
}
|
||||
|
||||
public boolean canActivateGlide(EntityPlayer player) {
|
||||
return !EtFuturumCompat.isElytraFlying(player);
|
||||
}
|
||||
|
||||
public boolean isSpeedActive(EntityPlayer player) {
|
||||
return isActive(player, Type.SPEED);
|
||||
}
|
||||
@@ -246,8 +253,10 @@ public class DarkSteelController {
|
||||
}
|
||||
|
||||
private void updateGlide(EntityPlayer player) {
|
||||
if (!isGlideActive(player) || !isGliderUpgradeEquipped(player)) {
|
||||
return;
|
||||
if (!isGlideActive(player) || !isGliderUpgradeEquipped(player)) return;
|
||||
|
||||
if (EtFuturumCompat.isElytraFlying(player)) {
|
||||
EtFuturumCompat.stopElytraFlying(player);
|
||||
}
|
||||
|
||||
if (!player.onGround && player.motionY < 0 && !player.isSneaking() && !player.isInWater()) {
|
||||
|
||||
Reference in new issue
Block a user