minecraft-source/src/net/minecraft/gametest/framework/GameTestSequence.java

43 lines
1.3 KiB
Java

package net.minecraft.gametest.framework;
import java.util.Iterator;
import java.util.List;
public class GameTestSequence {
private final GameTestInfo parent;
private final List<GameTestEvent> events;
private long lastTick;
public void tickAndContinue(final long long1) {
try {
this.tick(long1);
}
catch (Exception ex) {}
}
public void tickAndFailIfNotComplete(final long long1) {
try {
this.tick(long1);
}
catch (Exception exception4) {
this.parent.fail(exception4);
}
}
private void tick(final long long1) {
final Iterator<GameTestEvent> iterator4 = this.events.iterator();
while (iterator4.hasNext()) {
final GameTestEvent it5 = iterator4.next();
it5.assertion.run();
iterator4.remove();
final long long2 = long1 - this.lastTick;
final long long3 = this.lastTick;
this.lastTick = long1;
if (it5.expectedDelay != null && it5.expectedDelay != long2) {
this.parent.fail(new GameTestAssertException("Succeeded in invalid tick: expected " + (long3 + it5.expectedDelay) + ", but current tick is " + long1));
break;
}
}
}
}