Keep track of ModelFlying in MoveData.

This commit is contained in:
asofold 2016-03-10 20:00:23 +01:00
parent ca8cbdaf05
commit 8d43b0abc5
2 changed files with 12 additions and 6 deletions

View File

@ -49,8 +49,11 @@ public class CreativeFly extends Check {
// Reset tags, just in case.
tags.clear();
// Edge data for this move.
// Some edge data for this move.
final GameMode gameMode = player.getGameMode();
final ModelFlying model = cc.getModelFlying(player, from);
final MoveData thisMove = data.thisMove;
thisMove.modelFlying = model;
final MoveData lastMove = data.moveData.getFirst();
// Ensure we have a set-back location.
@ -58,10 +61,6 @@ public class CreativeFly extends Check {
data.setSetBack(from);
}
final GameMode gameMode = player.getGameMode();
final ModelFlying model = cc.getModelFlying(player, from);
// TODO: Store model in past moves?
// Before doing anything, do a basic height check to determine if players are flying too high.
final double maximumHeight = model.maxHeight + player.getWorld().getMaxHeight();
if (to.getY() > maximumHeight) {

View File

@ -129,7 +129,13 @@ public class MoveData {
* MOVING_CREATIVEFLY, UNKNOWN.
*/
public CheckType flyCheck;
/**
* The ModelFlying instance used with this move, will be null if it doesn't
* apply.
*/
public ModelFlying modelFlying;
public boolean mightBeMultipleMoves;
private void setPositions(final PlayerLocation from, final PlayerLocation to) {
@ -170,6 +176,7 @@ public class MoveData {
hAllowedDistance = 0.0;
// Meta stuff.
flyCheck = CheckType.UNKNOWN;
modelFlying = null;
mightBeMultipleMoves = false;
// Done.
valid = true;