Detect 1.11 horse types.

We do have increased issues on layered snow, possibly due to lost-ground
or bounding box. At least other horse types can be used somehow at all.
This commit is contained in:
asofold 2016-11-22 12:35:27 +01:00
parent da40bd06e2
commit 2cf064b3a9
2 changed files with 8 additions and 2 deletions

View File

@ -876,6 +876,7 @@ public class VehicleChecks extends CheckListener {
builder.append(LocUtil.simpleFormat(thisMove.from)); builder.append(LocUtil.simpleFormat(thisMove.from));
builder.append("\nTo: "); builder.append("\nTo: ");
builder.append(LocUtil.simpleFormat(thisMove.to)); builder.append(LocUtil.simpleFormat(thisMove.to));
builder.append("\n" + (thisMove.from.resetCond ? "resetcond" : (thisMove.from.onGround ? "ground" : "---")) + " -> " + (thisMove.to.resetCond ? "resetcond" : (thisMove.to.onGround ? "ground" : "---")));
builder.append("\n Vehicle: "); builder.append("\n Vehicle: ");
builder.append(LocUtil.simpleFormat(vLoc)); builder.append(LocUtil.simpleFormat(vLoc));
builder.append("\n Player: "); builder.append("\n Player: ");

View File

@ -36,6 +36,7 @@ import fr.neatmonster.nocheatplus.checks.moving.magic.MagicVehicle;
import fr.neatmonster.nocheatplus.checks.moving.model.VehicleMoveData; import fr.neatmonster.nocheatplus.checks.moving.model.VehicleMoveData;
import fr.neatmonster.nocheatplus.checks.moving.model.VehicleMoveInfo; import fr.neatmonster.nocheatplus.checks.moving.model.VehicleMoveInfo;
import fr.neatmonster.nocheatplus.checks.workaround.WRPT; import fr.neatmonster.nocheatplus.checks.workaround.WRPT;
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
import fr.neatmonster.nocheatplus.utilities.StringUtil; import fr.neatmonster.nocheatplus.utilities.StringUtil;
/** /**
@ -94,8 +95,12 @@ public class VehicleEnvelope extends Check {
/** Details for re-use. */ /** Details for re-use. */
private final CheckDetails checkDetails = new CheckDetails(); private final CheckDetails checkDetails = new CheckDetails();
private final Class<?> bestHorse;
public VehicleEnvelope() { public VehicleEnvelope() {
super(CheckType.MOVING_VEHICLE_ENVELOPE); super(CheckType.MOVING_VEHICLE_ENVELOPE);
Class<?> clazz = ReflectionUtil.getClass("org.bukkit.entity.AbstractHorse");
bestHorse = clazz == null ? Horse.class : clazz;
} }
public SetBackEntry check(final Player player, final Entity vehicle, final VehicleMoveData thisMove, final boolean isFake, final MovingData data, final MovingConfig cc) { public SetBackEntry check(final Player player, final Entity vehicle, final VehicleMoveData thisMove, final boolean isFake, final MovingData data, final MovingConfig cc) {
@ -326,9 +331,9 @@ public class VehicleEnvelope extends Check {
} }
checkDetails.gravityTargetSpeed = 0.79; checkDetails.gravityTargetSpeed = 0.79;
} }
else if (vehicle instanceof Horse) { else if (bestHorse.isAssignableFrom(vehicle.getClass())) {
// TODO: Climbable? -> seems not. // TODO: Climbable? -> seems not.
checkDetails.simplifiedType = EntityType.HORSE; checkDetails.simplifiedType = EntityType.HORSE; // TODO: 1.11 - Use AbstractHorse?
checkDetails.canJump = checkDetails.canStepUpBlock = true; checkDetails.canJump = checkDetails.canStepUpBlock = true;
} }
else if (vehicle instanceof Pig) { else if (vehicle instanceof Pig) {