Fix and adjust basic move-debug output.

1. Let the basic move info be printed first, extended info gets printed
exra. This allows better printf-debugging, because the move info comes
first in any case :).
2. Show "correct" potion-effect strength.
This commit is contained in:
asofold 2013-03-12 21:37:14 +01:00
parent fc788f55c4
commit 5b324a1a81

View File

@ -70,10 +70,13 @@ public class DebugUtil {
final double jump = mcAccess.getJumpAmplifier(player);
final double speed = mcAccess.getFasterMovementAmplifier(player);
if (speed != Double.NEGATIVE_INFINITY || jump != Double.NEGATIVE_INFINITY){
builder.append(" (" + (speed != Double.NEGATIVE_INFINITY ? ("speed=" + speed) : "") + (jump != Double.NEGATIVE_INFINITY ? ("jump=" + jump) : "") + ")");
builder.append(" (" + (speed != Double.NEGATIVE_INFINITY ? ("speed=" + (speed + 1)) : "") + (jump != Double.NEGATIVE_INFINITY ? ("jump=" + (jump + 1)) : "") + ")");
}
// Print basic info first in order
System.out.print(builder.toString());
// Extended info.
if (BuildParameters.debugLevel > 0){
builder.setLength(0);
// Note: the block flags are for normal on-ground checking, not with yOnGrond set to 0.5.
from.collectBlockFlags(maxYOnGround);
if (from.getBlockFlags() != 0) builder.append("\nfrom flags: " + StringUtil.join(BlockProperties.getFlagNames(from.getBlockFlags()), "+"));
@ -85,10 +88,11 @@ public class DebugUtil {
if (to.getTypeId() != 0) addBlockInfo(builder, to, "\nto");
if (to.getTypeIdBelow() != 0) addBlockBelowInfo(builder, to, "\nto");
if (!to.isOnGround() && to.isOnGround(0.5)) builder.append(" (ground within 0.5)");
}
System.out.print(builder.toString());
}
}
public static void addBlockBelowInfo(final StringBuilder builder, final PlayerLocation loc, final String tag) {
builder.append(tag + " below id=" + loc.getTypeIdBelow() + " data=" + loc.getData(loc.getBlockX(), loc.getBlockY() - 1, loc.getBlockZ()) + " shape=" + Arrays.toString(loc.getBlockCache().getBounds(loc.getBlockX(), loc.getBlockY() - 1, loc.getBlockZ())));
}