diff --git a/build.gradle b/build.gradle
index c6be17517..5e3a26f7a 100755
--- a/build.gradle
+++ b/build.gradle
@@ -16,7 +16,7 @@
*/
group 'baritone'
-version '1.2.3'
+version '1.3.0'
buildscript {
repositories {
@@ -32,7 +32,8 @@ buildscript {
}
dependencies {
- classpath group: 'com.github.ImpactDevelopment', name: 'ForgeGradle', version: '3.0.111'
+ classpath group: 'com.github.ImpactDevelopment', name: 'ForgeGradle', version: '3.0.115'
+ classpath group: 'com.github.ImpactDevelopment', name: 'MixinGradle', version: '0.6.1'
}
}
@@ -40,9 +41,8 @@ import baritone.gradle.task.CreateDistTask
import baritone.gradle.task.ProguardTask
apply plugin: 'java'
-//apply plugin: 'net.minecraftforge.gradle.tweaker-client'
-//apply plugin: 'org.spongepowered.mixin'
apply plugin: 'net.minecraftforge.gradle'
+apply plugin: 'org.spongepowered.mixin'
sourceCompatibility = targetCompatibility = '1.8'
compileJava {
@@ -58,24 +58,17 @@ sourceSets {
compileClasspath += api.output
}
test {
- compileClasspath += api.output
+ compileClasspath += main.compileClasspath + main.runtimeClasspath + main.output
}
launch {
compileClasspath += main.compileClasspath + main.runtimeClasspath + main.output
}
}
-/*
-minecraft {
- version = '1.12.2'
- mappings = 'stable_39'
- tweakClass = 'baritone.launch.BaritoneTweaker'
- runDir = 'run'
-
- // The sources jar should use SRG names not MCP to ensure compatibility with all mappings
- makeObfSourceJar = true
+task sourceJar(type: Jar, dependsOn: classes) {
+ classifier = 'sources'
+ from sourceSets.api.allSource
}
-*/
minecraft {
mappings channel: 'snapshot', version: '20190307-1.13.1'
@@ -85,6 +78,28 @@ minecraft {
client {
workingDirectory project.file('run')
source sourceSets.main
+
+ main 'baritone.launch.LaunchTesting'
+
+ environment 'assetIndex', '{asset_index}'
+ environment 'assetDirectory', downloadAssets.output
+ environment 'nativesDirectory', extractNatives.output
+
+ environment 'tweakClass', 'baritone.launch.BaritoneTweaker'
+ }
+
+ autoTest {
+ workingDirectory project.file('autotest')
+ source sourceSets.main
+
+ main 'baritone.launch.LaunchTesting'
+
+ environment 'assetIndex', '{asset_index}'
+ environment 'assetDirectory', downloadAssets.output
+ environment 'nativesDirectory', extractNatives.output
+
+ environment 'tweakClass', 'baritone.launch.BaritoneTweaker'
+ environment 'BARITONE_AUTO_TEST', 'true'
}
}
}
@@ -106,7 +121,10 @@ repositories {
dependencies {
minecraft 'com.github.ImpactDevelopment:Vanilla:1.13.2'
- runtime launchCompile('net.minecraft:launchwrapper:1.12')
+ runtime launchCompile('net.minecraft:launchwrapper:1.12') {
+ exclude module: 'lwjgl'
+ }
+ runtime launchCompile('org.ow2.asm:asm-debug-all:5.2')
runtime launchCompile('com.github.ImpactDevelopment:SimpleTweaker:1.2')
runtime launchCompile('org.spongepowered:mixin:0.7.11-SNAPSHOT') {
// Mixin includes a lot of dependencies that are too up-to-date
@@ -120,12 +138,10 @@ dependencies {
testImplementation 'junit:junit:4.12'
}
-/*
mixin {
defaultObfuscationEnv searge
add sourceSets.launch, 'mixins.baritone.refmap.json'
}
-*/
javadoc {
options.addStringOption('Xwerror', '-quiet') // makes the build fail on travis when there is a javadoc error
diff --git a/src/launch/java/baritone/launch/BaritoneTweaker.java b/src/launch/java/baritone/launch/BaritoneTweaker.java
index 8201d60fd..b9db9b6a5 100644
--- a/src/launch/java/baritone/launch/BaritoneTweaker.java
+++ b/src/launch/java/baritone/launch/BaritoneTweaker.java
@@ -31,7 +31,6 @@ import java.util.List;
* @author Brady
* @since 7/31/2018
*/
-@Deprecated
public class BaritoneTweaker extends SimpleTweaker {
@Override
diff --git a/src/launch/java/baritone/launch/LaunchTesting.java b/src/launch/java/baritone/launch/LaunchTesting.java
new file mode 100644
index 000000000..0bc95b7a8
--- /dev/null
+++ b/src/launch/java/baritone/launch/LaunchTesting.java
@@ -0,0 +1,77 @@
+/*
+ * 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 .
+ */
+
+package baritone.launch;
+
+import com.google.common.base.Strings;
+import net.minecraft.launchwrapper.Launch;
+
+import java.io.File;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Based on GradleStart from ForgeGradle 2.3
+ *
+ * @author Brady
+ * @since 3/11/2019
+ */
+public class LaunchTesting {
+
+ public static void main(String[] args) {
+ Map arguments = new HashMap<>();
+
+ hackNatives();
+ arguments.put("version", "BaritownedDeveloperEnvironment");
+ arguments.put("assetIndex", System.getenv("assetIndex"));
+ arguments.put("assetsDir", System.getenv().getOrDefault("assetDirectory", "assets"));
+ arguments.put("accessToken", "FML");
+ arguments.put("userProperties", "{}");
+ arguments.put("tweakClass", System.getenv("tweakClass"));
+
+ List argsArray = new ArrayList<>();
+ arguments.forEach((k, v) -> {
+ argsArray.add("--" + k);
+ argsArray.add(v);
+ });
+
+ Launch.main(argsArray.toArray(new String[0]));
+ }
+
+ private static void hackNatives() {
+ String paths = System.getProperty("java.library.path");
+ String nativesDir = System.getenv().get("nativesDirectory");
+
+ if (Strings.isNullOrEmpty(paths))
+ paths = nativesDir;
+ else
+ paths += File.pathSeparator + nativesDir;
+
+ System.setProperty("java.library.path", paths);
+
+ // hack the classloader now.
+ try
+ {
+ final Field sysPathsField = ClassLoader.class.getDeclaredField("sys_paths");
+ sysPathsField.setAccessible(true);
+ sysPathsField.set(null, null);
+ } catch(Throwable ignored) {}
+ }
+}
diff --git a/src/main/java/baritone/cache/WorldProvider.java b/src/main/java/baritone/cache/WorldProvider.java
index 3e8c03a82..329e35a8d 100644
--- a/src/main/java/baritone/cache/WorldProvider.java
+++ b/src/main/java/baritone/cache/WorldProvider.java
@@ -93,7 +93,7 @@ public class WorldProvider implements IWorldProvider, Helper {
} catch (IOException ignored) {}
// We will actually store the world data in a subfolder: "DIM"
- Path dir = new File(directory, "DIM" + dimension).toPath();
+ Path dir = new File(directory, "DIM" + dimension.getId()).toPath();
if (!Files.exists(dir)) {
try {
Files.createDirectories(dir);
diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java
index c45d5ecda..c4b0bd9e1 100644
--- a/src/main/java/baritone/pathing/movement/MovementHelper.java
+++ b/src/main/java/baritone/pathing/movement/MovementHelper.java
@@ -502,7 +502,7 @@ public interface MovementHelper extends ActionCosts, Helper {
static boolean possiblyFlowing(IBlockState state) {
IFluidState fluidState = state.getFluidState();
return fluidState.getFluid() instanceof FlowingFluid
- && state.get(FlowingFluid.LEVEL_1_8) != 0;
+ && fluidState.getFluid().getLevel(fluidState) != 8;
}
static boolean isFlowing(int x, int y, int z, IBlockState state, BlockStateInterface bsi) {
@@ -510,7 +510,7 @@ public interface MovementHelper extends ActionCosts, Helper {
if (!(fluidState.getFluid() instanceof FlowingFluid)) {
return false;
}
- if (fluidState.get(FlowingFluid.LEVEL_1_8) != 0) {
+ if (fluidState.getFluid().getLevel(fluidState) != 8) {
return true;
}
return possiblyFlowing(bsi.get0(x + 1, y, z))
diff --git a/src/main/java/baritone/utils/PathRenderer.java b/src/main/java/baritone/utils/PathRenderer.java
index be3237a8e..473543418 100644
--- a/src/main/java/baritone/utils/PathRenderer.java
+++ b/src/main/java/baritone/utils/PathRenderer.java
@@ -23,6 +23,7 @@ import baritone.api.event.events.RenderEvent;
import baritone.api.pathing.calc.IPath;
import baritone.api.pathing.goals.*;
import baritone.api.utils.BetterBlockPos;
+import baritone.api.utils.IPlayerContext;
import baritone.api.utils.interfaces.IGoalRenderPos;
import baritone.behavior.PathingBehavior;
import baritone.pathing.path.PathExecutor;
@@ -38,6 +39,8 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
+import net.minecraft.util.math.shapes.VoxelShape;
+import net.minecraft.util.math.shapes.VoxelShapes;
import java.awt.*;
import java.util.Collection;
@@ -218,12 +221,10 @@ public final class PathRenderer implements Helper {
BlockStateInterface bsi = new BlockStateInterface(BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext()); // TODO this assumes same dimension between primary baritone and render view? is this safe?
positions.forEach(pos -> {
IBlockState state = bsi.get0(pos);
- AxisAlignedBB toDraw;
- if (state.getBlock().equals(Blocks.AIR)) {
- toDraw = Blocks.DIRT.getDefaultState().getShape(player.world, pos).getBoundingBox();
- } else {
- toDraw = state.getShape(player.world, pos).getBoundingBox();
- }
+
+ VoxelShape shape = state.getShape(player.world, pos);
+ AxisAlignedBB toDraw = shape.isEmpty() ? VoxelShapes.fullCube().getBoundingBox() : shape.getBoundingBox();
+
toDraw = toDraw.expand(expand, expand, expand).offset(-mc.getRenderManager().viewerPosX, -mc.getRenderManager().viewerPosY, -mc.getRenderManager().viewerPosZ);
BUFFER.begin(GL_LINE_STRIP, DefaultVertexFormats.POSITION);
BUFFER.pos(toDraw.minX, toDraw.minY, toDraw.minZ).endVertex();