Merge branch 'master' into slabs-stairs

This commit is contained in:
Leijurv 2018-09-03 20:42:57 -07:00
commit c367297136
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
3 changed files with 438 additions and 14 deletions

360
proguard.pro vendored Normal file
View File

@ -0,0 +1,360 @@
-injars baritone-1.0.0.jar
-outjars Obfuscated
-libraryjars '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/rt.jar'
-libraryjars 'tempLibraries/1.12.2.jar'
-libraryjars 'tempLibraries/authlib-1.5.25.jar'
-libraryjars 'tempLibraries/codecjorbis-20101023.jar'
-libraryjars 'tempLibraries/codecwav-20101023.jar'
-libraryjars 'tempLibraries/commons-codec-1.10.jar'
-libraryjars 'tempLibraries/commons-compress-1.8.1.jar'
-libraryjars 'tempLibraries/commons-io-2.5.jar'
-libraryjars 'tempLibraries/commons-lang3-3.5.jar'
-libraryjars 'tempLibraries/commons-logging-1.1.3.jar'
-libraryjars 'tempLibraries/fastutil-7.1.0.jar'
-libraryjars 'tempLibraries/gson-2.8.0.jar'
-libraryjars 'tempLibraries/guava-21.0.jar'
-libraryjars 'tempLibraries/httpclient-4.3.3.jar'
-libraryjars 'tempLibraries/httpcore-4.3.2.jar'
-libraryjars 'tempLibraries/icu4j-core-mojang-51.2.jar'
-libraryjars 'tempLibraries/java-objc-bridge-1.0.0-natives-osx.jar'
-libraryjars 'tempLibraries/java-objc-bridge-1.0.0.jar'
-libraryjars 'tempLibraries/jinput-2.0.5.jar'
-libraryjars 'tempLibraries/jinput-platform-2.0.5-natives-osx.jar'
-libraryjars 'tempLibraries/jna-4.4.0.jar'
-libraryjars 'tempLibraries/jopt-simple-5.0.3.jar'
-libraryjars 'tempLibraries/jsr305-3.0.1-sources.jar'
-libraryjars 'tempLibraries/jsr305-3.0.1.jar'
-libraryjars 'tempLibraries/jutils-1.0.0.jar'
-libraryjars 'tempLibraries/libraryjavasound-20101123.jar'
-libraryjars 'tempLibraries/librarylwjglopenal-20100824.jar'
-libraryjars 'tempLibraries/log4j-api-2.8.1.jar'
-libraryjars 'tempLibraries/log4j-core-2.8.1.jar'
-libraryjars 'tempLibraries/lwjgl-2.9.2-nightly-20140822.jar'
-libraryjars 'tempLibraries/lwjgl-platform-2.9.2-nightly-20140822-natives-osx.jar'
-libraryjars 'tempLibraries/lwjgl_util-2.9.2-nightly-20140822.jar'
-libraryjars 'tempLibraries/netty-all-4.1.9.Final.jar'
-libraryjars 'tempLibraries/oshi-core-1.1.jar'
-libraryjars 'tempLibraries/patchy-1.1.jar'
-libraryjars 'tempLibraries/platform-3.4.0.jar'
-libraryjars 'tempLibraries/realms-1.10.22.jar'
-libraryjars 'tempLibraries/soundsystem-20120107.jar'
-libraryjars 'tempLibraries/text2speech-1.10.3.jar'
-libraryjars 'tempLibraries/mixin-0.7.8-SNAPSHOT.jar'
-libraryjars 'tempLibraries/launchwrapper-1.12.jar'
-keepattributes Signature
-keepattributes *Annotation*
-optimizationpasses 20
-verbose
-allowaccessmodification
-mergeinterfacesaggressively
-overloadaggressively
-flattenpackagehierarchy
-repackageclasses
-dontusemixedcaseclassnames
-overloadaggressively
-repackageclasses 'baritone'
-keep class baritone.behavior.** { *; }
-keep class baritone.api.** { *; }
-keep class baritone.* { *; }
-keep class baritone.pathing.goals.** { *; }
-keep class baritone.launch.** { *; }
# Keep - Applications. Keep all application classes, along with their 'main'
# methods.
-keepclasseswithmembers public class * {
public static void main(java.lang.String[]);
}
# Also keep - Enumerations. Keep the special static methods that are required in
# enumeration classes.
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
# Also keep - Database drivers. Keep all implementations of java.sql.Driver.
-keep class * extends java.sql.Driver
# Also keep - Swing UI L&F. Keep all extensions of javax.swing.plaf.ComponentUI,
# along with the special 'createUI' method.
-keep class * extends javax.swing.plaf.ComponentUI {
public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent);
}
# Keep names - Native method names. Keep all native class/method names.
-keepclasseswithmembers,includedescriptorclasses,allowshrinking class * {
native <methods>;
}
# Remove - System method calls. Remove all invocations of System
# methods without side effects whose return values are not used.
-assumenosideeffects public class java.lang.System {
public static long currentTimeMillis();
static java.lang.Class getCallerClass();
public static int identityHashCode(java.lang.Object);
public static java.lang.SecurityManager getSecurityManager();
public static java.util.Properties getProperties();
public static java.lang.String getProperty(java.lang.String);
public static java.lang.String getenv(java.lang.String);
public static java.lang.String mapLibraryName(java.lang.String);
public static java.lang.String getProperty(java.lang.String,java.lang.String);
}
# Remove - Math method calls. Remove all invocations of Math
# methods without side effects whose return values are not used.
-assumenosideeffects public class java.lang.Math {
public static double sin(double);
public static double cos(double);
public static double tan(double);
public static double asin(double);
public static double acos(double);
public static double atan(double);
public static double toRadians(double);
public static double toDegrees(double);
public static double exp(double);
public static double log(double);
public static double log10(double);
public static double sqrt(double);
public static double cbrt(double);
public static double IEEEremainder(double,double);
public static double ceil(double);
public static double floor(double);
public static double rint(double);
public static double atan2(double,double);
public static double pow(double,double);
public static int round(float);
public static long round(double);
public static double random();
public static int abs(int);
public static long abs(long);
public static float abs(float);
public static double abs(double);
public static int max(int,int);
public static long max(long,long);
public static float max(float,float);
public static double max(double,double);
public static int min(int,int);
public static long min(long,long);
public static float min(float,float);
public static double min(double,double);
public static double ulp(double);
public static float ulp(float);
public static double signum(double);
public static float signum(float);
public static double sinh(double);
public static double cosh(double);
public static double tanh(double);
public static double hypot(double,double);
public static double expm1(double);
public static double log1p(double);
}
# Remove - Number method calls. Remove all invocations of Number
# methods without side effects whose return values are not used.
-assumenosideeffects public class java.lang.* extends java.lang.Number {
public static java.lang.String toString(byte);
public static java.lang.Byte valueOf(byte);
public static byte parseByte(java.lang.String);
public static byte parseByte(java.lang.String,int);
public static java.lang.Byte valueOf(java.lang.String,int);
public static java.lang.Byte valueOf(java.lang.String);
public static java.lang.Byte decode(java.lang.String);
public int compareTo(java.lang.Byte);
public static java.lang.String toString(short);
public static short parseShort(java.lang.String);
public static short parseShort(java.lang.String,int);
public static java.lang.Short valueOf(java.lang.String,int);
public static java.lang.Short valueOf(java.lang.String);
public static java.lang.Short valueOf(short);
public static java.lang.Short decode(java.lang.String);
public static short reverseBytes(short);
public int compareTo(java.lang.Short);
public static java.lang.String toString(int,int);
public static java.lang.String toHexString(int);
public static java.lang.String toOctalString(int);
public static java.lang.String toBinaryString(int);
public static java.lang.String toString(int);
public static int parseInt(java.lang.String,int);
public static int parseInt(java.lang.String);
public static java.lang.Integer valueOf(java.lang.String,int);
public static java.lang.Integer valueOf(java.lang.String);
public static java.lang.Integer valueOf(int);
public static java.lang.Integer getInteger(java.lang.String);
public static java.lang.Integer getInteger(java.lang.String,int);
public static java.lang.Integer getInteger(java.lang.String,java.lang.Integer);
public static java.lang.Integer decode(java.lang.String);
public static int highestOneBit(int);
public static int lowestOneBit(int);
public static int numberOfLeadingZeros(int);
public static int numberOfTrailingZeros(int);
public static int bitCount(int);
public static int rotateLeft(int,int);
public static int rotateRight(int,int);
public static int reverse(int);
public static int signum(int);
public static int reverseBytes(int);
public int compareTo(java.lang.Integer);
public static java.lang.String toString(long,int);
public static java.lang.String toHexString(long);
public static java.lang.String toOctalString(long);
public static java.lang.String toBinaryString(long);
public static java.lang.String toString(long);
public static long parseLong(java.lang.String,int);
public static long parseLong(java.lang.String);
public static java.lang.Long valueOf(java.lang.String,int);
public static java.lang.Long valueOf(java.lang.String);
public static java.lang.Long valueOf(long);
public static java.lang.Long decode(java.lang.String);
public static java.lang.Long getLong(java.lang.String);
public static java.lang.Long getLong(java.lang.String,long);
public static java.lang.Long getLong(java.lang.String,java.lang.Long);
public static long highestOneBit(long);
public static long lowestOneBit(long);
public static int numberOfLeadingZeros(long);
public static int numberOfTrailingZeros(long);
public static int bitCount(long);
public static long rotateLeft(long,int);
public static long rotateRight(long,int);
public static long reverse(long);
public static int signum(long);
public static long reverseBytes(long);
public int compareTo(java.lang.Long);
public static java.lang.String toString(float);
public static java.lang.String toHexString(float);
public static java.lang.Float valueOf(java.lang.String);
public static java.lang.Float valueOf(float);
public static float parseFloat(java.lang.String);
public static boolean isNaN(float);
public static boolean isInfinite(float);
public static int floatToIntBits(float);
public static int floatToRawIntBits(float);
public static float intBitsToFloat(int);
public static int compare(float,float);
public boolean isNaN();
public boolean isInfinite();
public int compareTo(java.lang.Float);
public static java.lang.String toString(double);
public static java.lang.String toHexString(double);
public static java.lang.Double valueOf(java.lang.String);
public static java.lang.Double valueOf(double);
public static double parseDouble(java.lang.String);
public static boolean isNaN(double);
public static boolean isInfinite(double);
public static long doubleToLongBits(double);
public static long doubleToRawLongBits(double);
public static double longBitsToDouble(long);
public static int compare(double,double);
public boolean isNaN();
public boolean isInfinite();
public int compareTo(java.lang.Double);
public byte byteValue();
public short shortValue();
public int intValue();
public long longValue();
public float floatValue();
public double doubleValue();
public int compareTo(java.lang.Object);
public boolean equals(java.lang.Object);
public int hashCode();
public java.lang.String toString();
}
# Remove - String method calls. Remove all invocations of String
# methods without side effects whose return values are not used.
-assumenosideeffects public class java.lang.String {
public static java.lang.String copyValueOf(char[]);
public static java.lang.String copyValueOf(char[],int,int);
public static java.lang.String valueOf(boolean);
public static java.lang.String valueOf(char);
public static java.lang.String valueOf(char[]);
public static java.lang.String valueOf(char[],int,int);
public static java.lang.String valueOf(double);
public static java.lang.String valueOf(float);
public static java.lang.String valueOf(int);
public static java.lang.String valueOf(java.lang.Object);
public static java.lang.String valueOf(long);
public boolean contentEquals(java.lang.StringBuffer);
public boolean endsWith(java.lang.String);
public boolean equalsIgnoreCase(java.lang.String);
public boolean equals(java.lang.Object);
public boolean matches(java.lang.String);
public boolean regionMatches(boolean,int,java.lang.String,int,int);
public boolean regionMatches(int,java.lang.String,int,int);
public boolean startsWith(java.lang.String);
public boolean startsWith(java.lang.String,int);
public byte[] getBytes();
public byte[] getBytes(java.lang.String);
public char charAt(int);
public char[] toCharArray();
public int compareToIgnoreCase(java.lang.String);
public int compareTo(java.lang.Object);
public int compareTo(java.lang.String);
public int hashCode();
public int indexOf(int);
public int indexOf(int,int);
public int indexOf(java.lang.String);
public int indexOf(java.lang.String,int);
public int lastIndexOf(int);
public int lastIndexOf(int,int);
public int lastIndexOf(java.lang.String);
public int lastIndexOf(java.lang.String,int);
public int length();
public java.lang.CharSequence subSequence(int,int);
public java.lang.String concat(java.lang.String);
public java.lang.String replaceAll(java.lang.String,java.lang.String);
public java.lang.String replace(char,char);
public java.lang.String replaceFirst(java.lang.String,java.lang.String);
public java.lang.String[] split(java.lang.String);
public java.lang.String[] split(java.lang.String,int);
public java.lang.String substring(int);
public java.lang.String substring(int,int);
public java.lang.String toLowerCase();
public java.lang.String toLowerCase(java.util.Locale);
public java.lang.String toString();
public java.lang.String toUpperCase();
public java.lang.String toUpperCase(java.util.Locale);
public java.lang.String trim();
}
# Remove - StringBuffer method calls. Remove all invocations of StringBuffer
# methods without side effects whose return values are not used.
-assumenosideeffects public class java.lang.StringBuffer {
public java.lang.String toString();
public char charAt(int);
public int capacity();
public int codePointAt(int);
public int codePointBefore(int);
public int indexOf(java.lang.String,int);
public int lastIndexOf(java.lang.String);
public int lastIndexOf(java.lang.String,int);
public int length();
public java.lang.String substring(int);
public java.lang.String substring(int,int);
}
# Remove - StringBuilder method calls. Remove all invocations of StringBuilder
# methods without side effects whose return values are not used.
-assumenosideeffects public class java.lang.StringBuilder {
public java.lang.String toString();
public char charAt(int);
public int capacity();
public int codePointAt(int);
public int codePointBefore(int);
public int indexOf(java.lang.String,int);
public int lastIndexOf(java.lang.String);
public int lastIndexOf(java.lang.String,int);
public int length();
public java.lang.String substring(int);
public java.lang.String substring(int,int);
}

View File

@ -17,32 +17,47 @@
package baritone.pathing.goals;
import net.minecraft.util.EnumFacing;
import baritone.utils.pathing.BetterBlockPos;
import net.minecraft.util.math.BlockPos;
/**
* Don't get into the block, but get directly adjacent to it. Useful for chests.
*
* @author avecowa
*/
public class GoalGetToBlock extends GoalComposite {
public class GoalGetToBlock implements Goal {
private final BlockPos pos;
private final int x;
private final int y;
private final int z;
public GoalGetToBlock(BlockPos pos) {
super(adjacentBlocks(pos));
this.pos = pos;
}
private static BlockPos[] adjacentBlocks(BlockPos pos) {
BlockPos[] sides = new BlockPos[6];
for (int i = 0; i < 6; i++) {
sides[i] = pos.offset(EnumFacing.values()[i]);
}
return sides;
this.x = pos.getX();
this.y = pos.getY();
this.z = pos.getZ();
}
public BlockPos getGoalPos() {
return pos;
return new BetterBlockPos(x, y, z);
}
@Override
public boolean isInGoal(BlockPos pos) {
int xDiff = pos.getX() - this.x;
int yDiff = pos.getY() - this.y;
int zDiff = pos.getZ() - this.z;
if (yDiff == -2 && xDiff == 0 && zDiff == 0) {
return true;
}
return Math.abs(xDiff) + Math.abs(yDiff) + Math.abs(zDiff) <= 1;
}
@Override
public double heuristic(BlockPos pos) {
int xDiff = pos.getX() - this.x;
int yDiff = pos.getY() - this.y;
int zDiff = pos.getZ() - this.z;
return GoalBlock.calculate(xDiff, yDiff, zDiff);
}
}

View File

@ -0,0 +1,49 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.pathing.goals;
import net.minecraft.util.math.BlockPos;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static org.junit.Assert.assertTrue;
public class GoalGetToBlockTest {
@Test
public void isInGoal() {
List<String> acceptableOffsets = new ArrayList<>(Arrays.asList("0,0,0", "0,0,1", "0,0,-1", "1,0,0", "-1,0,0", "0,1,0", "0,-1,0", "0,-2,0"));
for (int x = -10; x <= 10; x++) {
for (int y = -10; y <= 10; y++) {
for (int z = -10; z <= 10; z++) {
boolean inGoal = new GoalGetToBlock(new BlockPos(0, 0, 0)).isInGoal(new BlockPos(x, y, z));
String repr = x + "," + y + "," + z;
System.out.println(repr + " " + inGoal);
if (inGoal) {
assertTrue(repr, acceptableOffsets.contains(repr));
acceptableOffsets.remove(repr);
}
}
}
}
assertTrue(acceptableOffsets.toString(), acceptableOffsets.isEmpty());
}
}