added flying kick prevention to other vertical movement modules

This commit is contained in:
MachineMuse 2013-04-22 18:58:55 -06:00
parent f8ddad0a6a
commit 569c9b27de
5 changed files with 12 additions and 5 deletions

View file

@ -284,10 +284,7 @@ public class MusePlayerUtils {
player.motionX *= ratio;
player.motionZ *= ratio;
}
if(player instanceof EntityPlayerMP) {
((EntityPlayerMP)player).playerNetServerHandler.ticksForFloatKick = 0;
}
resetFloatKickTicks(player);
ElectricItemUtils.drainPlayerEnergy(player, totalEnergyDrain);
}
@ -299,6 +296,12 @@ public class MusePlayerUtils {
}
}
public static void resetFloatKickTicks(EntityPlayer player) {
if(player instanceof EntityPlayerMP) {
((EntityPlayerMP)player).playerNetServerHandler.ticksForFloatKick = 0;
}
}
public static EntityPlayer toPlayer(Object data) {
EntityPlayer player = null;
try {

View file

@ -56,6 +56,7 @@ public class BlinkDriveModule extends PowerModuleBase implements IRightClickModu
double range = ModuleManager.computeModularProperty(itemStack, BLINK_DRIVE_RANGE);
double energyConsumption = ModuleManager.computeModularProperty(itemStack, BLINK_DRIVE_ENERGY_CONSUMPTION);
if (ElectricItemUtils.getPlayerEnergy(player) > energyConsumption) {
MusePlayerUtils.resetFloatKickTicks(player);
ElectricItemUtils.drainPlayerEnergy(player, energyConsumption);
world.playSoundAtEntity(player, "mob.endermen.portal", 0.5F, 0.4F / ((float) Math.random() * 0.4F + 0.8F));
// MuseLogger.logDebug("Range: " + range);

View file

@ -5,6 +5,7 @@ import java.util.List;
import net.machinemuse.api.IModularItem;
import net.machinemuse.api.MuseCommonStrings;
import net.machinemuse.api.MuseItemUtils;
import net.machinemuse.api.MusePlayerUtils;
import net.machinemuse.api.moduletrigger.IPlayerTickModule;
import net.machinemuse.api.moduletrigger.IToggleableModule;
import net.machinemuse.powersuits.control.PlayerInputMap;
@ -52,6 +53,7 @@ public class GliderModule extends PowerModuleBase implements IToggleableModule,
float forwardkey = movementInput.forwardKey;
ItemStack torso = player.getCurrentArmor(2);
boolean hasParachute = false;
MusePlayerUtils.resetFloatKickTicks(player);
if (torso != null && torso.getItem() instanceof IModularItem) {
hasParachute = MuseItemUtils.itemHasActiveModule(torso, ParachuteModule.MODULE_PARACHUTE);
}

View file

@ -53,11 +53,11 @@ public class JumpAssistModule extends PowerModuleBase implements IToggleableModu
player.motionY += 0.15 * Math.min(multiplier, 1) * MusePlayerUtils.getWeightPenaltyRatio(MuseItemUtils.getPlayerWeight(player), 25000);
MovementManager.setPlayerJumpTicks(player, multiplier - 1);
}
player.jumpMovementFactor = player.landMovementFactor * .7f;
} else {
MovementManager.setPlayerJumpTicks(player, 0);
}
MusePlayerUtils.resetFloatKickTicks(player);
}
@Override

View file

@ -45,6 +45,7 @@ public class ParachuteModule extends PowerModuleBase implements IToggleableModul
boolean sneakkey = movementInput.sneakKey;
ItemStack torso = player.getCurrentArmor(2);
boolean hasGlider = false;
MusePlayerUtils.resetFloatKickTicks(player);
if (torso != null && torso.getItem() instanceof IModularItem) {
hasGlider = MuseItemUtils.itemHasActiveModule(torso, GliderModule.MODULE_GLIDER);
}