Set jumAmplifier to the actual value instead of 0 for some spots.

This commit is contained in:
asofold 2012-11-05 06:49:15 +01:00
parent 1a87a9d0da
commit 06a5d33542
2 changed files with 23 additions and 19 deletions

View File

@ -360,20 +360,11 @@ public class MovingListener implements Listener {
data.noFallAssumeGround = false;
data.teleported = null;
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
// Potion effect "Jump".
final double jumpAmplifier;
if (mcPlayer.hasEffect(MobEffectList.JUMP)) {
// final int amplifier = mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
// if (amplifier > 20)
// jumpAmplifier = 1.5D * (amplifier + 1D);
// else
// jumpAmplifier = 1.2D * (amplifier + 1D);
jumpAmplifier = 1D + mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
if (cc.debug) System.out.println(player.getName() + " Jump effect: " + data.jumpAmplifier);
}
else jumpAmplifier = 1D;
if (jumpAmplifier > data.jumpAmplifier) data.jumpAmplifier = jumpAmplifier;
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
// Potion effect "Jump".
final double jumpAmplifier = MovingListener.getJumpAmplifier(mcPlayer);
if (jumpAmplifier > 0D && cc.debug) System.out.println(player.getName() + " Jump effect: " + data.jumpAmplifier);
if (jumpAmplifier > data.jumpAmplifier) data.jumpAmplifier = jumpAmplifier;
// Just try to estimate velocities over time. Not very precise, but works good enough most of the time. Do
// general data modifications one for each event.
@ -459,7 +450,7 @@ public class MovingListener implements Listener {
moveInfo.cleanup();
parkedInfo.add(moveInfo);
}
/**
* A workaround for cancelled PlayerMoveEvents.
*
@ -770,4 +761,15 @@ public class MovingListener implements Listener {
public void onPlayerKick(final PlayerKickEvent event){
noFall.onLeave(event.getPlayer());
}
/**
* Determine "some jump amplifier": 1 is jump boost, 2 is jump boost II.
* @param mcPlayer
* @return
*/
public static final double getJumpAmplifier(final EntityPlayer mcPlayer) {
if (mcPlayer.hasEffect(MobEffectList.JUMP)) {
return 1D + mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
} else return 0D;
}
}

View File

@ -154,7 +154,7 @@ public class SurvivalFly extends Check {
// data.ground ?
// ? set jumpphase to height / 0.15 ?
data.survivalFlyJumpPhase = 0;
data.jumpAmplifier = 0; // Might conflict, should probably fetch.
data.jumpAmplifier = MovingListener.getJumpAmplifier(mcPlayer);
data.clearAccounting();
// Tell NoFall that we assume the player to have been on ground somehow.
data.noFallAssumeGround = true;
@ -260,7 +260,7 @@ public class SurvivalFly extends Check {
if (from.isInWeb()){
// Very simple: force players to descend or stay.
vAllowedDistance = from.isOnGround() ? 0.1D : 0;
data.jumpAmplifier = 0;
data.jumpAmplifier = 0; // TODO: later maybe fetch.
vDistanceAboveLimit = yDistance;
if (cc.survivalFlyCobwebHack && vDistanceAboveLimit > 0 && hDistanceAboveLimit <= 0){
if (now - data.survivalFlyCobwebTime > 3000){
@ -302,8 +302,10 @@ public class SurvivalFly extends Check {
vDistanceAboveLimit = Math.max(vDistanceAboveLimit, Math.abs(yDistance));
}
if (data.noFallAssumeGround || fromOnGround || toOnGround)
data.jumpAmplifier = 0D;
if (data.noFallAssumeGround || fromOnGround || toOnGround) {
// Some reset condition.
data.jumpAmplifier = MovingListener.getJumpAmplifier(mcPlayer);
}
if (cc.survivalFlyAccounting && !resetFrom){
final boolean useH = data.horizontalFreedom <= 0.001D;