BaritoneAutoTest
This commit is contained in:
parent
7db973017a
commit
ce55cc56c1
@ -8,12 +8,12 @@ services:
|
|||||||
install:
|
install:
|
||||||
- sudo apt-get update
|
- sudo apt-get update
|
||||||
- sudo apt-get install jshon
|
- sudo apt-get install jshon
|
||||||
- ./gradlew test
|
- docker build -t cabaletta/baritone .
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- docker build -t cabaletta/baritone .
|
- docker run cabaletta/baritone /bin/sh -c "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 128x128x24 -ac +extension GLX +render; DISPLAY=:99 BARITONE_AUTO_TEST=true ./gradlew runClient; sh scripts/build.sh"
|
||||||
- docker run cabaletta/baritone /bin/sh -c "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 128x128x24 -ac +extension GLX +render; DISPLAY=:99 BARITONE_AUTO_TEST=true ./gradlew runClient"
|
- docker cp $(docker ps -a -q):/code/dist dist
|
||||||
- sh scripts/build.sh
|
- ls dist
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
provider: releases
|
provider: releases
|
||||||
|
@ -21,4 +21,4 @@ RUN dpkg -i /code/scripts/xvfb_1.16.4-1_amd64.deb
|
|||||||
|
|
||||||
WORKDIR /code
|
WORKDIR /code
|
||||||
|
|
||||||
RUN ./gradlew assemble
|
RUN ./gradlew build
|
@ -1,6 +1,7 @@
|
|||||||
set -e # this makes the whole script fail immediately if any one of these commands fails
|
set -e # this makes the whole script fail immediately if any one of these commands fails
|
||||||
./gradlew build
|
./gradlew build
|
||||||
export VERSION=$(cat build.gradle | grep "version '" | cut -d "'" -f 2-2)
|
export VERSION=$(cat build.gradle | grep "version '" | cut -d "'" -f 2-2)
|
||||||
|
|
||||||
wget https://downloads.sourceforge.net/project/proguard/proguard/6.0/proguard6.0.3.zip
|
wget https://downloads.sourceforge.net/project/proguard/proguard/6.0/proguard6.0.3.zip
|
||||||
unzip proguard6.0.3.zip 2>&1 > /dev/null
|
unzip proguard6.0.3.zip 2>&1 > /dev/null
|
||||||
cd build/libs
|
cd build/libs
|
||||||
|
@ -23,6 +23,7 @@ import baritone.api.event.listener.IGameEventListener;
|
|||||||
import baritone.behavior.*;
|
import baritone.behavior.*;
|
||||||
import baritone.cache.WorldProvider;
|
import baritone.cache.WorldProvider;
|
||||||
import baritone.event.GameEventHandler;
|
import baritone.event.GameEventHandler;
|
||||||
|
import baritone.utils.BaritoneAutoTest;
|
||||||
import baritone.utils.InputOverrideHandler;
|
import baritone.utils.InputOverrideHandler;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
||||||
@ -108,6 +109,9 @@ public enum Baritone {
|
|||||||
PathingBehavior.INSTANCE
|
PathingBehavior.INSTANCE
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (BaritoneAutoTest.ENABLE_AUTO_TEST && "true".equals(System.getenv("BARITONE_AUTO_TEST"))) {
|
||||||
|
registerEventListener(new BaritoneAutoTest());
|
||||||
|
}
|
||||||
this.dir = new File(Minecraft.getMinecraft().gameDir, "baritone");
|
this.dir = new File(Minecraft.getMinecraft().gameDir, "baritone");
|
||||||
if (!Files.exists(dir.toPath())) {
|
if (!Files.exists(dir.toPath())) {
|
||||||
try {
|
try {
|
||||||
|
70
src/main/java/baritone/utils/BaritoneAutoTest.java
Normal file
70
src/main/java/baritone/utils/BaritoneAutoTest.java
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of Baritone.
|
||||||
|
*
|
||||||
|
* Baritone is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Baritone is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package baritone.utils;
|
||||||
|
|
||||||
|
import baritone.api.event.events.TickEvent;
|
||||||
|
import baritone.api.event.listener.AbstractGameEventListener;
|
||||||
|
import baritone.api.pathing.goals.Goal;
|
||||||
|
import baritone.api.pathing.goals.GoalXZ;
|
||||||
|
import baritone.behavior.PathingBehavior;
|
||||||
|
import net.minecraft.client.gui.GuiMainMenu;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.GameType;
|
||||||
|
import net.minecraft.world.WorldSettings;
|
||||||
|
import net.minecraft.world.WorldType;
|
||||||
|
|
||||||
|
public class BaritoneAutoTest implements AbstractGameEventListener, Helper {
|
||||||
|
public static final boolean ENABLE_AUTO_TEST = true;
|
||||||
|
private static final long TEST_SEED = -928872506371745L;
|
||||||
|
private static final BlockPos STARTING_POSITION = new BlockPos(0, 65, 0);
|
||||||
|
private static final Goal GOAL = new GoalXZ(100, 0);
|
||||||
|
private static final int MAX_TICKS = 800;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTick(TickEvent event) {
|
||||||
|
if (mc.currentScreen != null && mc.currentScreen instanceof GuiMainMenu) {
|
||||||
|
System.out.println("Beginning Baritone automatic test routine");
|
||||||
|
mc.displayGuiScreen(null);
|
||||||
|
WorldSettings worldsettings = new WorldSettings(TEST_SEED, GameType.getByName("survival"), true, false, WorldType.DEFAULT);
|
||||||
|
worldsettings.setGeneratorOptions("");
|
||||||
|
mc.launchIntegratedServer("BaritoneAutoTest", "BaritoneAutoTest", worldsettings);
|
||||||
|
}
|
||||||
|
if (mc.getIntegratedServer() != null && mc.getIntegratedServer().worlds[0] != null) {
|
||||||
|
mc.getIntegratedServer().worlds[0].setSpawnPoint(STARTING_POSITION);
|
||||||
|
}
|
||||||
|
if (event.getType() == TickEvent.Type.IN) {
|
||||||
|
if (mc.isSingleplayer() && !mc.getIntegratedServer().getPublic()) {
|
||||||
|
mc.getIntegratedServer().shareToLAN(GameType.getByName("survival"), false);
|
||||||
|
}
|
||||||
|
if (event.getCount() < 100) {
|
||||||
|
System.out.println("Waiting for world to generate... " + event.getCount());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
System.out.println(playerFeet() + " " + event.getCount());
|
||||||
|
PathingBehavior.INSTANCE.setGoal(GOAL);
|
||||||
|
PathingBehavior.INSTANCE.path();
|
||||||
|
if (GOAL.isInGoal(playerFeet())) {
|
||||||
|
System.out.println("Successfully pathed to " + playerFeet() + " in " + event.getCount() + " ticks");
|
||||||
|
mc.shutdown();
|
||||||
|
}
|
||||||
|
if (event.getCount() > MAX_TICKS) {
|
||||||
|
throw new IllegalStateException("took too long");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user