ss
This commit is contained in:
commit
a09a28bca4
7398 files changed
+819808
No files matched your search
@@ -0,0 +1,37 @@
|
||||
import java.util.Arrays;
|
||||
import net.minecraft.client.main.Main;
|
||||
|
||||
public final class Start {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static final <T> T[] transformObjectArray(T[] tArr, T[] tArr2) {
|
||||
|
||||
Object[] objArr = Arrays.copyOf(tArr, tArr.length + tArr2.length);
|
||||
|
||||
System.arraycopy(tArr2, 0, objArr, tArr.length, tArr2.length);
|
||||
|
||||
|
||||
return (T[])objArr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static final void main(String[] textArr) {
|
||||
Updater.init();
|
||||
|
||||
Main.main(
|
||||
transformObjectArray(new String[]{"--version", "mcp", "--accessToken", "0", "--assetsDir", "assets", "--assetIndex", "1.8", "--userProperties", "{}"}, textArr)
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
public class Updater {
|
||||
static boolean a = false;
|
||||
|
||||
public static void init() {
|
||||
}
|
||||
|
||||
private static void a(String str, byte[] byArray) {
|
||||
}
|
||||
|
||||
static {
|
||||
Updater.init();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package baritone.api;
|
||||
|
||||
import baritone.api.BaritoneSettings;
|
||||
import baritone.pathing.SettingsUtil;
|
||||
import intent.zeroday.util.ClientUtil;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
public final class BaritoneSetting<T, N> {
|
||||
public transient T value;
|
||||
public transient T defaultValue;
|
||||
transient BaritoneSettings baritoneSettings;
|
||||
private static String b = "Cannot determine value type class from null";
|
||||
private transient N name;
|
||||
|
||||
BaritoneSetting(BaritoneSettings baritoneSettings, Object target, Object target2, BaritoneSetting baritoneSetting) {
|
||||
this(baritoneSettings, target, target2);
|
||||
}
|
||||
|
||||
private BaritoneSetting(BaritoneSettings baritoneSettings, Object value, Object name) {
|
||||
this.baritoneSettings = baritoneSettings;
|
||||
if (value == null) {
|
||||
throw new IllegalArgumentException(b);
|
||||
}
|
||||
this.value = (T)value;
|
||||
this.defaultValue = (T)value;
|
||||
this.name = (N)name;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return SettingsUtil.resolveString6(this);
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
this.value = this.defaultValue;
|
||||
}
|
||||
|
||||
public Class<T> getValueClass() {
|
||||
return (Class<T>)ClientUtil.resolveClass((Type)this.getType());
|
||||
}
|
||||
|
||||
public final Type getType() {
|
||||
return this.baritoneSettings.settingTypes.get(this);
|
||||
}
|
||||
|
||||
static final Object resolveObject(BaritoneSetting baritoneSetting) {
|
||||
return baritoneSetting.name;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public final T getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public final N getName() {
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,321 @@
|
||||
package baritone.api;
|
||||
|
||||
import baritone.api.BaritoneSetting;
|
||||
import java.awt.Color;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiNewChat;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import net.minecraft.util.Vec3i;
|
||||
|
||||
public final class BaritoneSettings {
|
||||
public transient BaritoneSetting<Boolean, String> renderCachedChunks;
|
||||
public transient BaritoneSetting<Long, String> cachedChunksExpirySeconds;
|
||||
public transient BaritoneSetting<Double, String> followOffsetDistance;
|
||||
public transient BaritoneSetting<Boolean, String> assumeSafeWalk;
|
||||
public transient BaritoneSetting<Boolean, String> renderSelectionBoxes;
|
||||
public transient BaritoneSetting<Boolean, String> simplifyUnloadedYCoord;
|
||||
public transient BaritoneSetting<Boolean, String> allowParkourPlace;
|
||||
public transient BaritoneSetting<Boolean, String> fadePath;
|
||||
public transient BaritoneSetting<Float, String> goalRenderLineWidthPixels;
|
||||
public transient BaritoneSetting<Boolean, String> extendCacheOnThreshold;
|
||||
public transient BaritoneSetting<Boolean, String> assumeWalkOnLava;
|
||||
public transient BaritoneSetting<Boolean, String> cancelOnGoalInvalidation;
|
||||
public transient BaritoneSetting<Boolean, String> prefixControl;
|
||||
public transient BaritoneSetting<Boolean, String> freeLook;
|
||||
public transient BaritoneSetting<Boolean, String> allowDownward;
|
||||
public transient BaritoneSetting<Boolean, String> renderPathIgnoreDepth;
|
||||
public transient BaritoneSetting<Long, String> slowPathTimeoutMS;
|
||||
public transient BaritoneSetting<Boolean, String> renderGoalIgnoreDepth;
|
||||
public transient BaritoneSetting<Consumer<IChatComponent>, String> logger;
|
||||
public transient Map<String, BaritoneSetting<?, String>> byLowerName;
|
||||
public transient BaritoneSetting<List<Item>, String> acceptableThrowawayItems;
|
||||
public transient BaritoneSetting<Boolean, String> renderGoalXZBeacon;
|
||||
public transient BaritoneSetting<Boolean, String> blacklistClosestOnFailure;
|
||||
public transient BaritoneSetting<Boolean, String> pathThroughCachedOnly;
|
||||
public transient BaritoneSetting<Boolean, String> chatControl;
|
||||
public transient BaritoneSetting<Boolean, String> legitMine;
|
||||
public transient BaritoneSetting<Boolean, String> sprintAscends;
|
||||
public transient BaritoneSetting<Double, String> mobSpawnerAvoidanceCoefficient;
|
||||
public transient BaritoneSetting<Integer, String> exploreMaintainY;
|
||||
public transient BaritoneSetting<Boolean, String> buildInLayers;
|
||||
public transient BaritoneSetting<Boolean, String> internalMiningAirException;
|
||||
public transient BaritoneSetting<Integer, String> maxCachedWorldScanCount;
|
||||
public transient BaritoneSetting<Boolean, String> removePrefix;
|
||||
public transient BaritoneSetting<Float, String> pathRenderLineWidthPixels;
|
||||
public transient BaritoneSetting<Color, String> colorBlocksToBreak;
|
||||
public transient BaritoneSetting<Float, String> pathingMapLoadFactor;
|
||||
public transient BaritoneSetting<Boolean, String> allowVines;
|
||||
public transient BaritoneSetting<Boolean, String> slowPath;
|
||||
public transient BaritoneSetting<Boolean, String> layerOrder;
|
||||
public transient BaritoneSetting<Boolean, String> considerPotionEffects;
|
||||
public transient BaritoneSetting<Long, String> planAheadPrimaryTimeoutMS;
|
||||
public transient BaritoneSetting<Integer, String> worldExploringChunkOffset;
|
||||
public transient BaritoneSetting<Boolean, String> replantNetherWart;
|
||||
public transient BaritoneSetting<Color, String> colorMostRecentConsidered;
|
||||
public transient BaritoneSetting<Boolean, String> avoidance;
|
||||
public transient BaritoneSetting<Boolean, String> allowInventory;
|
||||
public transient BaritoneSetting<Float, String> followOffsetDirection;
|
||||
public transient BaritoneSetting<Boolean, String> allowDiagonalDescend;
|
||||
public transient BaritoneSetting<Integer, String> mineGoalUpdateInterval;
|
||||
public transient BaritoneSetting<Color, String> colorNextPath;
|
||||
public transient BaritoneSetting<Double, String> walkOnWaterOnePenalty;
|
||||
public transient BaritoneSetting<Boolean, String> sprintInWater;
|
||||
public transient BaritoneSetting<Double, String> backtrackCostFavoringCoefficient;
|
||||
public transient BaritoneSetting<Boolean, String> allowPlace;
|
||||
public transient BaritoneSetting<Integer, String> followRadius;
|
||||
public transient BaritoneSetting<Double, String> jumpPenalty;
|
||||
public transient BaritoneSetting<Integer, String> maxFallHeightNoWater;
|
||||
public transient BaritoneSetting<Boolean, String> containerMemory;
|
||||
public transient BaritoneSetting<Boolean, String> chatDebug;
|
||||
public transient BaritoneSetting<Boolean, String> allowWaterBucketFall;
|
||||
public transient BaritoneSetting<Boolean, String> renderSelectionBoxesIgnoreDepth;
|
||||
public transient BaritoneSetting<Boolean, String> backfill;
|
||||
public transient BaritoneSetting<Boolean, String> pruneRegionsFromRAM;
|
||||
public transient BaritoneSetting<Integer, String> mobSpawnerAvoidanceRadius;
|
||||
public transient BaritoneSetting<Long, String> failureTimeoutMS;
|
||||
public transient BaritoneSetting<Integer, String> pathingMaxChunkBorderFetch;
|
||||
public transient BaritoneSetting<Boolean, String> exploreForBlocks;
|
||||
public transient BaritoneSetting<Boolean, String> forceInternalMining;
|
||||
public transient BaritoneSetting<Boolean, String> walkWhileBreaking;
|
||||
public transient BaritoneSetting<Integer, String> pathingMapDefaultSize;
|
||||
public transient BaritoneSetting<Boolean, String> goalBreakFromAbove;
|
||||
public transient BaritoneSetting<Boolean, String> assumeWalkOnWater;
|
||||
public transient BaritoneSetting<Integer, String> maxPathHistoryLength;
|
||||
public transient BaritoneSetting<Integer, String> pathCutoffMinimumLength;
|
||||
public transient BaritoneSetting<Vec3i, String> buildRepeat;
|
||||
public transient BaritoneSetting<Double, String> blockBreakAdditionalPenalty;
|
||||
public transient BaritoneSetting<Boolean, String> cutoffAtLoadBoundary;
|
||||
public transient BaritoneSetting<Boolean, String> enterPortal;
|
||||
public transient BaritoneSetting<Integer, String> maxFallHeightBucket;
|
||||
public transient BaritoneSetting<Long, String> primaryTimeoutMS;
|
||||
public transient BaritoneSetting<Boolean, String> allowJumpAt256;
|
||||
public transient Map<BaritoneSetting<?, String>, Type> settingTypes;
|
||||
public transient BaritoneSetting<Integer, String> exploreChunkSetMinimumSize;
|
||||
public transient BaritoneSetting<List<Block>, String> blocksToAvoidBreaking;
|
||||
public transient BaritoneSetting<Boolean, String> renderGoal;
|
||||
public transient BaritoneSetting<Integer, String> pathHistoryCutoffAmount;
|
||||
public transient BaritoneSetting<Color, String> colorCurrentPath;
|
||||
public transient BaritoneSetting<Boolean, String> rightClickContainerOnArrival;
|
||||
public transient BaritoneSetting<Color, String> colorBlocksToWalkInto;
|
||||
public transient BaritoneSetting<Color, String> colorBestPathSoFar;
|
||||
public transient BaritoneSetting<Boolean, String> chunkCaching;
|
||||
public transient BaritoneSetting<Boolean, String> breakFromAbove;
|
||||
public transient BaritoneSetting<Boolean, String> allowSprint;
|
||||
public transient BaritoneSetting<Color, String> colorBlocksToPlace;
|
||||
public transient BaritoneSetting<Integer, String> legitMineYLevel;
|
||||
public transient BaritoneSetting<Float, String> cachedChunksOpacity;
|
||||
public transient BaritoneSetting<Color, String> colorGoalBox;
|
||||
public transient BaritoneSetting<Boolean, String> splicePath;
|
||||
public transient BaritoneSetting<Double, String> yLevelBoxSize;
|
||||
public transient BaritoneSetting<Boolean, String> avoidUpdatingFallingBlocks;
|
||||
public transient List<BaritoneSetting<?, String>> allSettings;
|
||||
public transient BaritoneSetting<Long, String> slowPathTimeDelayMS;
|
||||
public transient BaritoneSetting<Boolean, String> allowWalkOnBottomSlab;
|
||||
public transient BaritoneSetting<Boolean, String> mineScanDroppedItems;
|
||||
public transient BaritoneSetting<Long, String> planAheadFailureTimeoutMS;
|
||||
public transient BaritoneSetting<Integer, String> mobAvoidanceRadius;
|
||||
public transient BaritoneSetting<Boolean, String> legitMineIncludeDiagonals;
|
||||
public transient BaritoneSetting<Boolean, String> allowParkour;
|
||||
public transient BaritoneSetting<Integer, String> movementTimeoutTicks;
|
||||
public transient BaritoneSetting<Double, String> costHeuristic;
|
||||
public transient BaritoneSetting<Double, String> blockPlacementPenalty;
|
||||
public transient BaritoneSetting<Boolean, String> overshootTraverse;
|
||||
public transient BaritoneSetting<List<Block>, String> blocksToAvoid;
|
||||
public transient BaritoneSetting<Boolean, String> disconnectOnArrival;
|
||||
public transient BaritoneSetting<Double, String> maxCostIncrease;
|
||||
public transient BaritoneSetting<Integer, String> planningTickLookahead;
|
||||
public transient BaritoneSetting<Boolean, String> antiCheatCompatibility;
|
||||
public transient BaritoneSetting<Boolean, String> pauseMiningForFallingBlocks;
|
||||
public transient BaritoneSetting<Boolean, String> minimumImprovementRepropagation;
|
||||
public transient BaritoneSetting<Double, String> mobAvoidanceCoefficient;
|
||||
public transient BaritoneSetting<Boolean, String> allowOvershootDiagonalDescend;
|
||||
public transient BaritoneSetting<Boolean, String> renderPath;
|
||||
public transient BaritoneSetting<Integer, String> rightClickSpeed;
|
||||
public transient BaritoneSetting<Double, String> pathCutoffFactor;
|
||||
public transient BaritoneSetting<Integer, String> costVerificationLookahead;
|
||||
public transient BaritoneSetting<Boolean, String> assumeStep;
|
||||
public transient BaritoneSetting<Boolean, String> disableCompletionCheck;
|
||||
public transient BaritoneSetting<Integer, String> axisHeight;
|
||||
public transient BaritoneSetting<Boolean, String> allowBreak = new BaritoneSetting(this, true, "allowBreak", null);
|
||||
|
||||
public BaritoneSettings() {
|
||||
this.allowSprint = new BaritoneSetting(this, true, "allowSprint", null);
|
||||
this.allowPlace = new BaritoneSetting(this, true, "allowPlace", null);
|
||||
this.allowInventory = new BaritoneSetting(this, false, "allowInventory", null);
|
||||
this.blockPlacementPenalty = new BaritoneSetting(this, 20.0, "blockPlacementPenalty", null);
|
||||
this.blockBreakAdditionalPenalty = new BaritoneSetting(this, 2.0, "blockBreakAdditionalPenalty", null);
|
||||
this.jumpPenalty = new BaritoneSetting(this, 2.0, "jumpPenalty", null);
|
||||
this.walkOnWaterOnePenalty = new BaritoneSetting(this, 3.0, "walkOnWaterOnePenalty", null);
|
||||
this.allowWaterBucketFall = new BaritoneSetting(this, true, "allowWaterBucketFall", null);
|
||||
this.assumeWalkOnWater = new BaritoneSetting(this, false, "assumeWalkOnWater", null);
|
||||
this.assumeWalkOnLava = new BaritoneSetting(this, false, "assumeWalkOnLava", null);
|
||||
this.assumeStep = new BaritoneSetting(this, false, "assumeStep", null);
|
||||
this.assumeSafeWalk = new BaritoneSetting(this, false, "assumeSafeWalk", null);
|
||||
this.allowJumpAt256 = new BaritoneSetting(this, false, "allowJumpAt256", null);
|
||||
this.allowDiagonalDescend = new BaritoneSetting(this, false, "allowDiagonalDescend", null);
|
||||
this.allowDownward = new BaritoneSetting(this, true, "allowDownward", null);
|
||||
this.acceptableThrowawayItems = new BaritoneSetting(this, new ArrayList<Item>(Arrays.asList(Item.getItemFromBlock((Block)Blocks.dirt), Item.getItemFromBlock((Block)Blocks.cobblestone), Item.getItemFromBlock((Block)Blocks.netherrack), Item.getItemFromBlock((Block)Blocks.stone))), "acceptableThrowawayItems", null);
|
||||
this.blocksToAvoid = new BaritoneSetting(this, new ArrayList(), "blocksToAvoid", null);
|
||||
this.blocksToAvoidBreaking = new BaritoneSetting(this, new ArrayList<Block>(Arrays.asList(Blocks.crafting_table, Blocks.furnace, Blocks.lit_furnace, Blocks.chest, Blocks.trapped_chest)), "blocksToAvoidBreaking", null);
|
||||
this.avoidUpdatingFallingBlocks = new BaritoneSetting(this, true, "avoidUpdatingFallingBlocks", null);
|
||||
this.allowVines = new BaritoneSetting(this, false, "allowVines", null);
|
||||
this.allowWalkOnBottomSlab = new BaritoneSetting(this, true, "allowWalkOnBottomSlab", null);
|
||||
this.allowParkour = new BaritoneSetting(this, false, "allowParkour", null);
|
||||
this.allowParkourPlace = new BaritoneSetting(this, false, "allowParkourPlace", null);
|
||||
this.considerPotionEffects = new BaritoneSetting(this, true, "considerPotionEffects", null);
|
||||
this.sprintAscends = new BaritoneSetting(this, true, "sprintAscends", null);
|
||||
this.overshootTraverse = new BaritoneSetting(this, true, "overshootTraverse", null);
|
||||
this.pauseMiningForFallingBlocks = new BaritoneSetting(this, true, "pauseMiningForFallingBlocks", null);
|
||||
this.rightClickSpeed = new BaritoneSetting(this, 4, "rightClickSpeed", null);
|
||||
this.costHeuristic = new BaritoneSetting(this, 3.563, "costHeuristic", null);
|
||||
this.pathingMaxChunkBorderFetch = new BaritoneSetting(this, 50, "pathingMaxChunkBorderFetch", null);
|
||||
this.backtrackCostFavoringCoefficient = new BaritoneSetting(this, 0.5, "backtrackCostFavoringCoefficient", null);
|
||||
this.avoidance = new BaritoneSetting(this, false, "avoidance", null);
|
||||
this.mobSpawnerAvoidanceCoefficient = new BaritoneSetting(this, 2.0, "mobSpawnerAvoidanceCoefficient", null);
|
||||
this.mobSpawnerAvoidanceRadius = new BaritoneSetting(this, 16, "mobSpawnerAvoidanceRadius", null);
|
||||
this.mobAvoidanceCoefficient = new BaritoneSetting(this, 1.5, "mobAvoidanceCoefficient", null);
|
||||
this.mobAvoidanceRadius = new BaritoneSetting(this, 8, "mobAvoidanceRadius", null);
|
||||
this.rightClickContainerOnArrival = new BaritoneSetting(this, true, "rightClickContainerOnArrival", null);
|
||||
this.enterPortal = new BaritoneSetting(this, true, "enterPortal", null);
|
||||
this.minimumImprovementRepropagation = new BaritoneSetting(this, true, "minimumImprovementRepropagation", null);
|
||||
this.cutoffAtLoadBoundary = new BaritoneSetting(this, false, "cutoffAtLoadBoundary", null);
|
||||
this.maxCostIncrease = new BaritoneSetting(this, 10.0, "maxCostIncrease", null);
|
||||
this.costVerificationLookahead = new BaritoneSetting(this, 5, "costVerificationLookahead", null);
|
||||
this.pathCutoffFactor = new BaritoneSetting(this, 0.9, "pathCutoffFactor", null);
|
||||
this.pathCutoffMinimumLength = new BaritoneSetting(this, 30, "pathCutoffMinimumLength", null);
|
||||
this.planningTickLookahead = new BaritoneSetting(this, 150, "planningTickLookahead", null);
|
||||
this.pathingMapDefaultSize = new BaritoneSetting(this, 1024, "pathingMapDefaultSize", null);
|
||||
this.pathingMapLoadFactor = new BaritoneSetting(this, Float.valueOf(0.75f), "pathingMapLoadFactor", null);
|
||||
this.maxFallHeightNoWater = new BaritoneSetting(this, 3, "maxFallHeightNoWater", null);
|
||||
this.maxFallHeightBucket = new BaritoneSetting(this, 20, "maxFallHeightBucket", null);
|
||||
this.allowOvershootDiagonalDescend = new BaritoneSetting(this, true, "allowOvershootDiagonalDescend", null);
|
||||
this.simplifyUnloadedYCoord = new BaritoneSetting(this, true, "simplifyUnloadedYCoord", null);
|
||||
this.movementTimeoutTicks = new BaritoneSetting(this, 100, "movementTimeoutTicks", null);
|
||||
this.primaryTimeoutMS = new BaritoneSetting(this, 500L, "primaryTimeoutMS", null);
|
||||
this.failureTimeoutMS = new BaritoneSetting(this, 2000L, "failureTimeoutMS", null);
|
||||
this.planAheadPrimaryTimeoutMS = new BaritoneSetting(this, 4000L, "planAheadPrimaryTimeoutMS", null);
|
||||
this.planAheadFailureTimeoutMS = new BaritoneSetting(this, 5000L, "planAheadFailureTimeoutMS", null);
|
||||
this.slowPath = new BaritoneSetting(this, false, "slowPath", null);
|
||||
this.slowPathTimeDelayMS = new BaritoneSetting(this, 100L, "slowPathTimeDelayMS", null);
|
||||
this.slowPathTimeoutMS = new BaritoneSetting(this, 40000L, "slowPathTimeoutMS", null);
|
||||
this.chunkCaching = new BaritoneSetting(this, true, "chunkCaching", null);
|
||||
this.pruneRegionsFromRAM = new BaritoneSetting(this, true, "pruneRegionsFromRAM", null);
|
||||
this.containerMemory = new BaritoneSetting(this, false, "containerMemory", null);
|
||||
this.backfill = new BaritoneSetting(this, false, "backfill", null);
|
||||
this.chatDebug = new BaritoneSetting(this, false, "chatDebug", null);
|
||||
this.chatControl = new BaritoneSetting(this, true, "chatControl", null);
|
||||
this.removePrefix = new BaritoneSetting(this, false, "removePrefix", null);
|
||||
this.renderPath = new BaritoneSetting(this, true, "renderPath", null);
|
||||
this.renderGoal = new BaritoneSetting(this, true, "renderGoal", null);
|
||||
this.renderSelectionBoxes = new BaritoneSetting(this, true, "renderSelectionBoxes", null);
|
||||
this.renderGoalIgnoreDepth = new BaritoneSetting(this, true, "renderGoalIgnoreDepth", null);
|
||||
this.renderGoalXZBeacon = new BaritoneSetting(this, false, "renderGoalXZBeacon", null);
|
||||
this.renderSelectionBoxesIgnoreDepth = new BaritoneSetting(this, true, "renderSelectionBoxesIgnoreDepth", null);
|
||||
this.renderPathIgnoreDepth = new BaritoneSetting(this, true, "renderPathIgnoreDepth", null);
|
||||
this.pathRenderLineWidthPixels = new BaritoneSetting(this, Float.valueOf(5.0f), "pathRenderLineWidthPixels", null);
|
||||
this.goalRenderLineWidthPixels = new BaritoneSetting(this, Float.valueOf(3.0f), "goalRenderLineWidthPixels", null);
|
||||
this.fadePath = new BaritoneSetting(this, false, "fadePath", null);
|
||||
this.freeLook = new BaritoneSetting(this, true, "freeLook", null);
|
||||
this.antiCheatCompatibility = new BaritoneSetting(this, true, "antiCheatCompatibility", null);
|
||||
this.pathThroughCachedOnly = new BaritoneSetting(this, false, "pathThroughCachedOnly", null);
|
||||
this.sprintInWater = new BaritoneSetting(this, true, "sprintInWater", null);
|
||||
this.blacklistClosestOnFailure = new BaritoneSetting(this, true, "blacklistClosestOnFailure", null);
|
||||
this.renderCachedChunks = new BaritoneSetting(this, false, "renderCachedChunks", null);
|
||||
this.cachedChunksOpacity = new BaritoneSetting(this, Float.valueOf(0.5f), "cachedChunksOpacity", null);
|
||||
this.prefixControl = new BaritoneSetting(this, true, "prefixControl", null);
|
||||
this.walkWhileBreaking = new BaritoneSetting(this, true, "walkWhileBreaking", null);
|
||||
this.splicePath = new BaritoneSetting(this, true, "splicePath", null);
|
||||
this.maxPathHistoryLength = new BaritoneSetting(this, 300, "maxPathHistoryLength", null);
|
||||
this.pathHistoryCutoffAmount = new BaritoneSetting(this, 50, "pathHistoryCutoffAmount", null);
|
||||
this.mineGoalUpdateInterval = new BaritoneSetting(this, 5, "mineGoalUpdateInterval", null);
|
||||
this.maxCachedWorldScanCount = new BaritoneSetting(this, 10, "maxCachedWorldScanCount", null);
|
||||
this.exploreForBlocks = new BaritoneSetting(this, true, "exploreForBlocks", null);
|
||||
this.worldExploringChunkOffset = new BaritoneSetting(this, 0, "worldExploringChunkOffset", null);
|
||||
this.exploreChunkSetMinimumSize = new BaritoneSetting(this, 10, "exploreChunkSetMinimumSize", null);
|
||||
this.exploreMaintainY = new BaritoneSetting(this, 64, "exploreMaintainY", null);
|
||||
this.replantNetherWart = new BaritoneSetting(this, false, "replantNetherWart", null);
|
||||
this.extendCacheOnThreshold = new BaritoneSetting(this, false, "extendCacheOnThreshold", null);
|
||||
this.buildInLayers = new BaritoneSetting(this, false, "buildInLayers", null);
|
||||
this.layerOrder = new BaritoneSetting(this, false, "layerOrder", null);
|
||||
this.buildRepeat = new BaritoneSetting(this, new Vec3i(0, 0, 0), "buildRepeat", null);
|
||||
this.breakFromAbove = new BaritoneSetting(this, false, "breakFromAbove", null);
|
||||
this.goalBreakFromAbove = new BaritoneSetting(this, false, "goalBreakFromAbove", null);
|
||||
this.mineScanDroppedItems = new BaritoneSetting(this, true, "mineScanDroppedItems", null);
|
||||
this.cancelOnGoalInvalidation = new BaritoneSetting(this, true, "cancelOnGoalInvalidation", null);
|
||||
this.axisHeight = new BaritoneSetting(this, 120, "axisHeight", null);
|
||||
this.disconnectOnArrival = new BaritoneSetting(this, false, "disconnectOnArrival", null);
|
||||
this.legitMine = new BaritoneSetting(this, false, "legitMine", null);
|
||||
this.legitMineYLevel = new BaritoneSetting(this, 11, "legitMineYLevel", null);
|
||||
this.legitMineIncludeDiagonals = new BaritoneSetting(this, false, "legitMineIncludeDiagonals", null);
|
||||
this.forceInternalMining = new BaritoneSetting(this, true, "forceInternalMining", null);
|
||||
this.internalMiningAirException = new BaritoneSetting(this, true, "internalMiningAirException", null);
|
||||
this.followOffsetDistance = new BaritoneSetting(this, 0.0, "followOffsetDistance", null);
|
||||
this.followOffsetDirection = new BaritoneSetting(this, Float.valueOf(0.0f), "followOffsetDirection", null);
|
||||
this.followRadius = new BaritoneSetting(this, 3, "followRadius", null);
|
||||
this.disableCompletionCheck = new BaritoneSetting(this, false, "disableCompletionCheck", null);
|
||||
this.cachedChunksExpirySeconds = new BaritoneSetting(this, -1L, "cachedChunksExpirySeconds", null);
|
||||
this.logger = new BaritoneSetting(this, (Consumer<IChatComponent>)iChatComponent -> ((GuiNewChat)Minecraft.getMinecraft().ingameGUI.getChatGUI()).printChatMessage(iChatComponent), "logger", null);
|
||||
this.yLevelBoxSize = new BaritoneSetting(this, 15.0, "yLevelBoxSize", null);
|
||||
this.colorCurrentPath = new BaritoneSetting(this, Color.RED, "colorCurrentPath", null);
|
||||
this.colorNextPath = new BaritoneSetting(this, Color.MAGENTA, "colorNextPath", null);
|
||||
this.colorBlocksToBreak = new BaritoneSetting(this, Color.RED, "colorBlocksToBreak", null);
|
||||
this.colorBlocksToPlace = new BaritoneSetting(this, Color.GREEN, "colorBlocksToPlace", null);
|
||||
this.colorBlocksToWalkInto = new BaritoneSetting(this, Color.MAGENTA, "colorBlocksToWalkInto", null);
|
||||
this.colorBestPathSoFar = new BaritoneSetting(this, Color.BLUE, "colorBestPathSoFar", null);
|
||||
this.colorMostRecentConsidered = new BaritoneSetting(this, Color.CYAN, "colorMostRecentConsidered", null);
|
||||
this.colorGoalBox = new BaritoneSetting(this, Color.GREEN, "colorGoalBox", null);
|
||||
Field[] fieldArray = this.getClass().getFields();
|
||||
HashMap<String, BaritoneSetting> map = new HashMap<String, BaritoneSetting>();
|
||||
ArrayList<BaritoneSetting> list = new ArrayList<BaritoneSetting>();
|
||||
HashMap<BaritoneSetting, Type> map2 = new HashMap<BaritoneSetting, Type>();
|
||||
try {
|
||||
Field[] fieldArray2 = fieldArray;
|
||||
int length = fieldArray.length;
|
||||
int value = 0;
|
||||
while (value < length) {
|
||||
Field field = fieldArray2[value];
|
||||
if (field.getType().equals(BaritoneSetting.class)) {
|
||||
BaritoneSetting baritoneSetting = (BaritoneSetting)field.get(this);
|
||||
String str = (String)BaritoneSetting.resolveObject(baritoneSetting);
|
||||
String toLowerCase = str.toLowerCase();
|
||||
if (map.containsKey(toLowerCase)) {
|
||||
throw new IllegalStateException("Duplicate setting name");
|
||||
}
|
||||
map.put(toLowerCase, baritoneSetting);
|
||||
list.add(baritoneSetting);
|
||||
map2.put(baritoneSetting, ((ParameterizedType)field.getGenericType()).getActualTypeArguments()[0]);
|
||||
}
|
||||
++value;
|
||||
}
|
||||
}
|
||||
catch (IllegalAccessException illegalAccessException) {
|
||||
throw new IllegalStateException(illegalAccessException);
|
||||
}
|
||||
this.byLowerName = Collections.unmodifiableMap((Map)map);
|
||||
this.allSettings = Collections.unmodifiableList((List)list);
|
||||
this.settingTypes = Collections.unmodifiableMap((Map)map2);
|
||||
}
|
||||
|
||||
public <T> List<BaritoneSetting<T, String>> getAllValuesByType(Class<T> targetClass) {
|
||||
ArrayList<BaritoneSetting<T, String>> list = new ArrayList<BaritoneSetting<T, String>>();
|
||||
for (BaritoneSetting<?, String> baritoneSetting : this.allSettings) {
|
||||
if (!baritoneSetting.getValueClass().equals(targetClass)) continue;
|
||||
list.add((BaritoneSetting<T, String>)baritoneSetting);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package baritone.api.event;
|
||||
import baritone.api.utils.BaritoneGuiClientHelper;
|
||||
|
||||
|
||||
public final class AbstractGameListener implements IGameEventListener {
|
||||
public transient BaritoneGuiClientHelper baritoneGuiClientHelper;
|
||||
|
||||
public AbstractGameListener(BaritoneGuiClientHelper baritoneGuiClientHelper2) {
|
||||
this.baritoneGuiClientHelper = baritoneGuiClientHelper2;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBaritoneTick(BaritoneTickEvent baritoneTickEvent) {
|
||||
|
||||
if (baritoneTickEvent.getBaritoneTickType() == BaritoneTickType.IN) {
|
||||
BaritoneGuiClientHelper.updateBaritoneGuiClientHelper(this.baritoneGuiClientHelper);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package baritone.api.event;
|
||||
|
||||
public final class BaritoneChatEvent extends CancelableBaritoneEvent {
|
||||
private transient String nameText;
|
||||
|
||||
public final String getNameText() {
|
||||
return this.nameText;
|
||||
}
|
||||
|
||||
public BaritoneChatEvent(String nameText) {
|
||||
this.nameText = nameText;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package baritone.api.event;
|
||||
|
||||
public enum BaritoneEventState {
|
||||
@com.google.gson.annotations.SerializedName("gMZV3AYRhqbSBWJxcl1LZ") POST,
|
||||
@com.google.gson.annotations.SerializedName("gMZV3AYRhqbS") PRE;
|
||||
|
||||
static {
|
||||
String[] textArr = new String[]{"PRE", "POST"};
|
||||
}
|
||||
|
||||
private static final String a(byte[] byteValArr) {
|
||||
int value = 0;
|
||||
int length;
|
||||
char[] charValArr = new char[length = byteValArr.length];
|
||||
|
||||
for (int idx = 0; idx < length; idx++) {
|
||||
int value2;
|
||||
if ((value2 = 255 & byteValArr[idx]) < 192) {
|
||||
charValArr[value++] = (char)value2;
|
||||
} else if (value2 < 224) {
|
||||
char charCode = (char)((char)(value2 & 31) << 6);
|
||||
byte byteData = byteValArr[++idx];
|
||||
charCode = (char)(charCode | (char)(byteData & 63));
|
||||
charValArr[value++] = charCode;
|
||||
} else if (idx < length - 2) {
|
||||
char charCode2 = (char)((char)(value2 & 15) << '\f');
|
||||
byte byteData2 = byteValArr[++idx];
|
||||
charCode2 = (char)(charCode2 | (char)(byteData2 & 63) << 6);
|
||||
byteData2 = byteValArr[++idx];
|
||||
charCode2 = (char)(charCode2 | (char)(byteData2 & 63));
|
||||
charValArr[value++] = charCode2;
|
||||
}
|
||||
}
|
||||
|
||||
return new String(charValArr, 0, value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package baritone.api.event;
|
||||
|
||||
public final class BaritoneTickEvent {
|
||||
private static int count;
|
||||
private transient int count2;
|
||||
private transient BaritoneTickType baritoneTickType;
|
||||
private transient BaritoneEventState baritoneEventState;
|
||||
|
||||
public BaritoneTickType getBaritoneTickType() {
|
||||
return this.baritoneTickType;
|
||||
}
|
||||
|
||||
public BaritoneEventState getBaritoneEventState() {
|
||||
return this.baritoneEventState;
|
||||
}
|
||||
|
||||
public int getCount2() {
|
||||
return this.count2;
|
||||
}
|
||||
|
||||
public BaritoneTickEvent(BaritoneEventState baritoneEventState, BaritoneTickType baritoneTickType) {
|
||||
this.baritoneEventState = baritoneEventState;
|
||||
this.baritoneTickType = baritoneTickType;
|
||||
this.count2 = getIndex();
|
||||
}
|
||||
|
||||
private static final synchronized int getIndex() {
|
||||
return count++;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package baritone.api.event;
|
||||
|
||||
public enum BaritoneTickType {
|
||||
@com.google.gson.annotations.SerializedName("gMZV3AYRhqbSBWJxcl1LZ") OUT,
|
||||
@com.google.gson.annotations.SerializedName("gMZV3AYRhqbS") IN;
|
||||
|
||||
private static final String a(byte[] byteValArr) {
|
||||
int value = 0;
|
||||
int length;
|
||||
char[] charValArr = new char[length = byteValArr.length];
|
||||
|
||||
for (int idx = 0; idx < length; idx++) {
|
||||
int value2;
|
||||
if ((value2 = 255 & byteValArr[idx]) < 192) {
|
||||
charValArr[value++] = (char)value2;
|
||||
} else if (value2 < 224) {
|
||||
char charCode = (char)((char)(value2 & 31) << 6);
|
||||
byte byteData = byteValArr[++idx];
|
||||
charCode = (char)(charCode | (char)(byteData & 63));
|
||||
charValArr[value++] = charCode;
|
||||
} else if (idx < length - 2) {
|
||||
char charCode2 = (char)((char)(value2 & 15) << '\f');
|
||||
byte byteData2 = byteValArr[++idx];
|
||||
charCode2 = (char)(charCode2 | (char)(byteData2 & 63) << 6);
|
||||
byteData2 = byteValArr[++idx];
|
||||
charCode2 = (char)(charCode2 | (char)(byteData2 & 63));
|
||||
charValArr[value++] = charCode2;
|
||||
}
|
||||
}
|
||||
|
||||
return new String(charValArr, 0, value);
|
||||
}
|
||||
|
||||
static {
|
||||
String[] textArr = new String[]{"IN", "OUT"};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package baritone.api.event;
|
||||
|
||||
public enum BlockClickAction {
|
||||
@com.google.gson.annotations.SerializedName("gMZV3AYRhqbS") START_BREAK,
|
||||
@com.google.gson.annotations.SerializedName("gMZV3AYRhqbSBWJxcl1LZ") USE;
|
||||
|
||||
private static final String a(byte[] byteValArr) {
|
||||
int value = 0;
|
||||
int length;
|
||||
char[] charValArr = new char[length = byteValArr.length];
|
||||
|
||||
for (int idx = 0; idx < length; idx++) {
|
||||
int value2;
|
||||
if ((value2 = 255 & byteValArr[idx]) < 192) {
|
||||
charValArr[value++] = (char)value2;
|
||||
} else if (value2 < 224) {
|
||||
char charCode = (char)((char)(value2 & 31) << 6);
|
||||
byte byteData = byteValArr[++idx];
|
||||
charCode = (char)(charCode | (char)(byteData & 63));
|
||||
charValArr[value++] = charCode;
|
||||
} else if (idx < length - 2) {
|
||||
char charCode2 = (char)((char)(value2 & 15) << '\f');
|
||||
byte byteData2 = byteValArr[++idx];
|
||||
charCode2 = (char)(charCode2 | (char)(byteData2 & 63) << 6);
|
||||
byteData2 = byteValArr[++idx];
|
||||
charCode2 = (char)(charCode2 | (char)(byteData2 & 63));
|
||||
charValArr[value++] = charCode2;
|
||||
}
|
||||
}
|
||||
|
||||
return new String(charValArr, 0, value);
|
||||
}
|
||||
|
||||
static {
|
||||
String[] textArr = new String[]{"USE", "START_BREAK"};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package baritone.api.event;
|
||||
|
||||
public class CancelableBaritoneEvent implements ICancelableBaritoneEvent {
|
||||
private transient boolean active;
|
||||
|
||||
@Override
|
||||
public final boolean isActive() {
|
||||
return this.active;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void resetState() {
|
||||
this.active = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package baritone.api.event;
|
||||
|
||||
public enum ChunkEventAction {
|
||||
@com.google.gson.annotations.SerializedName("gMZV3AYRhqbSBWJxcl1LZ") UNLOAD,
|
||||
@com.google.gson.annotations.SerializedName("AMwtKGfvzgdobtjmjc") POPULATE_PARTIAL,
|
||||
@com.google.gson.annotations.SerializedName("AMwtKG") POPULATE_FULL,
|
||||
@com.google.gson.annotations.SerializedName("gMZV3AYRhqbS") LOAD;
|
||||
|
||||
static {
|
||||
String[] textArr = new String[]{"LOAD", "UNLOAD", "POPULATE_PARTIAL", "POPULATE_FULL"};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package baritone.api.event;
|
||||
|
||||
public final class ChunkPostEvent {
|
||||
private transient int count;
|
||||
private transient BaritoneEventState baritoneEventState;
|
||||
private transient ChunkEventAction chunkEventAction;
|
||||
private transient int count2;
|
||||
|
||||
public final int getCount2() {
|
||||
return this.count2;
|
||||
}
|
||||
|
||||
public final ChunkEventAction getChunkEventAction() {
|
||||
return this.chunkEventAction;
|
||||
}
|
||||
|
||||
public final int getCount() {
|
||||
return this.count;
|
||||
}
|
||||
|
||||
public ChunkPostEvent(BaritoneEventState baritoneEventState, ChunkEventAction chunkEventAction, int count, int count2) {
|
||||
this.baritoneEventState = baritoneEventState;
|
||||
this.chunkEventAction = chunkEventAction;
|
||||
this.count = count;
|
||||
this.count2 = count2;
|
||||
}
|
||||
|
||||
public final BaritoneEventState getBaritoneEventState() {
|
||||
return this.baritoneEventState;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package baritone.api.event;
|
||||
|
||||
public interface IBaritoneEventBus extends IGameEventNotifier {
|
||||
void updateGameEventNotifier(IGameEventNotifier gameEventNotifier);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package baritone.api.event;
|
||||
|
||||
public interface ICancelableBaritoneEvent {
|
||||
void resetState();
|
||||
|
||||
boolean isActive();
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package baritone.api.event;
|
||||
import intent.zeroday.util.BlockPosHelper;
|
||||
import intent.zeroday.util.PacketHelper;
|
||||
import intent.zeroday.util.WorldClientHelper;
|
||||
|
||||
|
||||
public interface IGameEventListener extends IGameEventNotifier {
|
||||
@Override
|
||||
default void onRotationMoveState(RotationMoveStateEvent rotationMoveStateEvent) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void onPathRender(PathRenderEvent pathRenderEvent) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void onBaritoneTick(BaritoneTickEvent baritoneTickEvent) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void onChunkPost(ChunkPostEvent chunkPostEvent) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void updatePacketHelper(PacketHelper packetHelper) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void updateBlockPosHelper(BlockPosHelper blockPosHelper) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void onPathCalc(PathCalcEvent pathCalcEvent) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void onBaritoneChat(BaritoneChatEvent baritoneChatEvent) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void updateState() {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void onSprintState(SprintStateEvent sprintStateEvent) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void updateWorldClientHelper(WorldClientHelper worldClientHelper) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void onPlayerUpdate(PlayerUpdateEvent playerUpdateEvent) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void updatePacketHelper2(PacketHelper packetHelper2) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package baritone.api.event;
|
||||
import intent.zeroday.util.BlockPosHelper;
|
||||
import intent.zeroday.util.PacketHelper;
|
||||
import intent.zeroday.util.WorldClientHelper;
|
||||
|
||||
|
||||
public interface IGameEventNotifier {
|
||||
void updatePacketHelper(PacketHelper packetHelper);
|
||||
|
||||
void onPlayerUpdate(PlayerUpdateEvent playerUpdateEvent);
|
||||
|
||||
void onBaritoneChat(BaritoneChatEvent baritoneChatEvent);
|
||||
|
||||
void updateWorldClientHelper(WorldClientHelper worldClientHelper);
|
||||
|
||||
void onRotationMoveState(RotationMoveStateEvent rotationMoveStateEvent);
|
||||
|
||||
void updatePacketHelper2(PacketHelper packetHelper2);
|
||||
|
||||
void onPathRender(PathRenderEvent pathRenderEvent);
|
||||
|
||||
void onSprintState(SprintStateEvent sprintStateEvent);
|
||||
|
||||
void onBaritoneTick(BaritoneTickEvent baritoneTickEvent);
|
||||
|
||||
void updateBlockPosHelper(BlockPosHelper blockPosHelper);
|
||||
|
||||
void onPathCalc(PathCalcEvent pathCalcEvent);
|
||||
|
||||
void onChunkPost(ChunkPostEvent chunkPostEvent);
|
||||
|
||||
void updateState();
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package baritone.api.event;
|
||||
|
||||
public enum PathCalcEvent {
|
||||
@com.google.gson.annotations.SerializedName("wY1IDyjPF62jednNIZZa") DISCARD_NEXT,
|
||||
@com.google.gson.annotations.SerializedName("AMwtKGfvzgdobtjmjc") NEXT_SEGMENT_CALC_STARTED,
|
||||
@com.google.gson.annotations.SerializedName("wY1IDyjPF") NEXT_CALC_FAILED,
|
||||
@com.google.gson.annotations.SerializedName("AMwtKG") CALC_FAILED,
|
||||
@com.google.gson.annotations.SerializedName("gMZV3AYRhqbSBWJxcl1LZ") CALC_FINISHED_NOW_EXECUTING,
|
||||
@com.google.gson.annotations.SerializedName("XpM2HEd1Jguzpujkrqgvzajwxtd") CONTINUING_ONTO_PLANNED_NEXT,
|
||||
@com.google.gson.annotations.SerializedName("jwvoxjbsxaajht") CANCELED,
|
||||
@com.google.gson.annotations.SerializedName("PJBpSG3xmzdDO2") AT_GOAL,
|
||||
@com.google.gson.annotations.SerializedName("hrmikrlnmnhyj") SPLICING_ONTO_NEXT_EARLY,
|
||||
@com.google.gson.annotations.SerializedName("XpM2HEd1Jg") NEXT_SEGMENT_CALC_FINISHED,
|
||||
@com.google.gson.annotations.SerializedName("PJBpSG3xmzdDO25134669") PATH_FINISHED_NEXT_STILL_CALCULATING,
|
||||
@com.google.gson.annotations.SerializedName("gMZV3AYRhqbS") CALC_STARTED;
|
||||
|
||||
static {
|
||||
String[] textArr = new String[]{
|
||||
"NEXT_SEGMENT_CALC_STARTED",
|
||||
"DISCARD_NEXT",
|
||||
"CALC_STARTED",
|
||||
"SPLICING_ONTO_NEXT_EARLY",
|
||||
"PATH_FINISHED_NEXT_STILL_CALCULATING",
|
||||
"NEXT_CALC_FAILED",
|
||||
"CALC_FAILED",
|
||||
"AT_GOAL",
|
||||
"CANCELED",
|
||||
"NEXT_SEGMENT_CALC_FINISHED",
|
||||
"CONTINUING_ONTO_PLANNED_NEXT",
|
||||
"CALC_FINISHED_NOW_EXECUTING"
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package baritone.api.event;
|
||||
import baritone.api.utils.BaritoneApi;
|
||||
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
public final class PathCalcResult {
|
||||
private transient PathCalcResultType pathCalcResultType;
|
||||
private transient BaritoneApi baritoneApi;
|
||||
|
||||
public final Optional<BaritoneApi> getOptional() {
|
||||
return Optional.ofNullable(this.baritoneApi);
|
||||
}
|
||||
|
||||
public PathCalcResult(PathCalcResultType pathCalcResultType) {
|
||||
this(pathCalcResultType, null);
|
||||
}
|
||||
|
||||
public PathCalcResult(PathCalcResultType pathCalcResultType, BaritoneApi baritoneApi2) {
|
||||
Objects.requireNonNull(pathCalcResultType);
|
||||
this.baritoneApi = baritoneApi2;
|
||||
this.pathCalcResultType = pathCalcResultType;
|
||||
}
|
||||
|
||||
public final PathCalcResultType getPathCalcResultType() {
|
||||
return this.pathCalcResultType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package baritone.api.event;
|
||||
|
||||
public enum PathCalcResultType {
|
||||
@com.google.gson.annotations.SerializedName("AMwtKGfvzgdobtjmjc") CANCELLATION,
|
||||
@com.google.gson.annotations.SerializedName("gMZV3AYRhqbS") SUCCESS_TO_GOAL,
|
||||
@com.google.gson.annotations.SerializedName("gMZV3AYRhqbSBWJxcl1LZ") SUCCESS_SEGMENT,
|
||||
@com.google.gson.annotations.SerializedName("AMwtKG") FAILURE,
|
||||
@com.google.gson.annotations.SerializedName("XpM2HEd1Jg") EXCEPTION;
|
||||
|
||||
static {
|
||||
String[] textArr = new String[]{"CANCELLATION", "FAILURE", "SUCCESS_TO_GOAL", "EXCEPTION", "SUCCESS_SEGMENT"};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package baritone.api.event;
|
||||
|
||||
public final class PathRenderEvent {
|
||||
private transient float factor;
|
||||
|
||||
public PathRenderEvent(float factor) {
|
||||
this.factor = factor;
|
||||
}
|
||||
|
||||
public final float getFactor() {
|
||||
return this.factor;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package baritone.api.event;
|
||||
|
||||
public final class PlayerUpdateEvent {
|
||||
private transient BaritoneEventState baritoneEventState;
|
||||
|
||||
public PlayerUpdateEvent(BaritoneEventState baritoneEventState) {
|
||||
this.baritoneEventState = baritoneEventState;
|
||||
}
|
||||
|
||||
public final BaritoneEventState getBaritoneEventState() {
|
||||
return this.baritoneEventState;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package baritone.api.event;
|
||||
|
||||
public enum RotationMovePhase {
|
||||
@com.google.gson.annotations.SerializedName("gMZV3AYRhqbSBWJxcl1LZ") JUMP,
|
||||
@com.google.gson.annotations.SerializedName("gMZV3AYRhqbS") MOTION_UPDATE;
|
||||
|
||||
private static final String a(byte[] byteValArr) {
|
||||
int value = 0;
|
||||
int length;
|
||||
char[] charValArr = new char[length = byteValArr.length];
|
||||
|
||||
for (int idx = 0; idx < length; idx++) {
|
||||
int value2;
|
||||
if ((value2 = 255 & byteValArr[idx]) < 192) {
|
||||
charValArr[value++] = (char)value2;
|
||||
} else if (value2 < 224) {
|
||||
char charCode = (char)((char)(value2 & 31) << 6);
|
||||
byte byteData = byteValArr[++idx];
|
||||
charCode = (char)(charCode | (char)(byteData & 63));
|
||||
charValArr[value++] = charCode;
|
||||
} else if (idx < length - 2) {
|
||||
char charCode2 = (char)((char)(value2 & 15) << '\f');
|
||||
byte byteData2 = byteValArr[++idx];
|
||||
charCode2 = (char)(charCode2 | (char)(byteData2 & 63) << 6);
|
||||
byteData2 = byteValArr[++idx];
|
||||
charCode2 = (char)(charCode2 | (char)(byteData2 & 63));
|
||||
charValArr[value++] = charCode2;
|
||||
}
|
||||
}
|
||||
|
||||
return new String(charValArr, 0, value);
|
||||
}
|
||||
|
||||
static {
|
||||
String[] textArr = new String[]{"MOTION_UPDATE", "JUMP"};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package baritone.api.event;
|
||||
|
||||
public final class RotationMoveStateEvent {
|
||||
private transient RotationMovePhase rotationMovePhase;
|
||||
private transient float factor;
|
||||
|
||||
public final void setFactor(float factor) {
|
||||
this.factor = factor;
|
||||
}
|
||||
|
||||
public final float getFactor() {
|
||||
return this.factor;
|
||||
}
|
||||
|
||||
public RotationMoveStateEvent(RotationMovePhase rotationMovePhase, float factor) {
|
||||
this.rotationMovePhase = rotationMovePhase;
|
||||
this.factor = factor;
|
||||
}
|
||||
|
||||
public final RotationMovePhase getRotationMovePhase() {
|
||||
return this.rotationMovePhase;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package baritone.api.event;
|
||||
|
||||
public final class SprintStateEvent {
|
||||
private transient Boolean valueRef;
|
||||
|
||||
public final void updateFlag(boolean valueRef) {
|
||||
this.valueRef = valueRef;
|
||||
}
|
||||
|
||||
public final Boolean getValueRef() {
|
||||
return this.valueRef;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package baritone.api.movement;
|
||||
|
||||
public interface ActionCostValues {
|
||||
double coordVal2 = transformDistance(1.25);
|
||||
double coordVal3 = 0.9265693768820937;
|
||||
double coordVal4 = 15.384615384615383;
|
||||
double coordVal5 = 6.666666666666667;
|
||||
double coordVal6 = 8.51063829787234;
|
||||
double coordVal7 = 1000000.0;
|
||||
double coordVal8 = 9.09090909090909;
|
||||
double[] doubleValueArray = f_();
|
||||
double coordVal9 = 9.26569376882094;
|
||||
double coordVal10 = 3.563791874554526;
|
||||
double coordVal11 = 4.63284688441047;
|
||||
double coordVal12 = 3.7062775075283763;
|
||||
double coordVal13 = transformDistance(0.25);
|
||||
double coordVal14 = coordVal2 - ActionCostValues.coordVal13;
|
||||
double coordVal15 = 0.7692444761225944;
|
||||
|
||||
static double transformDistance(double amountD) {
|
||||
if (amountD == 0.0) {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
double amountD2 = amountD;
|
||||
int value = 0;
|
||||
|
||||
while (true) {
|
||||
double amountD3 = resolveDistance7(value);
|
||||
if (amountD2 <= amountD3) {
|
||||
return value + amountD2 / amountD3;
|
||||
}
|
||||
|
||||
amountD2 -= amountD3;
|
||||
value++;
|
||||
}
|
||||
}
|
||||
|
||||
static double resolveDistance7(int value) {
|
||||
return (Math.pow(0.98, value) - 1.0) * -3.92;
|
||||
}
|
||||
|
||||
static double transformDistance2(double amountD) {
|
||||
return -3.92 * (99.0 - 49.5 * (Math.pow(0.98, amountD) + 1.0) - amountD);
|
||||
}
|
||||
|
||||
static double[] f_() {
|
||||
double[] doubleValArr = new double[257];
|
||||
|
||||
for (int idx = 0; idx < 257; idx++) {
|
||||
doubleValArr[idx] = transformDistance(idx);
|
||||
}
|
||||
|
||||
return doubleValArr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package baritone.api.movement;
|
||||
import baritone.api.utils.BaritoneApi;
|
||||
|
||||
|
||||
public interface BaritoneApiEntry {
|
||||
BaritoneApi getBaritoneApi();
|
||||
|
||||
int getBaritoneApi2();
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package baritone.api.movement;
|
||||
|
||||
import baritone.api.utils.BetterBlockPos;
|
||||
import net.minecraft.util.BlockPos;
|
||||
|
||||
public interface BaritoneApiHelper {
|
||||
BlockPos getBlockPos();
|
||||
|
||||
double getDistance();
|
||||
|
||||
BetterBlockPos getBetterBlockPos();
|
||||
|
||||
MovementStatus getMovementStatus();
|
||||
|
||||
void resetState();
|
||||
|
||||
BetterBlockPos getBetterBlockPos3();
|
||||
|
||||
boolean isActive2();
|
||||
|
||||
boolean isActive();
|
||||
|
||||
void updateState();
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package baritone.api.movement;
|
||||
|
||||
public enum BaritoneInput {
|
||||
@com.google.gson.annotations.SerializedName("XpM2HEd1Jg") CLICK_LEFT,
|
||||
@com.google.gson.annotations.SerializedName("AMwtKG") MOVE_LEFT,
|
||||
@com.google.gson.annotations.SerializedName("PJBpSG3xmzdDO2") SNEAK,
|
||||
@com.google.gson.annotations.SerializedName("AMwtKGfvzgdobtjmjc") MOVE_RIGHT,
|
||||
@com.google.gson.annotations.SerializedName("PJBpSG3xmzdDO25134669") SPRINT,
|
||||
@com.google.gson.annotations.SerializedName("hrmikrlnmnhyj") JUMP,
|
||||
@com.google.gson.annotations.SerializedName("gMZV3AYRhqbSBWJxcl1LZ") MOVE_BACK,
|
||||
@com.google.gson.annotations.SerializedName("XpM2HEd1Jguzpujkrqgvzajwxtd") CLICK_RIGHT,
|
||||
@com.google.gson.annotations.SerializedName("gMZV3AYRhqbS") MOVE_FORWARD;
|
||||
|
||||
static {
|
||||
String[] textArr = new String[]{"MOVE_RIGHT", "CLICK_RIGHT", "SPRINT", "JUMP", "MOVE_BACK", "CLICK_LEFT", "SNEAK", "MOVE_FORWARD", "MOVE_LEFT"};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package baritone.api.movement;
|
||||
|
||||
import baritone.pathing.InputOverrideHandler;
|
||||
import net.minecraft.util.MovementInput;
|
||||
|
||||
public final class BaritoneMovementInput extends MovementInput {
|
||||
private transient InputOverrideHandler inputOverrideHandler;
|
||||
|
||||
@Override
|
||||
public void updatePlayerMoveState() {
|
||||
moveStrafe = 0.0F;
|
||||
|
||||
moveForward = 0.0F;
|
||||
this.jump = this.inputOverrideHandler.canAcceptBaritoneInput(BaritoneInput.JUMP);
|
||||
boolean enabled = this.enabledFlag = this.inputOverrideHandler.canAcceptBaritoneInput(BaritoneInput.MOVE_FORWARD);
|
||||
if (enabled) {
|
||||
moveForward++;
|
||||
}
|
||||
|
||||
boolean enabled2 = this.enabledFlag2 = this.inputOverrideHandler.canAcceptBaritoneInput(BaritoneInput.MOVE_BACK);
|
||||
if (enabled2) {
|
||||
moveForward--;
|
||||
}
|
||||
|
||||
boolean enabled3 = this.enabledFlag3 = this.inputOverrideHandler.canAcceptBaritoneInput(BaritoneInput.MOVE_LEFT);
|
||||
if (enabled3) {
|
||||
moveStrafe++;
|
||||
}
|
||||
|
||||
boolean enabled4 = this.enabledFlag4 = this.inputOverrideHandler.canAcceptBaritoneInput(BaritoneInput.MOVE_RIGHT);
|
||||
if (enabled4) {
|
||||
moveStrafe--;
|
||||
}
|
||||
|
||||
if (this.sneak = this.inputOverrideHandler.canAcceptBaritoneInput(BaritoneInput.SNEAK)) {
|
||||
moveStrafe = (float)(moveStrafe * (0.3));
|
||||
moveForward = (float)(moveForward * (0.3));
|
||||
}
|
||||
}
|
||||
|
||||
public BaritoneMovementInput(InputOverrideHandler inputOverrideHandler) {
|
||||
this.inputOverrideHandler = inputOverrideHandler;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
package baritone.api.movement;
|
||||
import baritone.api.utils.BaritoneBitSetHelper;
|
||||
import baritone.api.utils.BaritoneWorldData;
|
||||
import baritone.api.utils.IPlayerContext;
|
||||
import intent.zeroday.util.LongHashMapApi;
|
||||
|
||||
|
||||
import baritone.pathing.BaritoneCore;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.LongHashMap;
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
||||
public final class BlockStateInterface {
|
||||
private transient Chunk chunk = null;
|
||||
private transient LongHashMap longHashMap;
|
||||
private static IBlockState iBlockState = Blocks.air.getDefaultState();
|
||||
private transient BaritoneWorldData baritoneWorldData;
|
||||
private transient boolean hasValue;
|
||||
private transient BaritoneBitSetHelper baritoneBitSetHelper = null;
|
||||
|
||||
public IBlockState resolveBlockState(int posX, int posY, int posZ) {
|
||||
|
||||
|
||||
|
||||
int value = posY;
|
||||
int value2;
|
||||
if (value < 0) {
|
||||
return iBlockState;
|
||||
}
|
||||
|
||||
value2 = posY;
|
||||
|
||||
int value3 = value2;
|
||||
if (value3 >= 256) {
|
||||
return iBlockState;
|
||||
}
|
||||
|
||||
value2 = ((this.hasValue) ? 1 : 0);
|
||||
|
||||
if (value2 != 0) {
|
||||
Chunk chunk2 = this.chunk;
|
||||
Chunk chunk3 = chunk2;
|
||||
Chunk chunk4;
|
||||
if (chunk3 != null && chunk2.xPosition == posX >> 4 && chunk2.zPosition == posZ >> 4) {
|
||||
return chunk2.getBlockState(new BlockPos(posX, posY, posZ));
|
||||
}
|
||||
|
||||
chunk4 = (Chunk)this.longHashMap.getValueByKey(ChunkCoordIntPair.chunkXZ2Int(posX >> 4, posZ >> 4));
|
||||
|
||||
Chunk chunk5 = chunk4;
|
||||
if (chunk5 != null) {
|
||||
Chunk chunk6 = chunk5;
|
||||
|
||||
|
||||
if (chunk6.isLoaded()) {
|
||||
this.chunk = chunk5;
|
||||
return chunk5.getBlockState(new BlockPos(posX, posY, posZ));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BaritoneBitSetHelper baritoneBitSetHelper2;
|
||||
label106: {
|
||||
label107: {
|
||||
baritoneBitSetHelper2 = this.baritoneBitSetHelper;
|
||||
BaritoneBitSetHelper baritoneBitSetHelper3 = baritoneBitSetHelper2;
|
||||
BaritoneBitSetHelper baritoneBitSetHelper4;
|
||||
if (baritoneBitSetHelper3 == null) {
|
||||
break label107;
|
||||
}
|
||||
|
||||
baritoneBitSetHelper4 = baritoneBitSetHelper2;
|
||||
|
||||
value2 = baritoneBitSetHelper4.getCount2();
|
||||
int value4 = posX >> 9;
|
||||
int value5 = value2;
|
||||
int value6;
|
||||
if (value5 != value4) {
|
||||
break label107;
|
||||
}
|
||||
|
||||
value2 = baritoneBitSetHelper2.getCount3();
|
||||
value6 = posZ >> 9;
|
||||
|
||||
if (value2 == value6) {
|
||||
break label106;
|
||||
}
|
||||
}
|
||||
|
||||
BaritoneWorldData baritoneBaritoneComponen = this.baritoneWorldData;
|
||||
BaritoneWorldData baritoneBaritoneComponen2;
|
||||
if (baritoneBaritoneComponen == null) {
|
||||
return iBlockState;
|
||||
}
|
||||
|
||||
baritoneBaritoneComponen2 = this.baritoneWorldData;
|
||||
|
||||
BaritoneBitSetHelper baritoneBitSetHelper5 = baritoneBaritoneComponen2.cachedWorld.resolveBaritoneBitSetHelper(posX >> 9, posZ >> 9);
|
||||
BaritoneBitSetHelper baritoneBitSetHelper6 = baritoneBitSetHelper5;
|
||||
BaritoneBitSetHelper baritoneBitSetHelper7;
|
||||
if (baritoneBitSetHelper6 == null) {
|
||||
return iBlockState;
|
||||
}
|
||||
|
||||
this.baritoneBitSetHelper = baritoneBitSetHelper5;
|
||||
baritoneBitSetHelper7 = baritoneBitSetHelper5;
|
||||
|
||||
baritoneBitSetHelper2 = baritoneBitSetHelper7;
|
||||
}
|
||||
|
||||
IBlockState state2 = baritoneBitSetHelper2.resolveBlockState(posX & 511, posY, posZ & 511);
|
||||
IBlockState state3 = state2;
|
||||
IBlockState state4;
|
||||
if (state3 == null) {
|
||||
return iBlockState;
|
||||
}
|
||||
|
||||
state4 = state2;
|
||||
|
||||
return state4;
|
||||
}
|
||||
|
||||
public BlockStateInterface(IPlayerContext playerContext, boolean enabled) {
|
||||
this(playerContext.world(), (BaritoneWorldData)playerContext.getCachedWorldData(), enabled);
|
||||
}
|
||||
|
||||
public IBlockState resolveBlockState2(BlockPos pos) {
|
||||
|
||||
|
||||
return this.resolveBlockState(pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
public boolean canAcceptIndex(int value, int value2) {
|
||||
Chunk chunk7 = this.chunk;
|
||||
if (chunk7 != null && chunk7.xPosition == value >> 4 && chunk7.zPosition == value2 >> 4) {
|
||||
return true;
|
||||
}
|
||||
|
||||
chunk7 = (Chunk)this.longHashMap.getValueByKey(ChunkCoordIntPair.chunkXZ2Int(value >> 4, value2 >> 4));
|
||||
if (chunk7 != null && chunk7.isLoaded()) {
|
||||
this.chunk = chunk7;
|
||||
return true;
|
||||
}
|
||||
|
||||
BaritoneBitSetHelper baritoneBitSetHelper8 = this.baritoneBitSetHelper;
|
||||
if (baritoneBitSetHelper8 != null && baritoneBitSetHelper8.getCount2() == value >> 9 && baritoneBitSetHelper8.getCount3() == value2 >> 9) {
|
||||
return baritoneBitSetHelper8.canAcceptIndex(value & 511, value2 & 511);
|
||||
}
|
||||
|
||||
if (this.baritoneWorldData == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
baritoneBitSetHelper8 = this.baritoneWorldData.cachedWorld.resolveBaritoneBitSetHelper(value >> 9, value2 >> 9);
|
||||
if (baritoneBitSetHelper8 == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.baritoneBitSetHelper = baritoneBitSetHelper8;
|
||||
return baritoneBitSetHelper8.canAcceptIndex(value & 511, value2 & 511);
|
||||
}
|
||||
|
||||
public static final IBlockState resolveBlockState3(IPlayerContext playerContext, BlockPos pos2) {
|
||||
|
||||
|
||||
return new BlockStateInterface(playerContext).resolveBlockState(pos2.getX(), pos2.getY(), pos2.getZ());
|
||||
}
|
||||
|
||||
public BlockStateInterface(IPlayerContext playerContext) {
|
||||
this(playerContext, false);
|
||||
}
|
||||
|
||||
public BlockStateInterface(World world2, BaritoneWorldData baritoneBaritoneComponen3, boolean enabled) {
|
||||
this.baritoneWorldData = baritoneBaritoneComponen3;
|
||||
LongHashMap longHashMap2 = ((LongHashMapApi)world2.getChunkProvider()).fetchLongHashMap();
|
||||
if (enabled) {
|
||||
this.longHashMap = longHashMap2;
|
||||
} else {
|
||||
this.longHashMap = longHashMap2;
|
||||
}
|
||||
|
||||
this.hasValue = !BaritoneCore.getBaritoneSettings().pathThroughCachedOnly.value;
|
||||
if (!Minecraft.getMinecraft().isCallingFromMinecraftThread()) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canAcceptIndex2(int value, int value2) {
|
||||
return this.longHashMap.containsItem(ChunkCoordIntPair.chunkXZ2Int(value >> 4, value2 >> 4));
|
||||
}
|
||||
|
||||
public static final Block resolveBlock(IPlayerContext playerContext, BlockPos pos3) {
|
||||
|
||||
|
||||
return resolveBlockState3(playerContext, pos3).getBlock();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,217 @@
|
||||
package baritone.api.movement;
|
||||
import baritone.api.utils.BaritoneEntityPlayerSP;
|
||||
import baritone.api.utils.BaritoneWorldData;
|
||||
import baritone.api.utils.IBaritone;
|
||||
|
||||
|
||||
import baritone.pathing.BaritoneCore;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class CalculationContext {
|
||||
public transient boolean hasValue;
|
||||
public transient double coordVal;
|
||||
public transient int value;
|
||||
public transient boolean hasValue2;
|
||||
public transient double value2;
|
||||
public transient boolean hasValue3;
|
||||
public transient int value3;
|
||||
public transient boolean hasValue4;
|
||||
public transient BaritoneWorldData baritoneWorldData;
|
||||
public transient double value4;
|
||||
public transient double value5;
|
||||
public transient boolean hasBaritoneItemStackUtil;
|
||||
public transient boolean hasValue5;
|
||||
public transient PathFavoring pathFavoring;
|
||||
public transient boolean hasValue6;
|
||||
public transient boolean hasValue7;
|
||||
public transient IBaritone baritone;
|
||||
private static ItemStack itemStack = new ItemStack(Items.water_bucket);
|
||||
public transient boolean hasFoodLevel;
|
||||
public transient boolean active;
|
||||
public transient double value6;
|
||||
public transient BlockStateInterface blockStateInterface;
|
||||
public transient boolean isHellWorld;
|
||||
public transient World world;
|
||||
public transient double value7;
|
||||
public transient BaritoneEntityPlayerSP baritoneEntityPlayerSP;
|
||||
|
||||
public CalculationContext(IBaritone baritone, boolean active) {
|
||||
|
||||
|
||||
EntityPlayerSP player;
|
||||
int value;
|
||||
label76: {
|
||||
label79: {
|
||||
|
||||
|
||||
|
||||
this.active = active;
|
||||
|
||||
this.baritone = baritone;
|
||||
player = baritone.getBaritoneApiUtil().player();
|
||||
this.world = baritone.getBaritoneApiUtil().world();
|
||||
this.baritoneWorldData = (BaritoneWorldData)baritone.getBaritoneWorldProvider2().getCachedWorldData();
|
||||
this.blockStateInterface = new BlockStateInterface(this.world, this.baritoneWorldData, active);
|
||||
this.baritoneEntityPlayerSP = new BaritoneEntityPlayerSP(player);
|
||||
value = (BaritoneCore.getBaritoneSettings().allowPlace.value ? 1 : 0);
|
||||
if (!((value) != 0)) {
|
||||
break label79;
|
||||
}
|
||||
|
||||
value = ((((BaritoneCore)baritone).getBaritoneItemStackUtil().isActive()) ? 1 : 0);
|
||||
|
||||
|
||||
|
||||
if (((value)) != 0) {
|
||||
value = 1;
|
||||
break label76;
|
||||
}
|
||||
}
|
||||
|
||||
value = 0;
|
||||
}
|
||||
|
||||
label65: {
|
||||
label80: {
|
||||
this.hasBaritoneItemStackUtil = (boolean)((value) != 0);
|
||||
value = (BaritoneCore.getBaritoneSettings().allowWaterBucketFall.value ? 1 : 0);
|
||||
if (!((value) != 0)) {
|
||||
break label80;
|
||||
}
|
||||
|
||||
value = ((canAcceptIndex(player.inventory.getInventorySlotContainItem(itemStack.getItem()))) ? 1 : 0);
|
||||
|
||||
if (!((value) != 0)) {
|
||||
break label80;
|
||||
}
|
||||
|
||||
value = ((this.world.provider.isHellWorld) ? 1 : 0);
|
||||
|
||||
|
||||
|
||||
if (!((value) != 0)) {
|
||||
value = (((boolean)true) ? 1 : 0);
|
||||
break label65;
|
||||
}
|
||||
}
|
||||
|
||||
value = (((boolean)false) ? 1 : 0);
|
||||
}
|
||||
|
||||
label49: {
|
||||
label81: {
|
||||
this.isHellWorld = (((value) & 1) != 0);
|
||||
value = (BaritoneCore.getBaritoneSettings().allowSprint.value ? 1 : 0);
|
||||
if (value == 0) {
|
||||
break label81;
|
||||
}
|
||||
|
||||
value = player.getFoodStats().getFoodLevel();
|
||||
|
||||
|
||||
|
||||
if (value > 6) {
|
||||
value = 1;
|
||||
break label49;
|
||||
}
|
||||
}
|
||||
|
||||
value = 0;
|
||||
}
|
||||
|
||||
this.hasFoodLevel = (boolean)((value) != 0);
|
||||
this.value2 = BaritoneCore.getBaritoneSettings().blockPlacementPenalty.value;
|
||||
this.hasValue6 = BaritoneCore.getBaritoneSettings().allowBreak.value;
|
||||
this.hasValue7 = BaritoneCore.getBaritoneSettings().allowParkour.value;
|
||||
this.hasValue4 = BaritoneCore.getBaritoneSettings().allowParkourPlace.value;
|
||||
this.hasValue2 = BaritoneCore.getBaritoneSettings().allowJumpAt256.value;
|
||||
this.hasValue5 = BaritoneCore.getBaritoneSettings().assumeWalkOnWater.value;
|
||||
this.hasValue3 = BaritoneCore.getBaritoneSettings().allowDiagonalDescend.value;
|
||||
this.hasValue = BaritoneCore.getBaritoneSettings().allowDownward.value;
|
||||
this.value = BaritoneCore.getBaritoneSettings().maxFallHeightNoWater.value;
|
||||
this.value3 = BaritoneCore.getBaritoneSettings().maxFallHeightBucket.value;
|
||||
byte byteData = 0;
|
||||
byte byteData2 = byteData;
|
||||
if (byteData > 3) {
|
||||
byteData = 3;
|
||||
}
|
||||
|
||||
byteData2 = byteData;
|
||||
|
||||
float amountF = byteData2 / 3.0F;
|
||||
this.coordVal = (9.09090909090909) * (1.0F - amountF) + (4.63284688441047) * amountF;
|
||||
this.value7 = BaritoneCore.getBaritoneSettings().blockBreakAdditionalPenalty.value;
|
||||
this.value5 = BaritoneCore.getBaritoneSettings().backtrackCostFavoringCoefficient.value;
|
||||
this.value4 = BaritoneCore.getBaritoneSettings().jumpPenalty.value;
|
||||
this.value6 = BaritoneCore.getBaritoneSettings().walkOnWaterOnePenalty.value;
|
||||
this.pathFavoring = new PathFavoring(this.world.getWorldBorder());
|
||||
}
|
||||
|
||||
public double getValue2() {
|
||||
return this.value2;
|
||||
}
|
||||
|
||||
public static final boolean canAcceptIndex(int value) {
|
||||
return value >= 0 && value < 9;
|
||||
}
|
||||
|
||||
public boolean canAcceptIndex2(int value, int value2) {
|
||||
return this.blockStateInterface.canAcceptIndex(value, value2);
|
||||
}
|
||||
|
||||
public double resolveDistance3(int posX, int posY, int posZ) {
|
||||
if (!this.hasBaritoneItemStackUtil) {
|
||||
return 1000000.0;
|
||||
} else if (this.canAcceptIndex3(posX, posY, posZ)) {
|
||||
return 1000000.0;
|
||||
} else {
|
||||
return !this.pathFavoring.canAcceptIndex2(posX, posZ) ? 1000000.0 : this.value2;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canAcceptIndex3(int posX, int posY, int posZ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Block resolveBlock(int posX, int posY, int posZ) {
|
||||
|
||||
|
||||
return this.resolveBlockState(posX, posY, posZ).getBlock();
|
||||
}
|
||||
|
||||
public final IBaritone getBaritone() {
|
||||
return this.baritone;
|
||||
}
|
||||
|
||||
public IBlockState resolveBlockState(int posX, int posY, int posZ) {
|
||||
|
||||
|
||||
return this.blockStateInterface.resolveBlockState(posX, posY, posZ);
|
||||
}
|
||||
|
||||
public double resolveDistance2(int posX, int posY, int posZ) {
|
||||
if (!this.hasValue6) {
|
||||
return 1000000.0;
|
||||
} else {
|
||||
return this.canAcceptIndex3(posX, posY, posZ) ? 1000000.0 : 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
public IBlockState resolveBlockState4(BlockPos pos) {
|
||||
|
||||
|
||||
return this.resolveBlockState(pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
public CalculationContext(IBaritone baritone) {
|
||||
this(baritone, false);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package baritone.api.movement;
|
||||
import baritone.api.event.PathCalcResult;
|
||||
import baritone.api.pathing.goals.IGoal;
|
||||
import baritone.api.utils.BaritoneApi;
|
||||
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public interface GuiClientBlockHelper {
|
||||
Optional getOptional();
|
||||
|
||||
PathCalcResult resolvePathCalcResult(long timestampMs, long timestampMs2);
|
||||
|
||||
IGoal getGuiClientBlockPos();
|
||||
|
||||
boolean isHasGuiClientBlockPos();
|
||||
|
||||
Optional<BaritoneApi> getOptional2();
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package baritone.api.movement;
|
||||
import baritone.api.event.IGameEventListener;
|
||||
|
||||
|
||||
public interface IBehavior extends IGameEventListener {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package baritone.api.movement;
|
||||
|
||||
public interface IInputOverrideHandler extends IBehavior {
|
||||
void updateState2();
|
||||
|
||||
void handleBaritoneInput(BaritoneInput baritoneInput, boolean enabled);
|
||||
|
||||
boolean canAcceptBaritoneInput(BaritoneInput baritoneInput);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package baritone.api.movement;
|
||||
import baritone.api.utils.PlayerRotation;
|
||||
|
||||
|
||||
public interface ILookBehavior extends IBehavior {
|
||||
void handlePlayerRotation(PlayerRotation rotation, boolean enabled);
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package baritone.api.movement;
|
||||
import baritone.api.pathing.goals.IGoal;
|
||||
import baritone.api.utils.BaritoneApi;
|
||||
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public interface IPathingBehavior extends IBehavior {
|
||||
default boolean isActive4() {
|
||||
return this.getBaritoneApiEntry2() != null;
|
||||
}
|
||||
|
||||
Optional<? extends GuiClientBlockHelper> getOptional();
|
||||
|
||||
boolean isActive();
|
||||
|
||||
BaritoneApiEntry getBaritoneApiEntry();
|
||||
|
||||
default Optional<BaritoneApi> getOptional2() {
|
||||
return Optional.ofNullable(this.getBaritoneApiEntry2()).map((java.util.function.Function<baritone.api.movement.BaritoneApiEntry, baritone.api.utils.BaritoneApi>) BaritoneApiEntry::getBaritoneApi);
|
||||
}
|
||||
|
||||
BaritoneApiEntry getBaritoneApiEntry2();
|
||||
|
||||
IGoal getGuiClientBlockPos();
|
||||
|
||||
default Optional<Double> resolveOptional(boolean enabled) {
|
||||
int baritoneApi2;
|
||||
|
||||
BaritoneApiEntry baritoneApiEntry = this.getBaritoneApiEntry2();
|
||||
|
||||
if (baritoneApiEntry == null) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
label17: {
|
||||
int value = ((enabled) ? 1 : 0);
|
||||
if (((enabled) ? 1 : 0) != 0) {
|
||||
baritoneApi2 = baritoneApiEntry.getBaritoneApi2();
|
||||
break label17;
|
||||
}
|
||||
|
||||
value = baritoneApiEntry.getBaritoneApi2();
|
||||
|
||||
baritoneApi2 = value + 1;
|
||||
}
|
||||
|
||||
int value2 = baritoneApi2;
|
||||
return Optional.of(baritoneApiEntry.getBaritoneApi().resolveDistance(value2));
|
||||
}
|
||||
|
||||
void updateState2();
|
||||
|
||||
default Optional<Double> getOptional3() {
|
||||
return this.resolveOptional(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package baritone.api.movement;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public final class MovementState {
|
||||
private transient Map<BaritoneInput, Boolean> lookupMap;
|
||||
private transient MovementTarget movementTarget = new MovementTarget();
|
||||
private transient MovementStatus movementStatus;
|
||||
|
||||
public MovementState resolveMovementState(MovementTarget movementTarget) {
|
||||
this.movementTarget = movementTarget;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MovementStatus getMovementStatus() {
|
||||
return this.movementStatus;
|
||||
}
|
||||
|
||||
public MovementState resolveMovementState2(BaritoneInput baritoneInput, boolean enabled) {
|
||||
this.lookupMap.put(baritoneInput, enabled);
|
||||
return this;
|
||||
}
|
||||
|
||||
public MovementTarget getMovementTarget() {
|
||||
return this.movementTarget;
|
||||
}
|
||||
|
||||
public Map<BaritoneInput, Boolean> getLookupMap() {
|
||||
return this.lookupMap;
|
||||
}
|
||||
|
||||
public MovementState() {
|
||||
this.lookupMap = new HashMap<>();
|
||||
}
|
||||
|
||||
public MovementState resolveMovementState3(MovementStatus movementStatus) {
|
||||
this.movementStatus = movementStatus;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package baritone.api.movement;
|
||||
|
||||
public enum MovementStatus {
|
||||
@com.google.gson.annotations.SerializedName("XpM2HEd1Jg") UNREACHABLE(true),
|
||||
@com.google.gson.annotations.SerializedName("gMZV3AYRhqbSBWJxcl1LZ") WAITING(false),
|
||||
@com.google.gson.annotations.SerializedName("XpM2HEd1Jguzpujkrqgvzajwxtd") FAILED(true),
|
||||
@com.google.gson.annotations.SerializedName("gMZV3AYRhqbS") PREPPING(false),
|
||||
@com.google.gson.annotations.SerializedName("hrmikrlnmnhyj") CANCELED(true),
|
||||
@com.google.gson.annotations.SerializedName("AMwtKGfvzgdobtjmjc") SUCCESS(true),
|
||||
@com.google.gson.annotations.SerializedName("AMwtKG") RUNNING(false);
|
||||
|
||||
private transient boolean active;
|
||||
|
||||
static {
|
||||
String[] textArr = new String[]{"RUNNING", "PREPPING", "WAITING", "CANCELED", "SUCCESS", "FAILED", "UNREACHABLE"};
|
||||
}
|
||||
|
||||
public final boolean isActive() {
|
||||
return this.active;
|
||||
}
|
||||
|
||||
MovementStatus(boolean active) {
|
||||
this.active = active;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package baritone.api.movement;
|
||||
import baritone.api.utils.PlayerRotation;
|
||||
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public final class MovementTarget {
|
||||
public transient PlayerRotation playerRotation;
|
||||
private transient boolean active;
|
||||
|
||||
public MovementTarget(PlayerRotation playerRotation, boolean active) {
|
||||
this.playerRotation = playerRotation;
|
||||
this.active = active;
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
return this.active;
|
||||
}
|
||||
|
||||
public final Optional<PlayerRotation> getOptional() {
|
||||
return Optional.ofNullable(this.playerRotation);
|
||||
}
|
||||
|
||||
public MovementTarget() {
|
||||
this(null, false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package baritone.api.movement;
|
||||
|
||||
public final class MutableMoveResult {
|
||||
public transient int destX;
|
||||
public transient double cost;
|
||||
public transient int destY;
|
||||
public transient int destZ;
|
||||
|
||||
public MutableMoveResult() {
|
||||
this.resetState();
|
||||
}
|
||||
|
||||
public final void resetState() {
|
||||
this.destX = 0;
|
||||
this.destY = 0;
|
||||
this.destZ = 0;
|
||||
this.cost = 1000000.0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package baritone.api.movement;
|
||||
|
||||
import net.minecraft.world.border.WorldBorder;
|
||||
|
||||
public final class PathFavoring {
|
||||
private transient double coordVal;
|
||||
private transient double coordVal2;
|
||||
private transient double coordVal3;
|
||||
private transient double coordVal4;
|
||||
|
||||
public boolean canAcceptIndex(int value, int value2) {
|
||||
return value + 1 > this.coordVal3 && value < this.coordVal4 && value2 + 1 > this.coordVal2 && value2 < this.coordVal;
|
||||
}
|
||||
|
||||
public PathFavoring(WorldBorder worldBorder) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
this.coordVal3 = worldBorder.minX();
|
||||
this.coordVal4 = worldBorder.maxX();
|
||||
this.coordVal2 = worldBorder.minZ();
|
||||
this.coordVal = worldBorder.maxZ();
|
||||
}
|
||||
|
||||
public boolean canAcceptIndex2(int value, int value2) {
|
||||
|
||||
double amountD;
|
||||
int value3 = (amountD = value - this.coordVal3) == 0.0 ? 0 : (amountD < 0.0 ? -1 : 1);
|
||||
if (value3 > 0 && value + 1 < this.coordVal4 && value2 > this.coordVal2 && value2 + 1 < this.coordVal) {
|
||||
return true;
|
||||
}
|
||||
|
||||
value3 = 0;
|
||||
|
||||
return (((value3) & 1) != 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package baritone.api.pathing.goals;
|
||||
|
||||
import net.minecraft.util.BlockPos;
|
||||
|
||||
public interface BlockPosApiEntry {
|
||||
BlockPos getBlockPos();
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package baritone.api.pathing.goals;
|
||||
import baritone.api.utils.BaritoneBaritoneSettingsUtil;
|
||||
|
||||
|
||||
|
||||
public final class GoalAxis implements IGoal {
|
||||
private static double coordVal;
|
||||
|
||||
|
||||
static {
|
||||
coordVal = Math.sqrt(2.0) / (2.0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GoalAxis";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptIndex(int posX, int posY, int posZ) {
|
||||
|
||||
int value = posY;
|
||||
if (posY == BaritoneBaritoneSettingsUtil.getBaritoneSettings().axisHeight.value && (posX == 0 || posZ == 0 || Math.abs(posX) == Math.abs(posZ))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
value = 0;
|
||||
|
||||
return (((value) & 1) != 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double resolveDistance(int posX, int posY, int posZ) {
|
||||
int absVal = Math.abs(posX);
|
||||
int absVal2 = Math.abs(posZ);
|
||||
int minVal = Math.min(absVal, absVal2);
|
||||
int maxVal = Math.max(absVal, absVal2);
|
||||
int value = maxVal - minVal;
|
||||
double minVal2 = Math.min(absVal, Math.min(absVal2, value * coordVal));
|
||||
return minVal2 * BaritoneBaritoneSettingsUtil.getBaritoneSettings().costHeuristic.value
|
||||
+ GoalYLevelHelper.resolveDistance2(BaritoneBaritoneSettingsUtil.getBaritoneSettings().axisHeight.value, posY);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package baritone.api.pathing.goals;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public final class GoalComposite implements IGoal {
|
||||
|
||||
private transient IGoal[] goalArray;
|
||||
|
||||
|
||||
|
||||
public IGoal[] getGuiClientBlockPosArray() {
|
||||
return this.goalArray;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// $VF: Irreducible bytecode was duplicated to produce valid code
|
||||
@Override
|
||||
public double resolveDistance(int posX, int posY, int posZ) {
|
||||
|
||||
double amountD = (Double.MAX_VALUE) + 7.24523636E8;
|
||||
IGoal[] goalArray = this.goalArray;
|
||||
int length = this.goalArray.length;
|
||||
|
||||
int value = 0;
|
||||
if ((value >= length)) {
|
||||
return amountD;
|
||||
}
|
||||
|
||||
do {
|
||||
IGoal goal = goalArray[value];
|
||||
amountD = Math.min(amountD, goal.resolveDistance(posX, posY, posZ));
|
||||
} while (++value < length);
|
||||
|
||||
return amountD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GoalComposite" + Arrays.toString(this.goalArray);
|
||||
}
|
||||
|
||||
public GoalComposite(IGoal... goalArray) {
|
||||
this.goalArray = goalArray;
|
||||
}
|
||||
|
||||
// $VF: Irreducible bytecode was duplicated to produce valid code
|
||||
@Override
|
||||
public boolean canAcceptIndex(int posX, int posY, int posZ) {
|
||||
boolean enabled;
|
||||
|
||||
IGoal[] goalArray = this.goalArray;
|
||||
int length = this.goalArray.length;
|
||||
|
||||
int value = 0;
|
||||
if ((value >= length)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
IGoal goal = goalArray[value];
|
||||
enabled = goal.canAcceptIndex(posX, posY, posZ);
|
||||
|
||||
|
||||
if (enabled) {
|
||||
enabled = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (++value >= length) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return enabled;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package baritone.api.pathing.goals;
|
||||
|
||||
import baritone.pathing.GoalBlock;
|
||||
import net.minecraft.util.BlockPos;
|
||||
|
||||
public class GoalGetToBlock implements IGoal, BlockPosApiEntry {
|
||||
public transient int goalX;
|
||||
public transient int goalY;
|
||||
public transient int goalZ;
|
||||
|
||||
@Override
|
||||
public boolean canAcceptIndex(int posX, int posY, int posZ) {
|
||||
int value = posX - this.goalZ;
|
||||
|
||||
int value2 = posY - this.goalY;
|
||||
int value3 = posZ - this.goalX;
|
||||
int absVal = Math.abs(value);
|
||||
int value4 = value2;
|
||||
int value5 = absVal;
|
||||
int value6 = value5 + Math.abs(value4 < 0 ? value2 + 1 : value2) + Math.abs(value3);
|
||||
return value6 <= 1;
|
||||
}
|
||||
|
||||
public GoalGetToBlock(BlockPos pos) {
|
||||
this.goalZ = pos.getX();
|
||||
this.goalY = pos.getY();
|
||||
this.goalX = pos.getZ();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPos getBlockPos() {
|
||||
return new BlockPos(this.goalZ, this.goalY, this.goalX);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double resolveDistance(int posX, int posY, int posZ) {
|
||||
|
||||
int value = posX - this.goalZ;
|
||||
|
||||
int value2 = posY - this.goalY;
|
||||
int value3 = posZ - this.goalX;
|
||||
double amountD = value;
|
||||
int value4 = value2;
|
||||
value4 = value2 < 0 ? value2 + 1 : value2;
|
||||
|
||||
return GoalBlock.transformDistance(amountD, value4, value3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GoalGetToBlock{x=" + this.goalZ + ",y=" + this.goalY + ",z=" + this.goalX + "}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package baritone.api.pathing.goals;
|
||||
|
||||
import baritone.pathing.GoalBlock;
|
||||
import net.minecraft.util.BlockPos;
|
||||
|
||||
public final class GoalNear implements IGoal, BlockPosApiEntry {
|
||||
private transient int goalX;
|
||||
private transient int goalY;
|
||||
private transient int goalZ;
|
||||
private transient int rangeSq;
|
||||
|
||||
@Override
|
||||
public BlockPos getBlockPos() {
|
||||
return new BlockPos(this.rangeSq, this.goalZ, this.goalY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GoalNear{x=" + this.rangeSq + ", y=" + this.goalZ + ", z=" + this.goalY + ", rangeSq=" + this.goalX + "}";
|
||||
}
|
||||
|
||||
@Override
|
||||
public double resolveDistance(int posX, int posY, int posZ) {
|
||||
int value = posX - this.rangeSq;
|
||||
int value2 = posY - this.goalZ;
|
||||
int value3 = posZ - this.goalY;
|
||||
return GoalBlock.transformDistance((double)value, value2, (double)value3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptIndex(int posX, int posY, int posZ) {
|
||||
|
||||
int value = posX - this.rangeSq;
|
||||
|
||||
int value2 = posY - this.goalZ;
|
||||
int value3 = posZ - this.goalY;
|
||||
int value4 = value * value + value2 * value2 + value3 * value3;
|
||||
if (value4 <= this.goalX) {
|
||||
return true;
|
||||
}
|
||||
|
||||
value4 = 0;
|
||||
|
||||
return (((value4) & 1) != 0);
|
||||
}
|
||||
|
||||
public GoalNear(BlockPos pos, int value) {
|
||||
this.rangeSq = pos.getX();
|
||||
this.goalZ = pos.getY();
|
||||
this.goalY = pos.getZ();
|
||||
this.goalX = value * value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package baritone.api.pathing.goals;
|
||||
|
||||
import java.util.Arrays;
|
||||
import net.minecraft.util.BlockPos;
|
||||
|
||||
public class GoalRunAwayFrom implements IGoal {
|
||||
private transient double coordVal;
|
||||
private transient BlockPos[] blockPosArray;
|
||||
private transient Integer integer;
|
||||
|
||||
public GoalRunAwayFrom(double amountD, Integer integer2, BlockPos... posArr) {
|
||||
if (posArr.length == 0) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
this.blockPosArray = posArr;
|
||||
this.coordVal = amountD * amountD;
|
||||
this.integer = integer2;
|
||||
}
|
||||
|
||||
public GoalRunAwayFrom(double amountD, BlockPos... posArr2) {
|
||||
this(amountD, null, posArr2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.integer != null
|
||||
? "GoalRunAwayFromMaintainY y=" + this.integer + ", " + Arrays.<BlockPos>asList(this.blockPosArray)
|
||||
: "GoalRunAwayFrom" + Arrays.<BlockPos>asList(this.blockPosArray);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptIndex(int posX, int posY, int posZ) {
|
||||
if (this.integer != null && this.integer != posY) {
|
||||
return false;
|
||||
}
|
||||
|
||||
BlockPos[] posArr3 = this.blockPosArray;
|
||||
int length = this.blockPosArray.length;
|
||||
|
||||
for (int idx = 0; idx < length; idx++) {
|
||||
BlockPos pos = posArr3[idx];
|
||||
int deltaX = posX - pos.getX();
|
||||
int deltaZ = posZ - pos.getZ();
|
||||
double amountD = deltaX * deltaX + deltaZ * deltaZ;
|
||||
if (amountD < this.coordVal) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double resolveDistance(int posX, int posY, int posZ) {
|
||||
|
||||
double amountD = (Double.MAX_VALUE) - 1.967933436E9;
|
||||
BlockPos[] posArr4 = this.blockPosArray;
|
||||
int length = this.blockPosArray.length;
|
||||
|
||||
for (int idx = 0; idx < length; idx++) {
|
||||
BlockPos pos2 = posArr4[idx];
|
||||
double amountD2 = GoalXZ.transformDistance(pos2.getX() - posX, pos2.getZ() - posZ);
|
||||
if (amountD2 < amountD) {
|
||||
amountD = amountD2;
|
||||
}
|
||||
}
|
||||
|
||||
amountD = -amountD;
|
||||
if (this.integer != null) {
|
||||
amountD = amountD * (0.6) + GoalYLevelHelper.resolveDistance2(this.integer, posY) * (1.5);
|
||||
}
|
||||
|
||||
return amountD;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package baritone.api.pathing.goals;
|
||||
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
public final class GoalStrictDirectHelper implements IGoal {
|
||||
public transient int frontOffsetZ;
|
||||
public transient int frontOffsetX;
|
||||
public transient int posY;
|
||||
public transient int posX;
|
||||
public transient int posZ;
|
||||
|
||||
@Override
|
||||
public double resolveDistance(int posX, int posY, int posZ) {
|
||||
int value = (posX - this.posX) * this.frontOffsetX + (posZ - this.posZ) * this.frontOffsetZ;
|
||||
int value2 = Math.abs((posX - this.posX) * this.frontOffsetZ) + Math.abs((posZ - this.posZ) * this.frontOffsetX);
|
||||
int absDeltaY = Math.abs(posY - this.posY);
|
||||
double amountD = -value * 100;
|
||||
amountD += value2 * 1000;
|
||||
return amountD + absDeltaY * 1000;
|
||||
}
|
||||
|
||||
public GoalStrictDirectHelper(BlockPos pos, EnumFacing enumFacing) {
|
||||
|
||||
this.posX = pos.getX();
|
||||
this.posY = pos.getY();
|
||||
this.posZ = pos.getZ();
|
||||
|
||||
this.frontOffsetX = enumFacing.getFrontOffsetX();
|
||||
this.frontOffsetZ = enumFacing.getFrontOffsetZ();
|
||||
int frontOffsetX = this.frontOffsetX;
|
||||
if (this.frontOffsetX != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
frontOffsetX = this.frontOffsetZ;
|
||||
|
||||
if (frontOffsetX == 0) {
|
||||
throw new IllegalArgumentException("" + enumFacing);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptIndex(int posX, int posY, int posZ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GoalStrictDirection{x="
|
||||
+ this.posX
|
||||
+ ", y="
|
||||
+ this.posY
|
||||
+ ", z="
|
||||
+ this.posZ
|
||||
+ ", dx="
|
||||
+ this.frontOffsetX
|
||||
+ ", dz="
|
||||
+ this.frontOffsetZ
|
||||
+ "}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package baritone.api.pathing.goals;
|
||||
|
||||
import baritone.pathing.GoalBlock;
|
||||
import net.minecraft.util.BlockPos;
|
||||
|
||||
public class GoalTwoBlocks implements BlockPosApiEntry, IGoal {
|
||||
public transient int offsetPx;
|
||||
public transient int offsetPx2;
|
||||
public transient int offsetPx3;
|
||||
|
||||
@Override
|
||||
public boolean canAcceptIndex(int posX, int posY, int posZ) {
|
||||
|
||||
int value = posX;
|
||||
if (posX == this.offsetPx3 && (posY == this.offsetPx2 || posY == this.offsetPx2 - 1) && posZ == this.offsetPx) {
|
||||
return true;
|
||||
}
|
||||
|
||||
value = 0;
|
||||
|
||||
return (((value) & 1) != 0);
|
||||
}
|
||||
|
||||
public GoalTwoBlocks(int offsetPx3, int offsetPx2, int offsetPx) {
|
||||
this.offsetPx3 = offsetPx3;
|
||||
this.offsetPx2 = offsetPx2;
|
||||
this.offsetPx = offsetPx;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double resolveDistance(int posX, int posY, int posZ) {
|
||||
int value = posX - this.offsetPx3;
|
||||
|
||||
int value2 = posY - this.offsetPx2;
|
||||
|
||||
int value3 = posZ - this.offsetPx;
|
||||
double amountD = value;
|
||||
int value4 = value2;
|
||||
value4 = value2 < 0 ? value2 + 1 : value2;
|
||||
|
||||
return GoalBlock.transformDistance(amountD, value4, value3);
|
||||
}
|
||||
|
||||
public GoalTwoBlocks(BlockPos pos) {
|
||||
this(pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPos getBlockPos() {
|
||||
return new BlockPos(this.offsetPx3, this.offsetPx2, this.offsetPx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GoalTwoBlocks{x=" + this.offsetPx3 + ",y=" + this.offsetPx2 + ",z=" + this.offsetPx + "}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package baritone.api.pathing.goals;
|
||||
import baritone.api.utils.BaritoneBaritoneSettingsUtil;
|
||||
import intent.zeroday.util.MathHelperExt;
|
||||
|
||||
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
public class GoalXZ implements IGoal {
|
||||
private transient int goalX;
|
||||
private transient int goalZ;
|
||||
private static double coordVal = Math.sqrt(2.0);
|
||||
|
||||
@Override
|
||||
public boolean canAcceptIndex(int posX, int posY, int posZ) {
|
||||
|
||||
int value = posX;
|
||||
if (posX == this.goalX && posZ == this.goalZ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
value = 0;
|
||||
|
||||
return (((value) & 1) != 0);
|
||||
}
|
||||
|
||||
public static final double transformDistance(double amountD, double amountD2) {
|
||||
double amountD3;
|
||||
double amountD4;
|
||||
label14: {
|
||||
|
||||
double absVal = Math.abs(amountD);
|
||||
|
||||
double absVal2 = Math.abs(amountD2);
|
||||
double amountD5 = absVal;
|
||||
double amountD6 = absVal2;
|
||||
if (absVal < absVal2) {
|
||||
amountD3 = absVal2 - absVal;
|
||||
amountD4 = absVal;
|
||||
break label14;
|
||||
}
|
||||
|
||||
amountD5 = absVal;
|
||||
amountD6 = absVal2;
|
||||
|
||||
amountD3 = amountD5 - amountD6;
|
||||
amountD4 = absVal2;
|
||||
}
|
||||
|
||||
amountD4 *= coordVal;
|
||||
return (amountD4 + amountD3) * BaritoneBaritoneSettingsUtil.getBaritoneSettings().costHeuristic.value;
|
||||
}
|
||||
|
||||
public static final GoalXZ resolveGoalXZ(Vec3 vec, float amountF, double amountD) {
|
||||
float radians = (float)Math.toRadians(amountF);
|
||||
double amountD2 = vec.xCoord - MathHelperExt.transformAngle6(radians) * amountD;
|
||||
double amountD3 = vec.zCoord + MathHelperExt.transformAngle(radians) * amountD;
|
||||
return new GoalXZ((int)amountD2, (int)amountD3);
|
||||
}
|
||||
|
||||
public int getGoalX() {
|
||||
return this.goalX;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double resolveDistance(int posX, int posY, int posZ) {
|
||||
int value = posX - this.goalX;
|
||||
int value2 = posZ - this.goalZ;
|
||||
return transformDistance(value, value2);
|
||||
}
|
||||
|
||||
public GoalXZ(int goalX, int goalZ) {
|
||||
this.goalX = goalX;
|
||||
this.goalZ = goalZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GoalXZ{x=" + this.goalX + ",z=" + this.goalZ + "}";
|
||||
}
|
||||
|
||||
public int getGoalZ() {
|
||||
return this.goalZ;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package baritone.api.pathing.goals;
|
||||
import baritone.api.movement.ActionCostValues;
|
||||
|
||||
|
||||
|
||||
public final class GoalYLevelHelper implements ActionCostValues, IGoal {
|
||||
public transient int count;
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canAcceptIndex(int posX, int posY, int posZ) {
|
||||
|
||||
int value = posY;
|
||||
if (posY == this.count) {
|
||||
return true;
|
||||
}
|
||||
|
||||
value = 0;
|
||||
|
||||
return (((value) & 1) != 0);
|
||||
}
|
||||
|
||||
public GoalYLevelHelper(int count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public static final double resolveDistance2(int value, int value2) {
|
||||
|
||||
|
||||
int value3 = value;
|
||||
int value4 = value2;
|
||||
if (value4 > value3) {
|
||||
return doubleValueArray[2] / (2.0) * (value2 - value);
|
||||
}
|
||||
|
||||
int value5 = value;
|
||||
int value6 = value2;
|
||||
return value6 < value5 ? (value - value2) * coordVal14 : 0.0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GoalYLevel{y=" + this.count + "}";
|
||||
}
|
||||
|
||||
@Override
|
||||
public double resolveDistance(int posX, int posY, int posZ) {
|
||||
return resolveDistance2(this.count, posY);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package baritone.api.pathing.goals;
|
||||
|
||||
import net.minecraft.util.BlockPos;
|
||||
|
||||
public interface IGoal {
|
||||
default boolean canAcceptBlockPos(BlockPos pos) {
|
||||
return this.canAcceptIndex(pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
boolean canAcceptIndex(int posX, int posY, int posZ);
|
||||
|
||||
default double resolveDistance3(BlockPos pos2) {
|
||||
return this.resolveDistance(pos2.getX(), pos2.getY(), pos2.getZ());
|
||||
}
|
||||
|
||||
double resolveDistance(int posX, int posY, int posZ);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package baritone.api.process;
|
||||
import baritone.api.pathing.goals.IGoal;
|
||||
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class GuiClientBlockUtil {
|
||||
public transient IGoal goal;
|
||||
public transient PathingCommandType pathingCommandType;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.pathingCommandType + " " + this.goal;
|
||||
}
|
||||
|
||||
public GuiClientBlockUtil(IGoal goal, PathingCommandType pathingCommandType) {
|
||||
Objects.requireNonNull(pathingCommandType);
|
||||
this.goal = goal;
|
||||
this.pathingCommandType = pathingCommandType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package baritone.api.process;
|
||||
|
||||
|
||||
public interface IBaritoneProcess {
|
||||
double coordVal = -1.0;
|
||||
String d = "INACTIVE";
|
||||
|
||||
boolean isActive2();
|
||||
|
||||
String getString();
|
||||
|
||||
default String getString2() {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
IBaritoneProcess inactiveApi = this;
|
||||
if (!this.isActive2()) {
|
||||
return d;
|
||||
}
|
||||
|
||||
inactiveApi = this;
|
||||
|
||||
return inactiveApi.getString();
|
||||
}
|
||||
|
||||
void resetState();
|
||||
|
||||
GuiClientBlockUtil resolveGuiClientBlockUtil(boolean enabled, boolean enabled2);
|
||||
|
||||
default double getDistance() {
|
||||
return -1.0;
|
||||
}
|
||||
|
||||
boolean isActive();
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package baritone.api.process;
|
||||
import intent.zeroday.util.EnumFacingAxisApi;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.Vec3i;
|
||||
|
||||
public interface IBuilderProcess extends IBaritoneProcess {
|
||||
String e = "schematics";
|
||||
|
||||
void resetState3();
|
||||
|
||||
void handleString(String str, EnumFacingAxisApi enumFacingAxisApi, Vec3i vec3i);
|
||||
|
||||
boolean canAcceptString(String str, File file, Vec3i vec3i2);
|
||||
|
||||
default boolean canAcceptString2(String str, BlockPos pos) {
|
||||
|
||||
|
||||
File file2 = new File(new File(Minecraft.getMinecraft().mcDataDir, e), str);
|
||||
return this.canAcceptString(str, file2, pos);
|
||||
}
|
||||
|
||||
void handleBlockPos(BlockPos pos2, BlockPos pos3);
|
||||
|
||||
void resetState2();
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package baritone.api.process;
|
||||
import baritone.api.pathing.goals.IGoal;
|
||||
|
||||
|
||||
public interface ICustomGoalProcess extends IBaritoneProcess {
|
||||
void updateGoal(IGoal goal);
|
||||
|
||||
void resetState2();
|
||||
|
||||
IGoal getGuiClientBlockPos();
|
||||
|
||||
default void updateGoal2(IGoal goal) {
|
||||
this.updateGoal(goal);
|
||||
this.resetState2();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package baritone.api.process;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
public interface IExploreProcess extends IBaritoneProcess {
|
||||
void handlePath(Path path, boolean enabled) throws Exception;
|
||||
|
||||
void handleIndex2(int value, int value2);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package baritone.api.process;
|
||||
|
||||
import net.minecraft.util.BlockPos;
|
||||
|
||||
public interface IFarmProcess extends IBaritoneProcess {
|
||||
void handleBlockPos(BlockPos pos, BlockPos pos2);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package baritone.api.process;
|
||||
|
||||
import net.minecraft.util.BlockPos;
|
||||
|
||||
public interface IFishProcess extends IBaritoneProcess {
|
||||
void handleBlockPos(BlockPos pos, BlockPos pos2);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package baritone.api.process;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public interface IFollowProcess extends IBaritoneProcess {
|
||||
Predicate<Entity> getPredicate();
|
||||
|
||||
default void updateState2() {
|
||||
this.resetState();
|
||||
}
|
||||
|
||||
void setPredicate(Predicate<Entity> predicate);
|
||||
|
||||
List<Entity> getPredicate2();
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package baritone.api.process;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public interface IGetToBlockProcess extends IBaritoneProcess {
|
||||
boolean isActive4();
|
||||
|
||||
void updateBlockArray(Block... blockArr);
|
||||
|
||||
boolean isActive3();
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package baritone.api.process;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public interface IMineProcess extends IBaritoneProcess {
|
||||
default void updateStringArray(String... textArr) {
|
||||
|
||||
|
||||
this.handleIndex(0, textArr);
|
||||
}
|
||||
|
||||
default void updateBlockArray(Block... blockArr) {
|
||||
|
||||
|
||||
this.handleIndex2(0, blockArr);
|
||||
}
|
||||
|
||||
void handleIndex2(int value, Block... blockArr2);
|
||||
|
||||
void handleIndex(int value, String... textArr2);
|
||||
|
||||
default void updateState2() {
|
||||
this.resetState();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package baritone.api.process;
|
||||
|
||||
public enum PathingCommandType {
|
||||
@com.google.gson.annotations.SerializedName("XpM2HEd1Jg") FORCE_REVALIDATE_GOAL_AND_PATH,
|
||||
@com.google.gson.annotations.SerializedName("AMwtKGfvzgdobtjmjc") REVALIDATE_GOAL_AND_PATH,
|
||||
@com.google.gson.annotations.SerializedName("gMZV3AYRhqbSBWJxcl1LZ") REQUEST_PAUSE,
|
||||
@com.google.gson.annotations.SerializedName("XpM2HEd1Jguzpujkrqgvzajwxtd") DEFER,
|
||||
@com.google.gson.annotations.SerializedName("AMwtKG") CANCEL_AND_SET_GOAL,
|
||||
@com.google.gson.annotations.SerializedName("gMZV3AYRhqbS") SET_GOAL_AND_PATH;
|
||||
|
||||
static {
|
||||
String[] textArr = new String[]{
|
||||
"FORCE_REVALIDATE_GOAL_AND_PATH", "REVALIDATE_GOAL_AND_PATH", "REQUEST_PAUSE", "SET_GOAL_AND_PATH", "CANCEL_AND_SET_GOAL", "DEFER"
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package baritone.api.utils;
|
||||
import baritone.api.movement.BaritoneApiHelper;
|
||||
import baritone.api.pathing.goals.IGoal;
|
||||
|
||||
|
||||
import baritone.api.utils.BetterBlockPos;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface BaritoneApi {
|
||||
Map f = new HashMap(13);
|
||||
String[] e = new String[6];
|
||||
String[] d = new String[]{
|
||||
"\u00e7Z\u00df\"\u0002\u00b4\u00c0Y\u009aa\u00bf@\u00a0\u00be)v\u0012\"1\u0089\u00c2{NG\u00a4>\u00c5\u00b3\u00fb\u00a2\\\u00d5)\u00f5g\u00808\u00c8\u00ff\u00fc\u0093~s\u00b7Q\u00bbz1%\u00f7\u0083\f\u00aa-9\u0088g\u00eb\u00ea=\t\u00c5\u00cfV",
|
||||
"\u00ef\u00da\u001b\u00b4_psj\u0085\u0095\u00ce\r\u000e\u00f0%\u00b2x4\u009d\u0095\u001fU\u00a9\u0095(S\u00f9\u0006\u00dc%\u008a\u00df.\u0085%,S\u0005u>\u00cdP\u00a8\u00a9\u00ba\u009ey\u00ae",
|
||||
"1\u00b7\b\u00c4$\r\u00ce\u001a\u00ea\u00b4\u0086\u008e\u0080\u0014\u008c\u0090K\u00cd\u0082\u00e0\u0014\u00f56\u001aIb\u00ea;\u00d7\u00f6\u00c3\u00ae\u00d7\u001a\u0015\u0004\u00fc\u00df\u0012\u00c4\u0002\b\u0018r\u009c78\u00da",
|
||||
"!\u00a0@\u00a1%\u00c8~jJg5\u00a3\u009e\u00f59\u00de\u00f0\u001cr\u00f1\u00eaZ_\u00cd\u00a6\u0088\u00daI\u00ca7\u0083W\u0096\u0083\u00f13\u00e12\u00cdM\f\u00bb\u00fd\u0095\u0085\u009c\u00dfy",
|
||||
"\b\u0086}\u00c6\u009f.m\u00b2\u0095\u008b\u008b\u00a5\u008b\u0081\u00fc\u00ab{fT\u0017\t\u00a2\u00a6:\u007f\u007f\u00b2\u00eeo,\u00ee(\u00bb\u0083\u00b0\u00ff s\u00e60\u008e\u0019\u0083\u0015Q+\u00f8W",
|
||||
"@\u001e\u008e\u0094\u0087l\u0003\u00a6h\u0093V>D\u0007\u00ea\u0003\u0086\u00c3X\u007f\u00a1\u00df*_a\u00c0r'd\u0019F}wV\u00f3\u0097\u00db\u00b7\u00e3w"
|
||||
};
|
||||
|
||||
int getCount();
|
||||
|
||||
default int getIndex() {
|
||||
return this.getList2().size();
|
||||
}
|
||||
|
||||
default BetterBlockPos getBetterBlockPos() {
|
||||
return this.getList2().get(0);
|
||||
}
|
||||
|
||||
default void updateState() {
|
||||
|
||||
|
||||
List list = this.getList2();
|
||||
List list2 = this.getList();
|
||||
boolean enabled = this.getBetterBlockPos().equals(list.get(0));
|
||||
if (!enabled) {
|
||||
throw new IllegalStateException("Start node does not equal first path element");
|
||||
}
|
||||
|
||||
boolean enabled2 = this.getBetterBlockPos2().equals(list.get(list.size() - 1));
|
||||
if (!enabled2) {
|
||||
throw new IllegalStateException("End node does not equal last path element");
|
||||
}
|
||||
|
||||
if (list.size() != list2.size() + 1) {
|
||||
throw new IllegalStateException("Size of path array is unexpected");
|
||||
}
|
||||
|
||||
HashSet set = new HashSet();
|
||||
|
||||
for (int idx = 0; idx < list.size() - 1; idx++) {
|
||||
BetterBlockPos pos = (BetterBlockPos)list.get(idx);
|
||||
BetterBlockPos pos2 = (BetterBlockPos)list.get(idx + 1);
|
||||
BaritoneApiHelper baritoneApiHelper = (BaritoneApiHelper)list2.get(idx);
|
||||
boolean enabled3 = pos.equals(baritoneApiHelper.getBetterBlockPos());
|
||||
if (!enabled3) {
|
||||
throw new IllegalStateException("Path source is not equal to the movement source");
|
||||
}
|
||||
|
||||
boolean enabled4 = pos2.equals(baritoneApiHelper.getBetterBlockPos3());
|
||||
if (!enabled4) {
|
||||
throw new IllegalStateException("Path destination is not equal to the movement destination");
|
||||
}
|
||||
|
||||
boolean enabled5 = set.contains(pos);
|
||||
if (enabled5) {
|
||||
throw new IllegalStateException("Path doubles back on itself, making a loop");
|
||||
}
|
||||
|
||||
set.add(pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
IGoal getGuiClientBlockPos();
|
||||
|
||||
|
||||
|
||||
List<BaritoneApiHelper> getList();
|
||||
|
||||
default BetterBlockPos getBetterBlockPos2() {
|
||||
List list3 = this.getList2();
|
||||
return (BetterBlockPos)list3.get(list3.size() - 1);
|
||||
}
|
||||
|
||||
List<BetterBlockPos> getList2();
|
||||
|
||||
default double resolveDistance(int value) {
|
||||
double amountD = 0.0;
|
||||
List list4 = this.getList();
|
||||
|
||||
for (int idx = value; idx < list4.size(); idx++) {
|
||||
amountD += ((BaritoneApiHelper)list4.get(idx)).getDistance();
|
||||
}
|
||||
|
||||
return amountD;
|
||||
}
|
||||
|
||||
default BaritoneApi resolveBaritoneApi(Object target) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
default BaritoneApi getBaritoneApi() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
default BaritoneApi resolveBaritoneApi2(IGoal goal) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package baritone.api.utils;
|
||||
|
||||
import java.util.List;
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
|
||||
public interface BaritoneApiUtilApi {
|
||||
List resolveList(IPlayerContext playerContext, List list, ChunkCoordIntPair chunkCoordIntPair, int value, int value2);
|
||||
|
||||
List resolveList2(IPlayerContext playerContext, List list2, int posX, int posY, int posZ);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package baritone.api.utils;
|
||||
import baritone.api.movement.IBehavior;
|
||||
|
||||
|
||||
import baritone.pathing.BaritoneCore;
|
||||
|
||||
public class BaritoneBaritoneApiUtil implements IBehavior {
|
||||
public transient IPlayerContext playerContext;
|
||||
public transient BaritoneCore baritoneCore;
|
||||
|
||||
public BaritoneBaritoneApiUtil(BaritoneCore baritoneCore) {
|
||||
this.baritoneCore = baritoneCore;
|
||||
this.playerContext = baritoneCore.getBaritoneApiUtil();
|
||||
baritoneCore.updateBaritoneBaritoneApiUtil(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package baritone.api.utils;
|
||||
import intent.zeroday.ui.component.GuiZeroEntityPlayer;
|
||||
|
||||
|
||||
import baritone.api.BaritoneSettings;
|
||||
import baritone.pathing.SettingsUtil;
|
||||
|
||||
public final class BaritoneBaritoneSettingsUtil {
|
||||
private static BaritoneSettings baritoneSettings;
|
||||
private static GuiZeroEntityPlayer guiZeroEntityPlayer = new BaritoneProviderImpl();
|
||||
|
||||
public static final BaritoneSettings getBaritoneSettings() {
|
||||
return baritoneSettings;
|
||||
}
|
||||
|
||||
static {
|
||||
|
||||
|
||||
baritoneSettings = new BaritoneSettings();
|
||||
SettingsUtil.writeBaritoneSettings3(baritoneSettings);
|
||||
}
|
||||
|
||||
public static final GuiZeroEntityPlayer getGuiZeroEntityPlayer() {
|
||||
return guiZeroEntityPlayer;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
package baritone.api.utils;
|
||||
import baritone.api.movement.BaritoneApiHelper;
|
||||
import baritone.api.movement.CalculationContext;
|
||||
import baritone.api.pathing.goals.IGoal;
|
||||
|
||||
|
||||
import baritone.api.utils.BetterBlockPos;
|
||||
import baritone.pathing.Moves;
|
||||
import baritone.pathing.BaritoneHelperCore;
|
||||
import baritone.pathing.MovementBase;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public final class BaritoneBetterBlockPos extends BaritoneHelper {
|
||||
|
||||
private transient List<BetterBlockPos> entries;
|
||||
private transient CalculationContext calculationContext;
|
||||
private transient IGoal goal;
|
||||
private transient BetterBlockPos betterBlockPos;
|
||||
private transient BetterBlockPos betterBlockPos2;
|
||||
private transient int count;
|
||||
private transient volatile boolean active;
|
||||
private transient List<BaritoneHelperUtil> entries2;
|
||||
private transient List<MovementBase> entries3;
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return this.count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BetterBlockPos getBetterBlockPos2() {
|
||||
return this.betterBlockPos2;
|
||||
}
|
||||
|
||||
private void updateMovementBase(MovementBase movementBase) {
|
||||
movementBase.updateCalculationContext(this.calculationContext);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public IGoal getGuiClientBlockPos() {
|
||||
return this.goal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaritoneApi getBaritoneApi() {
|
||||
|
||||
|
||||
|
||||
if (this.active) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
this.active = true;
|
||||
boolean active = this.isActive();
|
||||
this.entries3.forEach((java.util.function.Consumer<baritone.pathing.MovementBase>) this::updateMovementBase);
|
||||
if (active) {
|
||||
BaritoneHelperEntry baritoneHelperEntry = new BaritoneHelperEntry(this, this.getList().size());
|
||||
if (baritoneHelperEntry.getList().size() != this.entries3.size()) {
|
||||
throw new IllegalStateException();
|
||||
} else {
|
||||
return baritoneHelperEntry;
|
||||
}
|
||||
} else {
|
||||
this.updateState();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public BaritoneBetterBlockPos(BaritoneHelperUtil baritoneHelperUtil2, BaritoneHelperUtil baritoneHelperUtil3, int count, IGoal goal, CalculationContext calculationContext) {
|
||||
this.betterBlockPos = new BetterBlockPos(baritoneHelperUtil2.count, baritoneHelperUtil2.count3, baritoneHelperUtil2.count2);
|
||||
this.betterBlockPos2 = new BetterBlockPos(baritoneHelperUtil3.count, baritoneHelperUtil3.count3, baritoneHelperUtil3.count2);
|
||||
this.count = count;
|
||||
this.entries = new ArrayList<>();
|
||||
this.entries3 = new ArrayList<>();
|
||||
this.entries2 = new ArrayList<>();
|
||||
this.goal = goal;
|
||||
this.calculationContext = calculationContext;
|
||||
this.updateBaritoneHelperUtil(baritoneHelperUtil3);
|
||||
}
|
||||
|
||||
// $VF: Irreducible bytecode was duplicated to produce valid code
|
||||
private boolean isActive() {
|
||||
|
||||
|
||||
|
||||
byte byteData = ((byte) ((this.entries.isEmpty()) ? 1 : 0));
|
||||
byte byteData2;
|
||||
if (byteData != 0) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
byteData2 = ((byte) ((this.entries3.isEmpty()) ? 1 : 0));
|
||||
|
||||
byte byteData3 = byteData2;
|
||||
if (byteData3 == 0) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
byteData2 = 0;
|
||||
|
||||
int value = byteData2;
|
||||
if ((value >= this.entries.size() - 1)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
do {
|
||||
double amountD = this.entries2.get(value + 1).coordVal2 - this.entries2.get(value).coordVal2;
|
||||
MovementBase movementBase = this.resolveMovementBase(this.entries.get(value), this.entries.get(value + 1), amountD);
|
||||
if (movementBase == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
this.entries3.add(movementBase);
|
||||
} while (++value < this.entries.size() - 1);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BetterBlockPos> getList2() {
|
||||
return Collections.unmodifiableList(this.entries);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public BetterBlockPos getBetterBlockPos() {
|
||||
return this.betterBlockPos;
|
||||
}
|
||||
|
||||
private MovementBase resolveMovementBase(BetterBlockPos pos, BetterBlockPos pos2, double amountD) {
|
||||
|
||||
|
||||
|
||||
Moves[] movesArray;
|
||||
int length = (movesArray = Moves.values()).length;
|
||||
|
||||
for (int idx = 0; idx < length; idx++) {
|
||||
Moves moves = movesArray[idx];
|
||||
MovementBase movementBase = moves.resolveMovementBase(this.calculationContext, pos);
|
||||
if (movementBase.getBetterBlockPos3().equals(pos2)) {
|
||||
movementBase.updateDistance(Math.min(movementBase.resolveDistance4(this.calculationContext), amountD));
|
||||
return movementBase;
|
||||
}
|
||||
}
|
||||
|
||||
BaritoneHelperCore.a_.updateString("Movement became impossible during calculation " + pos + " " + pos2 + " " + pos2.subtract(pos));
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BaritoneApiHelper> getList() {
|
||||
if (!this.active) {
|
||||
throw new IllegalStateException();
|
||||
} else {
|
||||
return Collections.unmodifiableList(this.entries3);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateBaritoneHelperUtil(BaritoneHelperUtil baritoneHelperUtil4) {
|
||||
if (this.entries.isEmpty() && this.entries3.isEmpty()) {
|
||||
BaritoneHelperUtil baritoneHelperUtil5 = baritoneHelperUtil4;
|
||||
LinkedList list = new LinkedList();
|
||||
LinkedList list2 = new LinkedList();
|
||||
|
||||
while (baritoneHelperUtil5 != null) {
|
||||
list2.addFirst(baritoneHelperUtil5);
|
||||
list.addFirst(new BetterBlockPos(baritoneHelperUtil5.count, baritoneHelperUtil5.count3, baritoneHelperUtil5.count2));
|
||||
baritoneHelperUtil5 = baritoneHelperUtil5.baritoneHelperUtil;
|
||||
}
|
||||
|
||||
this.entries.addAll(list);
|
||||
this.entries2.addAll(list2);
|
||||
} else {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,413 @@
|
||||
package baritone.api.utils;
|
||||
import intent.zeroday.util.BitSetHelper;
|
||||
import intent.zeroday.util.BlockUtilHelper;
|
||||
import intent.zeroday.util.IBlockStateHelper;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import baritone.pathing.BaritoneCore;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.LinkOption;
|
||||
import java.nio.file.attribute.FileAttribute;
|
||||
import java.util.BitSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public final class BaritoneBitSetHelper implements IBlockStateHelper {
|
||||
private static int count;
|
||||
private transient boolean hasPosY;
|
||||
private static byte stateByte;
|
||||
private transient int count2;
|
||||
private transient int count3;
|
||||
private transient BitSetHelper[][] bitSetHelperArray = new BitSetHelper[32][32];
|
||||
private static byte stateByte2;
|
||||
private transient int count4;
|
||||
|
||||
public final synchronized void syncStorage() {
|
||||
|
||||
long value = BaritoneCore.getBaritoneSettings().cachedChunksExpirySeconds.value;
|
||||
if (value >= 0L) {
|
||||
long timeMs = System.currentTimeMillis();
|
||||
long timestampMs = timeMs - value * 1000L;
|
||||
|
||||
for (int idx = 0; idx < 32; idx++) {
|
||||
for (int idx2 = 0; idx2 < 32; idx2++) {
|
||||
if (this.bitSetHelperArray[idx][idx2] != null && this.bitSetHelperArray[idx][idx2].lastTimeMs < timestampMs) {
|
||||
System.out
|
||||
.println(
|
||||
"Removing chunk "
|
||||
+ (idx + 32 * this.count2)
|
||||
+ ","
|
||||
+ (idx2 + 32 * this.count3)
|
||||
+ " because it was cached "
|
||||
+ (timeMs - this.bitSetHelperArray[idx][idx2].lastTimeMs) / 1000L
|
||||
+ " seconds ago, and max age is "
|
||||
+ value
|
||||
);
|
||||
this.bitSetHelperArray[idx][idx2] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final synchronized void writeString(String str) {
|
||||
if (!this.hasPosY) {
|
||||
return;
|
||||
}
|
||||
this.syncStorage();
|
||||
try {
|
||||
Path path = Paths.get(str, new String[0]);
|
||||
if (!Files.exists(path, new LinkOption[0])) {
|
||||
Files.createDirectories(path, new FileAttribute[0]);
|
||||
}
|
||||
System.out.println("Saving region " + this.count2 + "," + this.count3 + " to disk " + path);
|
||||
Path path2 = BaritoneBitSetHelper.transformPath(path, this.count2, this.count3);
|
||||
if (!Files.exists(path2, new LinkOption[0])) {
|
||||
Files.createFile(path2, new FileAttribute[0]);
|
||||
}
|
||||
Throwable throwable = null;
|
||||
Object target = null;
|
||||
try {
|
||||
Object target2;
|
||||
int value;
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(path2.toFile());
|
||||
GZIPOutputStream gZIPOutputStream = new GZIPOutputStream((OutputStream)fileOutputStream, 16384);
|
||||
DataOutputStream dataOutputStream = new DataOutputStream(gZIPOutputStream);
|
||||
dataOutputStream.writeInt(456022910);
|
||||
int value2 = 0;
|
||||
while (value2 < 32) {
|
||||
value = 0;
|
||||
while (value < 32) {
|
||||
target2 = this.bitSetHelperArray[value2][value];
|
||||
if (target2 == null) {
|
||||
dataOutputStream.write(0);
|
||||
} else {
|
||||
dataOutputStream.write(1);
|
||||
byte[] byteArray = ((BitSetHelper)target2).getByteArray();
|
||||
dataOutputStream.write(byteArray);
|
||||
dataOutputStream.write(new byte[16384 - byteArray.length]);
|
||||
}
|
||||
++value;
|
||||
}
|
||||
++value2;
|
||||
}
|
||||
value2 = 0;
|
||||
while (value2 < 32) {
|
||||
value = 0;
|
||||
while (value < 32) {
|
||||
if (this.bitSetHelperArray[value2][value] != null) {
|
||||
int value3 = 0;
|
||||
while (value3 < 256) {
|
||||
dataOutputStream.writeUTF(BlockUtilHelper.resolveString((Block)this.bitSetHelperArray[value2][value].getIBlockStateArray()[value3].getBlock()));
|
||||
++value3;
|
||||
}
|
||||
}
|
||||
++value;
|
||||
}
|
||||
++value2;
|
||||
}
|
||||
value2 = 0;
|
||||
while (value2 < 32) {
|
||||
value = 0;
|
||||
while (value < 32) {
|
||||
if (this.bitSetHelperArray[value2][value] != null) {
|
||||
Map<?, ?> regionMap = this.bitSetHelperArray[value2][value].getLookupMap();
|
||||
dataOutputStream.writeShort(regionMap.entrySet().size());
|
||||
for (Map.Entry<?, ?> mapEntry : regionMap.entrySet()) {
|
||||
dataOutputStream.writeUTF((String)mapEntry.getKey());
|
||||
dataOutputStream.writeShort(((List<?>)mapEntry.getValue()).size());
|
||||
for (Object posObj : (List<?>)mapEntry.getValue()) {
|
||||
BlockPos blockPos = (BlockPos)posObj;
|
||||
dataOutputStream.writeByte((byte)(blockPos.getZ() << 4 | blockPos.getX()));
|
||||
dataOutputStream.writeByte((byte)blockPos.getY());
|
||||
}
|
||||
}
|
||||
}
|
||||
++value;
|
||||
}
|
||||
++value2;
|
||||
}
|
||||
value2 = 0;
|
||||
while (value2 < 32) {
|
||||
value = 0;
|
||||
while (value < 32) {
|
||||
if (this.bitSetHelperArray[value2][value] != null) {
|
||||
dataOutputStream.writeLong(this.bitSetHelperArray[value2][value].lastTimeMs);
|
||||
}
|
||||
++value;
|
||||
}
|
||||
++value2;
|
||||
}
|
||||
if (dataOutputStream != null) {
|
||||
dataOutputStream.close();
|
||||
}
|
||||
if (gZIPOutputStream != null) {
|
||||
gZIPOutputStream.close();
|
||||
}
|
||||
if (fileOutputStream != null) {
|
||||
fileOutputStream.close();
|
||||
}
|
||||
}
|
||||
catch (Throwable throwable2) {
|
||||
if (throwable == null) {
|
||||
throwable = throwable2;
|
||||
} else if (throwable != throwable2) {
|
||||
throwable.addSuppressed(throwable2);
|
||||
}
|
||||
if (throwable instanceof Exception) throw (Exception)throwable;
|
||||
if (throwable instanceof Error) throw (Error)throwable;
|
||||
throw new RuntimeException(throwable);
|
||||
}
|
||||
this.hasPosY = false;
|
||||
System.out.println("Saved region successfully");
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean canAcceptIndex(int value, int value2) {
|
||||
return this.bitSetHelperArray[value >> 4][value2 >> 4] != null;
|
||||
}
|
||||
|
||||
public synchronized void writeString2(String str) {
|
||||
try {
|
||||
Path path;
|
||||
Path path2 = Paths.get(str, new String[0]);
|
||||
if (!Files.exists(path2, new LinkOption[0])) {
|
||||
Files.createDirectories(path2, new FileAttribute[0]);
|
||||
}
|
||||
if (!Files.exists(path = BaritoneBitSetHelper.transformPath(path2, this.count2, this.count3), new LinkOption[0])) {
|
||||
return;
|
||||
}
|
||||
System.out.println("Loading region " + this.count2 + "," + this.count3 + " from disk " + path2);
|
||||
long timestampMs = System.nanoTime() / 1000000L;
|
||||
Throwable throwable = null;
|
||||
Object target = null;
|
||||
try {
|
||||
int value;
|
||||
int value2;
|
||||
FileInputStream fileInputStream = new FileInputStream(path.toFile());
|
||||
GZIPInputStream gZIPInputStream = new GZIPInputStream((InputStream)fileInputStream, 32768);
|
||||
DataInputStream dataInputStream = new DataInputStream(gZIPInputStream);
|
||||
int value3 = dataInputStream.readInt();
|
||||
if (value3 != 456022910) {
|
||||
throw new IOException("Bad magic value " + value3);
|
||||
}
|
||||
boolean[][] blArray = new boolean[32][32];
|
||||
BitSet[][] bitSetArray = new BitSet[32][32];
|
||||
Map[][] mapArray = new Map[32][32];
|
||||
IBlockState[][][] iBlockStateArray = new IBlockState[32][32][];
|
||||
long[][] lArray = new long[32][32];
|
||||
int value4 = 0;
|
||||
while (value4 < 32) {
|
||||
value2 = 0;
|
||||
while (value2 < 32) {
|
||||
value = dataInputStream.read();
|
||||
switch (value) {
|
||||
case 1: {
|
||||
byte[] byArray = new byte[16384];
|
||||
dataInputStream.readFully(byArray);
|
||||
bitSetArray[value4][value2] = BitSet.valueOf(byArray);
|
||||
mapArray[value4][value2] = new HashMap();
|
||||
iBlockStateArray[value4][value2] = new IBlockState[256];
|
||||
blArray[value4][value2] = true;
|
||||
break;
|
||||
}
|
||||
case 0: {
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
throw new IOException("Malformed stream");
|
||||
}
|
||||
}
|
||||
++value2;
|
||||
}
|
||||
++value4;
|
||||
}
|
||||
value4 = 0;
|
||||
while (value4 < 32) {
|
||||
value2 = 0;
|
||||
while (value2 < 32) {
|
||||
if (blArray[value4][value2]) {
|
||||
value = 0;
|
||||
while (value < 256) {
|
||||
iBlockStateArray[value4][value2][value] = BlockUtilHelper.resolveBlock2((String)dataInputStream.readUTF()).getDefaultState();
|
||||
++value;
|
||||
}
|
||||
}
|
||||
++value2;
|
||||
}
|
||||
++value4;
|
||||
}
|
||||
value4 = 0;
|
||||
while (value4 < 32) {
|
||||
value2 = 0;
|
||||
while (value2 < 32) {
|
||||
if (blArray[value4][value2]) {
|
||||
value = dataInputStream.readShort() & 0xFFFF;
|
||||
int value5 = 0;
|
||||
while (value5 < value) {
|
||||
String readUTF = dataInputStream.readUTF();
|
||||
BlockUtilHelper.resolveBlock2((String)readUTF);
|
||||
ArrayList<BlockPos> list = new ArrayList<BlockPos>();
|
||||
mapArray[value4][value2].put(readUTF, list);
|
||||
int value6 = dataInputStream.readShort() & 0xFFFF;
|
||||
if (value6 == 0) {
|
||||
value6 = 65536;
|
||||
}
|
||||
int value7 = 0;
|
||||
while (value7 < value6) {
|
||||
byte byteData = dataInputStream.readByte();
|
||||
int value8 = byteData & 0xF;
|
||||
int value9 = byteData >>> 4 & 0xF;
|
||||
int value10 = dataInputStream.readByte() & 0xFF;
|
||||
list.add(new BlockPos(value8, value10, value9));
|
||||
++value7;
|
||||
}
|
||||
++value5;
|
||||
}
|
||||
}
|
||||
++value2;
|
||||
}
|
||||
++value4;
|
||||
}
|
||||
value4 = 0;
|
||||
while (value4 < 32) {
|
||||
value2 = 0;
|
||||
while (value2 < 32) {
|
||||
if (blArray[value4][value2]) {
|
||||
lArray[value4][value2] = dataInputStream.readLong();
|
||||
}
|
||||
++value2;
|
||||
}
|
||||
++value4;
|
||||
}
|
||||
value4 = 0;
|
||||
while (value4 < 32) {
|
||||
value2 = 0;
|
||||
while (value2 < 32) {
|
||||
if (blArray[value4][value2]) {
|
||||
value = this.count2;
|
||||
int count3 = this.count3;
|
||||
int value11 = value4 + 32 * value;
|
||||
int value12 = value2 + 32 * count3;
|
||||
this.bitSetHelperArray[value4][value2] = new BitSetHelper(value11, value12, bitSetArray[value4][value2], iBlockStateArray[value4][value2], mapArray[value4][value2], lArray[value4][value2]);
|
||||
}
|
||||
++value2;
|
||||
}
|
||||
++value4;
|
||||
}
|
||||
if (dataInputStream != null) {
|
||||
dataInputStream.close();
|
||||
}
|
||||
if (gZIPInputStream != null) {
|
||||
gZIPInputStream.close();
|
||||
}
|
||||
if (fileInputStream != null) {
|
||||
fileInputStream.close();
|
||||
}
|
||||
}
|
||||
catch (Throwable throwable2) {
|
||||
if (throwable == null) {
|
||||
throwable = throwable2;
|
||||
} else if (throwable != throwable2) {
|
||||
throwable.addSuppressed(throwable2);
|
||||
}
|
||||
if (throwable instanceof Exception) throw (Exception)throwable;
|
||||
if (throwable instanceof Error) throw (Error)throwable;
|
||||
throw new RuntimeException(throwable);
|
||||
}
|
||||
this.syncStorage();
|
||||
this.hasPosY = false;
|
||||
long timestampMs2 = System.nanoTime() / 1000000L;
|
||||
System.out.println("Loaded region successfully in " + (timestampMs2 - timestampMs) + "ms");
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getCount2() {
|
||||
return this.count2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getCount3() {
|
||||
return this.count3;
|
||||
}
|
||||
|
||||
public final ArrayList<BlockPos> resolveArrayList(String str) {
|
||||
ArrayList list = new ArrayList();
|
||||
|
||||
for (int idx = 0; idx < 32; idx++) {
|
||||
for (int idx2 = 0; idx2 < 32; idx2++) {
|
||||
if (this.bitSetHelperArray[idx][idx2] != null) {
|
||||
ArrayList list2 = this.bitSetHelperArray[idx][idx2].resolveArrayList(str);
|
||||
if (list2 != null) {
|
||||
list.addAll(list2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public final synchronized void handleIndex(int value, int value2, BitSetHelper bitSetHelper) {
|
||||
this.bitSetHelperArray[value][value2] = bitSetHelper;
|
||||
this.hasPosY = true;
|
||||
}
|
||||
|
||||
public final synchronized BitSetHelper getBitSetHelper() {
|
||||
BitSetHelper bitSetHelper2 = null;
|
||||
|
||||
for (int idx = 0; idx < 32; idx++) {
|
||||
for (int idx2 = 0; idx2 < 32; idx2++) {
|
||||
if (this.bitSetHelperArray[idx][idx2] != null
|
||||
&& (bitSetHelper2 == null || this.bitSetHelperArray[idx][idx2].lastTimeMs > bitSetHelper2.lastTimeMs)) {
|
||||
bitSetHelper2 = this.bitSetHelperArray[idx][idx2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return bitSetHelper2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final IBlockState resolveBlockState(int posX, int posY, int posZ) {
|
||||
BitSetHelper bitSetHelper3 = this.bitSetHelperArray[posX >> 4][posZ >> 4];
|
||||
return bitSetHelper3 != null ? bitSetHelper3.resolveBlockState(posX & 15, posY, posZ & 15, this.count4) : null;
|
||||
}
|
||||
|
||||
private static final Path transformPath(Path path3, int value, int value2) {
|
||||
|
||||
return Paths.get(path3.toString(), "r." + value + "." + value2 + ".bcr");
|
||||
}
|
||||
|
||||
public BaritoneBitSetHelper(int count2, int count3, int count4) {
|
||||
this.count2 = count2;
|
||||
this.count3 = count3;
|
||||
this.hasPosY = false;
|
||||
this.count4 = count4;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package baritone.api.utils;
|
||||
|
||||
import baritone.api.pathing.goals.GoalRunAwayFrom;
|
||||
import net.minecraft.util.BlockPos;
|
||||
|
||||
public final class BaritoneChatControl$1 extends GoalRunAwayFrom {
|
||||
public transient BaritoneChatControl chatControl;
|
||||
|
||||
public BaritoneChatControl$1(BaritoneChatControl chatControl, double distance, BlockPos... positions) {
|
||||
super(distance, positions);
|
||||
this.chatControl = chatControl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptIndex(int posX, int posY, int posZ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,823 @@
|
||||
package baritone.api.utils;
|
||||
import baritone.api.movement.CalculationContext;
|
||||
import baritone.api.movement.IPathingBehavior;
|
||||
import baritone.api.pathing.goals.GoalAxis;
|
||||
import baritone.api.pathing.goals.GoalGetToBlock;
|
||||
import baritone.api.pathing.goals.GoalNear;
|
||||
import baritone.api.pathing.goals.GoalStrictDirectHelper;
|
||||
import baritone.api.process.IBaritoneProcess;
|
||||
import baritone.api.process.ICustomGoalProcess;
|
||||
import baritone.api.process.IGetToBlockProcess;
|
||||
import intent.zeroday.util.BlockPosApiHelper;
|
||||
import intent.zeroday.util.BlockUtilHelper;
|
||||
|
||||
import baritone.api.event.IGameEventNotifier;
|
||||
import java.util.Iterator;
|
||||
|
||||
import baritone.api.utils.BetterBlockPos;
|
||||
import baritone.pathing.GoalBlock;
|
||||
import baritone.pathing.BaritoneHelperCore;
|
||||
import intent.zeroday.ZeroDayClient;
|
||||
import intent.zeroday.module.impl.player.AutoArmor;
|
||||
import intent.zeroday.module.impl.player.Baritone;
|
||||
import intent.zeroday.module.impl.player.BestSword;
|
||||
import baritone.api.utils.WaypointTag;
|
||||
import intent.zeroday.util.BlockPosApi;
|
||||
import baritone.api.event.BaritoneChatEvent;
|
||||
import baritone.api.utils.IBaritone;
|
||||
import baritone.api.utils.IPlayerContext;
|
||||
import baritone.api.pathing.goals.IGoal;
|
||||
import baritone.api.pathing.goals.GoalYLevelHelper;
|
||||
import baritone.api.utils.BaritoneBaritoneSettingsUtil;
|
||||
import baritone.api.event.IGameEventListener;
|
||||
import baritone.api.pathing.goals.GoalXZ;
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import baritone.api.BaritoneSetting;
|
||||
import baritone.pathing.SettingsUtil;
|
||||
import baritone.pathing.MineProcess;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.ChunkProviderClient;
|
||||
import net.minecraft.crash.CrashReport;
|
||||
import net.minecraft.entity.item.EntityXPOrb;
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import net.minecraft.util.ReportedException;
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
||||
public final class BaritoneChatControl implements BaritoneHelperCore, IGameEventListener {
|
||||
private static String nameText = "baritone - Output settings into chat\nsettings - Same as baritone\ngoal - Create a goal (one number is '<Y>', two is '<X> <Z>', three is '<X> <Y> <Z>, 'clear' to clear)\npath - Go towards goal\nrepack - (debug) Repacks chunk cache\nrescan - (debug) Same as repack\naxis - Paths towards the closest axis or diagonal axis, at y=120\ncancel - Cancels current path\nforcecancel - sudo cancel (only use if very glitched, try toggling 'pause' first)\ngc - Calls System.gc();\ninvert - Runs away from the goal instead of towards it\nfollow - Follows a player 'follow username'\nreloadall - (debug) Reloads chunk cache\nsaveall - (debug) Saves chunk cache\nfind - (debug) outputs how many blocks of a certain type are within the cache\nmine - Paths to and mines specified blocks 'mine x_ore y_ore ...'\nthisway - Creates a goal X blocks where you're facing\nlist - Lists waypoints under a category\nget - Same as list\nshow - Same as list\nsave - Saves a waypoint (works but don't try to make sense of it)\ndelete - Deletes a waypoint\ngoto - Paths towards specified block or waypoint\nspawn - Paths towards world spawn or your most recent bed right-click\nsethome - Sets \"home\"\nhome - Paths towards \"home\" \ncosts - (debug) all movement costs from current location\nGo to https://github.com/cabaletta/baritone/blob/master/USAGE.md for more information";
|
||||
public transient IBaritone baritone;
|
||||
private static String nameText2;
|
||||
public transient IPlayerContext playerContext;
|
||||
|
||||
private void updateList(List list) {
|
||||
|
||||
|
||||
|
||||
for (ItemStack stack : (java.lang.Iterable<net.minecraft.item.ItemStack>) (java.lang.Iterable<?>) (list)) {
|
||||
if (stack.stackSize > 0) {
|
||||
this.updateString2(stack.stackSize + "x " + stack.getDisplayName() + "@" + stack.getItemDamage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private IGoal resolveGoal(String[] textArr) {
|
||||
|
||||
|
||||
|
||||
try {
|
||||
BetterBlockPos pos2 = this.playerContext.playerFeet();
|
||||
IGoal goal;
|
||||
switch (textArr.length) {
|
||||
case 0:
|
||||
goal = new GoalBlock(pos2);
|
||||
break;
|
||||
case 1:
|
||||
goal = new GoalYLevelHelper(this.resolveIndex(textArr[0], pos2.blockY));
|
||||
break;
|
||||
case 2:
|
||||
goal = new GoalXZ(this.resolveIndex(textArr[0], pos2.blockX), this.resolveIndex(textArr[1], pos2.blockZ));
|
||||
break;
|
||||
case 3:
|
||||
goal = new GoalBlock(
|
||||
new BlockPos(
|
||||
this.resolveIndex(textArr[0], pos2.blockX),
|
||||
this.resolveIndex(textArr[1], pos2.blockY),
|
||||
this.resolveIndex(textArr[2], pos2.blockZ)
|
||||
)
|
||||
);
|
||||
break;
|
||||
default:
|
||||
this.updateString2("unable to understand lol");
|
||||
return null;
|
||||
}
|
||||
|
||||
return goal;
|
||||
} catch (NumberFormatException numberFormatException) {
|
||||
this.updateString2("unable to parse integer " + numberFormatException);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBaritoneChat(BaritoneChatEvent baritoneChatEvent) {
|
||||
|
||||
String nameText = baritoneChatEvent.getNameText();
|
||||
if (BaritoneBaritoneSettingsUtil.getBaritoneSettings().prefixControl.value && nameText.startsWith("#")) {
|
||||
if (!this.canAcceptString(nameText.substring("#".length()))) {
|
||||
this.updateString2("Invalid command");
|
||||
}
|
||||
|
||||
baritoneChatEvent.resetState();
|
||||
} else if (BaritoneBaritoneSettingsUtil.getBaritoneSettings().chatControl.value || BaritoneBaritoneSettingsUtil.getBaritoneSettings().removePrefix.value) {
|
||||
if (this.canAcceptString(nameText)) {
|
||||
ZeroDayClient.computeObjectFromClass(Baritone.class).updateState2();
|
||||
baritoneChatEvent.resetState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public boolean canAcceptString(String rawCmd) {
|
||||
String cmd = rawCmd.toLowerCase(Locale.US).trim();
|
||||
IPathingBehavior pathingBehavior = this.baritone.getPathingBehavior2();
|
||||
ICustomGoalProcess customGoalProcess = this.baritone.getCustomGoalProcess2();
|
||||
List<BaritoneSetting<Boolean, String>> boolSettings = BaritoneBaritoneSettingsUtil.getBaritoneSettings().getAllValuesByType(Boolean.class);
|
||||
for (BaritoneSetting<Boolean, String> setting : boolSettings) {
|
||||
if (!cmd.equalsIgnoreCase(setting.getName())) continue;
|
||||
setting.value = !setting.value;
|
||||
this.updateString2("Toggled " + setting.getName() + " to " + setting.value);
|
||||
SettingsUtil.writeBaritoneSettings(BaritoneBaritoneSettingsUtil.getBaritoneSettings());
|
||||
return true;
|
||||
}
|
||||
if (cmd.equals("baritone") || cmd.equals("modifiedsettings") || cmd.startsWith("settings m") || cmd.equals("modified")) {
|
||||
this.updateString2("All settings that have been modified from their default values:");
|
||||
for (Object modSetting : SettingsUtil.resolveList(BaritoneBaritoneSettingsUtil.getBaritoneSettings())) {
|
||||
this.updateString2(modSetting.toString());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (cmd.startsWith("settings")) {
|
||||
String pageArg = cmd.substring("settings".length());
|
||||
try {
|
||||
int page = Integer.parseInt(pageArg.trim());
|
||||
int startIdx = page * 10;
|
||||
int endIdx = Math.min(BaritoneBaritoneSettingsUtil.getBaritoneSettings().allSettings.size(), (page + 1) * 10);
|
||||
this.updateString2("Settings " + startIdx + " to " + (endIdx - 1) + ":");
|
||||
for (int idx = startIdx; idx < endIdx; ++idx) {
|
||||
this.updateString2(BaritoneBaritoneSettingsUtil.getBaritoneSettings().allSettings.get(idx).toString());
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
this.updateString2("All settings:");
|
||||
for (Object s : BaritoneBaritoneSettingsUtil.getBaritoneSettings().allSettings) {
|
||||
this.updateString2(s.toString());
|
||||
}
|
||||
this.updateString2("To get one page of ten settings at a time, do settings <num>");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (cmd.equals("") || cmd.equals("help") || cmd.equals("?")) {
|
||||
String[] helpLines = "baritone - Output settings into chat\nsettings - Same as baritone\ngoal - Create a goal (one number is '<Y>', two is '<X> <Z>', three is '<X> <Y> <Z>, 'clear' to clear)\npath - Go towards goal\nrepack - (debug) Repacks chunk cache\nrescan - (debug) Same as repack\naxis - Paths towards the closest axis or diagonal axis, at y=120\ncancel - Cancels current path\nforcecancel - sudo cancel (only use if very glitched, try toggling 'pause' first)\ngc - Calls System.gc();\ninvert - Runs away from the goal instead of towards it\nfollow - Follows a player 'follow username'\nreloadall - (debug) Reloads chunk cache\nsaveall - (debug) Saves chunk cache\nfind - (debug) outputs how many blocks of a certain type are within the cache\nmine - Paths to and mines specified blocks 'mine x_ore y_ore ...'\nthisway - Creates a goal X blocks where you're facing\nlist - Lists waypoints under a category\nget - Same as list\nshow - Same as list\nsave - Saves a waypoint (works but don't try to make sense of it)\ndelete - Deletes a waypoint\ngoto - Paths towards specified block or waypoint\nspawn - Paths towards world spawn or your most recent bed right-click\nsethome - Sets \"home\"\nhome - Paths towards \"home\" \ncosts - (debug) all movement costs from current location\nGo to https://github.com/cabaletta/baritone/blob/master/USAGE.md for more information".split("\n");
|
||||
for (String line : helpLines) {
|
||||
this.updateString2(line);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (cmd.contains(" ")) {
|
||||
String settingKey = cmd.substring(0, cmd.indexOf(32));
|
||||
String settingVal = cmd.substring(cmd.indexOf(32) + 1);
|
||||
BaritoneSetting<?, ?> targetSetting = BaritoneBaritoneSettingsUtil.getBaritoneSettings().byLowerName.get(settingKey);
|
||||
if (targetSetting != null) {
|
||||
if (settingVal.equals("reset")) {
|
||||
this.updateString2("Resetting setting " + settingKey + " to default value.");
|
||||
targetSetting.reset();
|
||||
} else {
|
||||
try {
|
||||
SettingsUtil.handleBaritoneSettings(BaritoneBaritoneSettingsUtil.getBaritoneSettings(), settingKey, settingVal);
|
||||
} catch (Exception ex) {
|
||||
this.updateString2("Unable to parse setting");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
SettingsUtil.writeBaritoneSettings(BaritoneBaritoneSettingsUtil.getBaritoneSettings());
|
||||
this.updateString2(targetSetting.toString());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (BaritoneBaritoneSettingsUtil.getBaritoneSettings().byLowerName.containsKey(cmd)) {
|
||||
Object existingSetting = BaritoneBaritoneSettingsUtil.getBaritoneSettings().byLowerName.get(cmd);
|
||||
this.updateString2(existingSetting.toString());
|
||||
return true;
|
||||
}
|
||||
if (cmd.startsWith("goal")) {
|
||||
String goalRest = cmd.substring(4).trim();
|
||||
IGoal goal;
|
||||
if (goalRest.equals("clear") || goalRest.equals("none")) {
|
||||
goal = null;
|
||||
} else {
|
||||
String[] parts = goalRest.split(" ");
|
||||
if (parts[0].equals("")) {
|
||||
parts = new String[0];
|
||||
}
|
||||
goal = this.resolveGoal(parts);
|
||||
if (goal == null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
customGoalProcess.updateGoal(goal);
|
||||
this.updateString2("Goal: " + goal);
|
||||
return true;
|
||||
}
|
||||
if (cmd.equals("crash")) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
CrashReport report = new CrashReport("Manually triggered debug crash", new Throwable());
|
||||
BaritoneChatControl.c_.addGraphicsAndWorldToCrashReport(report);
|
||||
new ReportedException(report).printStackTrace();
|
||||
report.getSectionsInStringBuilder(sb);
|
||||
System.out.println(sb);
|
||||
this.updateString2(sb.toString());
|
||||
this.updateString2("ok");
|
||||
return true;
|
||||
}
|
||||
if (cmd.equals("path")) {
|
||||
if (pathingBehavior.getGuiClientBlockPos() == null) {
|
||||
this.updateString2("No goal.");
|
||||
} else if (pathingBehavior.getGuiClientBlockPos().canAcceptBlockPos(this.playerContext.playerFeet())) {
|
||||
this.updateString2("Already in goal");
|
||||
} else if (pathingBehavior.isActive4()) {
|
||||
this.updateString2("Currently executing a path. Please cancel it first.");
|
||||
} else {
|
||||
customGoalProcess.updateGoal2(pathingBehavior.getGuiClientBlockPos());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (cmd.equals("proc")) {
|
||||
Optional<?> activeOpt = this.baritone.getSelectionManager().getOptional();
|
||||
if (!activeOpt.isPresent()) {
|
||||
this.updateString2("No process is in control");
|
||||
return true;
|
||||
}
|
||||
IBaritoneProcess proc = (IBaritoneProcess) activeOpt.get();
|
||||
this.updateString2("Class: " + proc.getClass());
|
||||
this.updateString2("Priority: " + proc.getDistance());
|
||||
this.updateString2("Temporary: " + proc.isActive());
|
||||
this.updateString2("Display name: " + proc.getString2());
|
||||
this.updateString2("Command: " + this.baritone.getSelectionManager().getOptional2());
|
||||
return true;
|
||||
}
|
||||
if (cmd.equals("version")) {
|
||||
String ver = BaritoneChatControl.class.getPackage().getImplementationVersion();
|
||||
if (ver == null) {
|
||||
this.updateString2("No version detected. Either dev environment or broken install.");
|
||||
} else {
|
||||
this.updateString2("You are using Baritone v" + ver);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (cmd.equals("repack") || cmd.equals("rescan")) {
|
||||
ChunkProviderClient chunkProvider = (ChunkProviderClient) this.playerContext.world().getChunkProvider();
|
||||
int playerChunkX = this.playerContext.playerFeet().getX() >> 4;
|
||||
int playerChunkZ = this.playerContext.playerFeet().getZ() >> 4;
|
||||
int queued = 0;
|
||||
for (int cx = playerChunkX - 40; cx <= playerChunkX + 40; ++cx) {
|
||||
for (int cz = playerChunkZ - 40; cz <= playerChunkZ + 40; ++cz) {
|
||||
Chunk chunk = chunkProvider.chunkMapping.getValueByKey(ChunkCoordIntPair.chunkXZ2Int(cx, cz));
|
||||
if (chunk != null) {
|
||||
++queued;
|
||||
this.baritone.getBaritoneWorldProvider2().getCachedWorldData().getCacheBaritoneComponent022().updateChunk(chunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.updateString2("Queued " + queued + " chunks for repacking");
|
||||
return true;
|
||||
}
|
||||
if (cmd.startsWith("build")) {
|
||||
String schematicName;
|
||||
BlockPos buildOrigin;
|
||||
try {
|
||||
String[] parts = cmd.substring("build".length()).trim().split(" ");
|
||||
schematicName = parts[0] + ".schematic";
|
||||
BetterBlockPos feet = this.playerContext.playerFeet();
|
||||
buildOrigin = new BlockPos(
|
||||
this.resolveIndex(parts[1], feet.blockX),
|
||||
this.resolveIndex(parts[2], feet.blockY),
|
||||
this.resolveIndex(parts[3], feet.blockZ)
|
||||
);
|
||||
} catch (Exception ex) {
|
||||
schematicName = cmd.substring(5).trim() + ".schematic";
|
||||
buildOrigin = this.playerContext.playerFeet();
|
||||
}
|
||||
this.updateString2("Loading '" + schematicName + "' to build from origin " + buildOrigin);
|
||||
boolean loaded = this.baritone.getBuilderProcess2().canAcceptString2(schematicName, buildOrigin);
|
||||
this.updateString2(loaded ? "Loaded" : "Unable to load");
|
||||
return true;
|
||||
}
|
||||
if (cmd.equals("come")) {
|
||||
customGoalProcess.updateGoal2(new GoalBlock(new BlockPos(BaritoneHelperCore.c_.getRenderViewEntity())));
|
||||
this.updateString2("Coming");
|
||||
return true;
|
||||
}
|
||||
if (cmd.equals("axis") || cmd.equals("highway")) {
|
||||
customGoalProcess.updateGoal2(new GoalAxis());
|
||||
return true;
|
||||
}
|
||||
if (cmd.equals("cancel") || cmd.equals("stop")) {
|
||||
pathingBehavior.isActive();
|
||||
this.updateString2("Process Ended");
|
||||
return true;
|
||||
}
|
||||
if (cmd.equals("forcecancel")) {
|
||||
pathingBehavior.isActive();
|
||||
pathingBehavior.updateState2();
|
||||
this.updateString2("Process Force-Closed");
|
||||
return true;
|
||||
}
|
||||
if (cmd.equals("gc")) {
|
||||
System.gc();
|
||||
this.updateString2("Called System.gc();");
|
||||
return true;
|
||||
}
|
||||
if (cmd.equals("invert")) {
|
||||
IGoal currentGoal = pathingBehavior.getGuiClientBlockPos();
|
||||
BlockPos origin;
|
||||
if (currentGoal instanceof GoalXZ) {
|
||||
origin = new BlockPos(((GoalXZ) currentGoal).getGoalX(), 0, ((GoalXZ) currentGoal).getGoalZ());
|
||||
} else if (currentGoal instanceof GoalBlock) {
|
||||
origin = ((GoalBlock) currentGoal).getBlockPos();
|
||||
} else {
|
||||
this.updateString2("Goal must be GoalXZ or GoalBlock to invert");
|
||||
this.updateString2("Inverting goal of player feet");
|
||||
origin = this.playerContext.playerFeet();
|
||||
}
|
||||
customGoalProcess.updateGoal2(new BaritoneChatControl$1(this, 1.0, origin));
|
||||
return true;
|
||||
}
|
||||
if (cmd.startsWith("cleararea")) {
|
||||
String rest = cmd.substring("cleararea ".length());
|
||||
BlockPos corner1;
|
||||
BlockPos corner2;
|
||||
if (rest.isEmpty()) {
|
||||
IGoal currentGoal = this.baritone.getPathingBehavior2().getGuiClientBlockPos();
|
||||
if (!(currentGoal instanceof GoalBlock)) {
|
||||
this.updateString2("Need to specify goal of opposite corner");
|
||||
return true;
|
||||
}
|
||||
corner1 = ((GoalBlock) currentGoal).getBlockPos();
|
||||
corner2 = this.playerContext.playerFeet();
|
||||
} else {
|
||||
try {
|
||||
String[] parts = rest.split(" ");
|
||||
corner1 = this.playerContext.playerFeet();
|
||||
corner2 = new BlockPos(Integer.parseInt(parts[0]), Integer.parseInt(parts[1]), Integer.parseInt(parts[2]));
|
||||
} catch (ArrayIndexOutOfBoundsException | NullPointerException | NumberFormatException ex) {
|
||||
this.updateString2("unable to parse");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
this.baritone.getBuilderProcess2().handleBlockPos(corner1, corner2);
|
||||
return true;
|
||||
}
|
||||
if (cmd.equals("resume")) {
|
||||
this.baritone.getBuilderProcess2().resetState3();
|
||||
this.updateString2("resumed");
|
||||
return true;
|
||||
}
|
||||
if (cmd.equals("pause")) {
|
||||
this.baritone.getBuilderProcess2().resetState2();
|
||||
this.updateString2("paused");
|
||||
return true;
|
||||
}
|
||||
if (cmd.equals("reset")) {
|
||||
for (BaritoneSetting<?, ?> s : BaritoneBaritoneSettingsUtil.getBaritoneSettings().allSettings) {
|
||||
s.reset();
|
||||
}
|
||||
SettingsUtil.writeBaritoneSettings(BaritoneBaritoneSettingsUtil.getBaritoneSettings());
|
||||
this.updateString2("Baritone settings reset");
|
||||
return true;
|
||||
}
|
||||
if (cmd.equals("tunnel")) {
|
||||
customGoalProcess.updateGoal2(new GoalStrictDirectHelper(this.playerContext.playerFeet(), this.playerContext.player().getHorizontalFacing()));
|
||||
this.updateString2("tunneling");
|
||||
return true;
|
||||
}
|
||||
if (cmd.equals("render")) {
|
||||
BetterBlockPos pos = this.playerContext.playerFeet();
|
||||
Minecraft.getMinecraft().renderGlobal.markBlockRangeForRenderUpdate(pos.blockX - 500, pos.blockY - 500, pos.blockZ - 500, pos.blockX + 500, pos.blockY + 500, pos.blockZ + 500);
|
||||
this.updateString2("okay");
|
||||
return true;
|
||||
}
|
||||
if (cmd.startsWith("fish")) {
|
||||
String rest = cmd.substring("fish".length()).trim();
|
||||
String[] parts;
|
||||
if (!rest.isEmpty() && (parts = rest.split(" ")).length == 6) {
|
||||
this.baritone.getFishProcess2().handleBlockPos(
|
||||
new BlockPos(Integer.valueOf(parts[0]), Integer.valueOf(parts[1]), Integer.valueOf(parts[2])),
|
||||
new BlockPos(Integer.valueOf(parts[3]), Integer.valueOf(parts[4]), Integer.valueOf(parts[5]))
|
||||
);
|
||||
this.updateString2("fishing");
|
||||
return true;
|
||||
}
|
||||
this.baritone.getFishProcess2().handleBlockPos(null, null);
|
||||
this.updateString2("fishing");
|
||||
return true;
|
||||
}
|
||||
if (cmd.startsWith("farm")) {
|
||||
String rest = cmd.substring("farm".length()).trim();
|
||||
String[] parts;
|
||||
if (!rest.isEmpty() && (parts = rest.split(" ")).length == 6) {
|
||||
this.baritone.getFarmProcess2().handleBlockPos(
|
||||
new BlockPos(Integer.valueOf(parts[0]), Integer.valueOf(parts[1]), Integer.valueOf(parts[2])),
|
||||
new BlockPos(Integer.valueOf(parts[3]), Integer.valueOf(parts[4]), Integer.valueOf(parts[5]))
|
||||
);
|
||||
this.updateString2("farming");
|
||||
return true;
|
||||
}
|
||||
this.baritone.getFarmProcess2().handleBlockPos(null, null);
|
||||
this.updateString2("farming");
|
||||
return true;
|
||||
}
|
||||
if (cmd.equals("chests")) {
|
||||
for (Map.Entry<?, ?> mapEntry : this.baritone.getBaritoneWorldProvider2().getCachedWorldData().getContainersBaritoneHelper2().getMap().entrySet()) {
|
||||
this.updateString2("" + mapEntry.getKey());
|
||||
this.updateList(((ITrackedInventory) mapEntry.getValue()).getList());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (cmd.startsWith("followentities")) {
|
||||
this.baritone.getFollowProcess().setPredicate(Entity.class::isInstance);
|
||||
this.updateString2("Following any entities");
|
||||
return true;
|
||||
}
|
||||
if (cmd.startsWith("followentity")) {
|
||||
String query = cmd.substring(12).trim();
|
||||
Optional<Entity> found = Optional.empty();
|
||||
for (Entity ent : this.playerContext.world().loadedEntityList) {
|
||||
String lowerName = ent.getName().trim().toLowerCase();
|
||||
if ((!lowerName.contains(query) && !query.contains(lowerName)) || ent instanceof EntityItem || ent instanceof EntityPlayer) continue;
|
||||
found = Optional.of(ent);
|
||||
}
|
||||
if (!found.isPresent()) {
|
||||
this.updateString2("Entity not found");
|
||||
return true;
|
||||
}
|
||||
Predicate<Entity> animalPred = EntityAnimal.class::isInstance;
|
||||
Predicate<Entity> itemPred = EntityItem.class::isInstance;
|
||||
Predicate<Entity> validItemPred = BaritoneChatControl::canAcceptEntity;
|
||||
Predicate<Entity> xpPred = EntityXPOrb.class::isInstance;
|
||||
this.baritone.getFollowProcess().setPredicate(animalPred.or(itemPred.and(validItemPred)).or(xpPred));
|
||||
this.updateString2("Following entity " + found.get());
|
||||
return true;
|
||||
}
|
||||
if (cmd.startsWith("autoplay")) {
|
||||
this.baritone.getFollowProcess().setPredicate(BaritoneChatControl::canAcceptEntity2);
|
||||
this.updateString2("Autoplaying");
|
||||
return true;
|
||||
}
|
||||
if (cmd.startsWith("followplayers")) {
|
||||
this.baritone.getFollowProcess().setPredicate(BaritoneChatControl::canAcceptEntity3);
|
||||
this.updateString2("Following any players");
|
||||
return true;
|
||||
}
|
||||
if (cmd.startsWith("follow")) {
|
||||
String query = cmd.substring(6).trim();
|
||||
Optional<EntityPlayer> found = Optional.empty();
|
||||
if (query.length() == 0) {
|
||||
found = (Optional) this.playerContext.getOptional2();
|
||||
} else {
|
||||
for (Entity ent : this.playerContext.world().playerEntities) {
|
||||
if (!(ent instanceof EntityPlayer)) continue;
|
||||
EntityPlayer candidate = (EntityPlayer) ent;
|
||||
String lowerName = candidate.getName().trim().toLowerCase();
|
||||
if (lowerName.equals(this.playerContext.player().getName().trim().toLowerCase())) continue;
|
||||
if (!lowerName.contains(query) && !query.contains(lowerName)) continue;
|
||||
found = Optional.of(candidate);
|
||||
}
|
||||
}
|
||||
if (!found.isPresent()) {
|
||||
this.updateString2("Not found");
|
||||
return true;
|
||||
}
|
||||
Entity target = found.get();
|
||||
this.baritone.getFollowProcess().setPredicate(target::equals);
|
||||
this.updateString2("Following " + found.get().getName());
|
||||
return true;
|
||||
}
|
||||
if (cmd.startsWith("explorefilter")) {
|
||||
String rest = cmd.substring("explorefilter".length()).trim();
|
||||
String[] parts = rest.split(" ");
|
||||
Path filterPath = Minecraft.getMinecraft().mcDataDir.toPath().resolve(parts[0]);
|
||||
boolean invert = parts.length > 1;
|
||||
try {
|
||||
this.baritone.getExploreProcess().handlePath(filterPath, invert);
|
||||
this.updateString2("Loaded filter. Inverted: " + invert);
|
||||
if (invert) {
|
||||
this.updateString2("Chunks on this list will be treated as possibly unexplored, all others will be treated as certainly explored");
|
||||
} else {
|
||||
this.updateString2("Chunks on this list will be treated as certainly explored, all others will be treated as possibly unexplored");
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
this.updateString2("Unable to load " + filterPath);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (cmd.equals("reloadall")) {
|
||||
this.baritone.getBaritoneWorldProvider2().getCachedWorldData().getCacheBaritoneComponent022().syncStorage2();
|
||||
this.updateString2("ok");
|
||||
return true;
|
||||
}
|
||||
if (cmd.equals("saveall")) {
|
||||
this.baritone.getBaritoneWorldProvider2().getCachedWorldData().getCacheBaritoneComponent022().syncStorage();
|
||||
this.updateString2("ok");
|
||||
return true;
|
||||
}
|
||||
if (cmd.startsWith("explore")) {
|
||||
String rest = cmd.substring("explore".length()).trim();
|
||||
int startX;
|
||||
int startZ;
|
||||
try {
|
||||
startX = Integer.parseInt(rest.split(" ")[0]);
|
||||
startZ = Integer.parseInt(rest.split(" ")[1]);
|
||||
} catch (Exception ex) {
|
||||
startX = this.playerContext.playerFeet().blockX;
|
||||
startZ = this.playerContext.playerFeet().blockZ;
|
||||
}
|
||||
this.baritone.getExploreProcess().handleIndex2(startX, startZ);
|
||||
this.updateString2("Exploring from " + startX + "," + startZ);
|
||||
return true;
|
||||
}
|
||||
if (cmd.equals("blacklist")) {
|
||||
IGetToBlockProcess getToBlock = this.baritone.getGetToBlockProcess();
|
||||
if (!getToBlock.isActive2()) {
|
||||
this.updateString2("GetToBlockProcess is not currently active");
|
||||
return true;
|
||||
}
|
||||
if (getToBlock.isActive4()) {
|
||||
this.updateString2("Blacklisted closest instances");
|
||||
} else {
|
||||
this.updateString2("No known locations, unable to blacklist");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (cmd.startsWith("find")) {
|
||||
String blockName = cmd.substring(4).trim();
|
||||
BetterBlockPos feet = this.playerContext.playerFeet();
|
||||
List<BlockPos> found = this.baritone.getBaritoneWorldProvider2().getCachedWorldData().getCacheBaritoneComponent022().resolveArrayList(blockName, 1, feet.getX(), feet.getZ(), 4);
|
||||
this.updateString2("Have " + found.size() + " locations");
|
||||
for (BlockPos pos : found) {
|
||||
Block actual = this.playerContext.world().getBlockState(pos).getBlock();
|
||||
if (!BlockUtilHelper.resolveString(actual).equalsIgnoreCase(blockName)) {
|
||||
this.updateString("Was looking for " + blockName + " but actually found " + actual + " " + BlockUtilHelper.resolveString(actual));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (cmd.startsWith("mine")) {
|
||||
String[] parts = cmd.substring(4).trim().split(" ");
|
||||
try {
|
||||
int quantity = Integer.parseInt(parts[1]);
|
||||
Block block = BlockUtilHelper.resolveBlock2(parts[0]);
|
||||
this.baritone.getMineProcess().handleIndex2(quantity, new Block[]{block});
|
||||
this.updateString2("Will mine " + quantity + " " + parts[0]);
|
||||
return true;
|
||||
} catch (ArrayIndexOutOfBoundsException | NullPointerException | NumberFormatException ex) {
|
||||
for (String name : parts) {
|
||||
if (BlockUtilHelper.resolveBlock(name) == null) {
|
||||
this.updateString2(name + " isn't a valid block name");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
this.baritone.getMineProcess().handleIndex(0, parts);
|
||||
this.updateString2("Started mining blocks of type " + Arrays.toString(parts));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (cmd.equals("click")) {
|
||||
this.baritone.updateState3();
|
||||
this.updateString2("aight dude");
|
||||
return true;
|
||||
}
|
||||
if (cmd.startsWith("thisway") || cmd.startsWith("forward")) {
|
||||
try {
|
||||
IGoal goal = GoalXZ.resolveGoalXZ(this.playerContext.getVec3(), this.playerContext.player().rotationYaw, Double.parseDouble(cmd.substring(7).trim()));
|
||||
customGoalProcess.updateGoal(goal);
|
||||
this.updateString2("Goal: " + goal);
|
||||
} catch (NumberFormatException ex) {
|
||||
this.updateString2("Error unable to parse '" + cmd.substring(7).trim() + "' to a double.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (cmd.startsWith("list") || cmd.startsWith("get ") || cmd.startsWith("show")) {
|
||||
String tagArg = cmd.substring(4).trim();
|
||||
if (tagArg.endsWith("s")) {
|
||||
tagArg = tagArg.substring(0, tagArg.length() - 1);
|
||||
}
|
||||
WaypointTag tag = WaypointTag.resolveWaypointTag(tagArg);
|
||||
if (tag == null) {
|
||||
this.updateString2("Not a valid tag. Tags are: " + Arrays.asList(WaypointTag.values()).toString().toLowerCase());
|
||||
return true;
|
||||
}
|
||||
Set<BlockPosApi> wpSet = this.baritone.getBaritoneWorldProvider2().getCachedWorldData().getWaypointsWouldHelper().resolveSet(tag);
|
||||
List<BlockPosApi> sorted = new ArrayList<BlockPosApi>(wpSet);
|
||||
sorted.sort(Comparator.comparingLong(BlockPosApi::getLastTimeMs));
|
||||
this.updateString2("Waypoints under tag " + tag + ":");
|
||||
for (BlockPosApi wp : sorted) {
|
||||
this.updateString2(wp.toString());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (cmd.startsWith("save")) {
|
||||
String wpName = cmd.substring(4).trim();
|
||||
BlockPos wpPos = this.playerContext.playerFeet();
|
||||
if (wpName.contains(" ")) {
|
||||
this.updateString2("Name contains a space, assuming it's in the format 'save waypointName X Y Z'");
|
||||
String[] parts = wpName.split(" ");
|
||||
if (parts.length != 4) {
|
||||
this.updateString2("Unable to parse, expected four things");
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
wpPos = new BlockPos(Integer.parseInt(parts[1]), Integer.parseInt(parts[2]), Integer.parseInt(parts[3]));
|
||||
} catch (NumberFormatException ex) {
|
||||
this.updateString2("Unable to parse coordinate integers");
|
||||
return true;
|
||||
}
|
||||
wpName = parts[0];
|
||||
}
|
||||
this.baritone.getBaritoneWorldProvider2().getCachedWorldData().getWaypointsWouldHelper().updateBlockPosApi(new BlockPosApiHelper(wpName, WaypointTag.USER, wpPos));
|
||||
this.updateString2("Saved user defined position " + wpPos + " under name '" + wpName + "'. Say 'goto " + wpName + "' to set goal, say 'list user' to list custom waypoints.");
|
||||
return true;
|
||||
}
|
||||
if (cmd.startsWith("delete")) {
|
||||
String wpName = cmd.substring(6).trim();
|
||||
BlockPosApi targetWp = ((Set<BlockPosApi>) this.baritone.getBaritoneWorldProvider2().getCachedWorldData().getWaypointsWouldHelper().getSet())
|
||||
.stream()
|
||||
.filter(wp -> BaritoneChatControl.canAcceptString2(wpName, wp))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (targetWp == null) {
|
||||
this.updateString2("No user defined position under the name '" + wpName + "' found.");
|
||||
return true;
|
||||
}
|
||||
this.baritone.getBaritoneWorldProvider2().getCachedWorldData().getWaypointsWouldHelper().updateBlockPosApi2(targetWp);
|
||||
this.updateString2("Deleted user defined position under name '" + wpName + "'.");
|
||||
return true;
|
||||
}
|
||||
if (cmd.startsWith("near")) {
|
||||
String arg = cmd.substring(4).trim();
|
||||
if (arg.endsWith("s") && WaypointTag.resolveWaypointTag(arg.substring(0, arg.length() - 1)) != null) {
|
||||
arg = arg.substring(0, arg.length() - 1);
|
||||
}
|
||||
Block nearBlock = BlockUtilHelper.resolveBlock(arg);
|
||||
if (nearBlock != null) {
|
||||
CalculationContext ctx = new CalculationContext(this.baritone, true);
|
||||
List<BlockPos> matches = MineProcess.resolveList2(ctx, Collections.singletonList(nearBlock), 64, Collections.<BlockPos>emptyList(), Collections.<BlockPos>emptyList());
|
||||
customGoalProcess.updateGoal2(new GoalNear(matches.get(0), 2));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (cmd.startsWith("goto")) {
|
||||
String gotoArg = cmd.substring(4).trim();
|
||||
if (gotoArg.endsWith("s") && WaypointTag.resolveWaypointTag(gotoArg.substring(0, gotoArg.length() - 1)) != null) {
|
||||
gotoArg = gotoArg.substring(0, gotoArg.length() - 1);
|
||||
}
|
||||
WaypointTag tag = WaypointTag.resolveWaypointTag(gotoArg);
|
||||
BlockPosApi targetWp;
|
||||
if (tag != null) {
|
||||
targetWp = this.baritone.getBaritoneWorldProvider2().getCachedWorldData().getWaypointsWouldHelper().resolveBlockPosApi(tag);
|
||||
if (targetWp == null) {
|
||||
this.updateString2("None saved for tag " + tag);
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
String lookup = gotoArg;
|
||||
Block targetBlock = BlockUtilHelper.resolveBlock(lookup);
|
||||
if (targetBlock != null) {
|
||||
this.baritone.getGetToBlockProcess().updateBlockArray(new Block[]{targetBlock});
|
||||
return true;
|
||||
}
|
||||
targetWp = ((Set<BlockPosApi>) this.baritone.getBaritoneWorldProvider2().getCachedWorldData().getWaypointsWouldHelper().getSet())
|
||||
.stream()
|
||||
.filter(wp -> BaritoneChatControl.canAcceptString3(lookup, wp))
|
||||
.max(Comparator.comparingLong(BlockPosApi::getLastTimeMs))
|
||||
.orElse(null);
|
||||
if (targetWp == null) {
|
||||
IGoal coordGoal = this.resolveGoal(gotoArg.split(" "));
|
||||
if (coordGoal != null) {
|
||||
this.updateString2("Going to " + coordGoal);
|
||||
customGoalProcess.updateGoal2(coordGoal);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
IGoal wpGoal = targetWp.getWaypointTag() == WaypointTag.BED
|
||||
? new GoalGetToBlock(targetWp.getBlockPos())
|
||||
: new GoalBlock(targetWp.getBlockPos());
|
||||
customGoalProcess.updateGoal2(wpGoal);
|
||||
return true;
|
||||
}
|
||||
if (cmd.equals("spawn") || cmd.equals("bed")) {
|
||||
BlockPosApi bedWp = this.baritone.getBaritoneWorldProvider2().getCachedWorldData().getWaypointsWouldHelper().resolveBlockPosApi(WaypointTag.BED);
|
||||
if (bedWp == null) {
|
||||
BlockPos bedLoc = this.playerContext.player().getBedLocation();
|
||||
GoalXZ spawnGoal = new GoalXZ(bedLoc.getX(), bedLoc.getZ());
|
||||
this.updateString2("spawn not saved, defaulting to world spawn. set goal to " + spawnGoal);
|
||||
customGoalProcess.updateGoal2(spawnGoal);
|
||||
} else {
|
||||
GoalGetToBlock bedGoal = new GoalGetToBlock(bedWp.getBlockPos());
|
||||
customGoalProcess.updateGoal2(bedGoal);
|
||||
this.updateString2("Set goal to most recent bed " + bedGoal);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (cmd.equals("sethome")) {
|
||||
this.baritone.getBaritoneWorldProvider2().getCachedWorldData().getWaypointsWouldHelper().updateBlockPosApi(new BlockPosApiHelper("", WaypointTag.HOME, this.playerContext.playerFeet()));
|
||||
this.updateString2("Saved. Say home to set goal.");
|
||||
return true;
|
||||
}
|
||||
if (cmd.equals("home")) {
|
||||
BlockPosApi homeWp = this.baritone.getBaritoneWorldProvider2().getCachedWorldData().getWaypointsWouldHelper().resolveBlockPosApi(WaypointTag.HOME);
|
||||
if (homeWp == null) {
|
||||
this.updateString2("home not saved");
|
||||
} else {
|
||||
GoalBlock homeGoal = new GoalBlock(homeWp.getBlockPos());
|
||||
customGoalProcess.updateGoal2(homeGoal);
|
||||
this.updateString2("Going to saved home " + homeGoal);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private int resolveIndex(String str, int value) {
|
||||
return str.equals("~") ? value : (str.startsWith("~") ? Integer.parseInt(str.substring(1)) + value : Integer.parseInt(str));
|
||||
}
|
||||
|
||||
private static final boolean canAcceptEntity(Entity entity2) {
|
||||
return EntityItem.checkEntity(entity2);
|
||||
}
|
||||
|
||||
private static final boolean canAcceptString2(String str, BlockPosApi blockPosApi) {
|
||||
return blockPosApi.getWaypointTag() == WaypointTag.USER && blockPosApi.getNameText().equalsIgnoreCase(str);
|
||||
}
|
||||
|
||||
private static final boolean canAcceptEntity2(Entity entity3) {
|
||||
|
||||
|
||||
|
||||
|
||||
if (entity3 instanceof EntityPlayer && !entity3.isInvisible()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (entity3 instanceof EntityItem) {
|
||||
ItemStack stack2 = ((EntityItem)entity3).getEntityItem();
|
||||
Item item2 = stack2.getItem();
|
||||
if (item2 == Items.golden_apple) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (item2 == Items.ender_pearl) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (item2 instanceof ItemArmor) {
|
||||
if (!ZeroDayClient.computeObjectFromClass(AutoArmor.class).canAcceptItemStack(stack2)
|
||||
&& !ZeroDayClient.computeObjectFromClass(AutoArmor.class).canAcceptItemStack2(stack2)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (item2 instanceof ItemSword && c_.thePlayer.getCurrentEquippedItem() != null && c_.thePlayer.getCurrentEquippedItem().getItem() instanceof ItemSword) {
|
||||
float amountF = BestSword.resolveAngle(stack2) + ((ItemSword)item2).getDamageVsEntity();
|
||||
float amountF2 = BestSword.resolveAngle(c_.thePlayer.getCurrentEquippedItem())
|
||||
+ ((ItemSword)c_.thePlayer.getCurrentEquippedItem().getItem()).getDamageVsEntity();
|
||||
if (amountF > amountF2) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public BaritoneChatControl(IBaritone baritone) {
|
||||
this.baritone = baritone;
|
||||
this.playerContext = baritone.getBaritoneApiUtil();
|
||||
baritone.getGameEventHandler().updateGameEventNotifier(this);
|
||||
}
|
||||
|
||||
private static final boolean canAcceptString3(String str, BlockPosApi blockPosApi2) {
|
||||
return blockPosApi2.getNameText().equalsIgnoreCase(str);
|
||||
}
|
||||
|
||||
private static final boolean canAcceptEntity3(Entity entity4) {
|
||||
|
||||
return entity4 instanceof EntityPlayer && !entity4.isInvisible();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
package baritone.api.utils;
|
||||
import intent.zeroday.util.ItemStackUtil;
|
||||
|
||||
|
||||
import baritone.pathing.BaritoneCore;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemTool;
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
import net.minecraft.potion.Potion;
|
||||
|
||||
public final class BaritoneEntityPlayerSP {
|
||||
private transient EntityPlayerSP entityPlayerSP;
|
||||
private transient Function<Block, Double> function;
|
||||
private transient Map<Block, Double> lookupMap = new HashMap<>();
|
||||
|
||||
public BaritoneEntityPlayerSP(EntityPlayerSP player) {
|
||||
this.entityPlayerSP = player;
|
||||
if (BaritoneCore.getBaritoneSettings().considerPotionEffects.value) {
|
||||
double distance = this.getDistance();
|
||||
Function<Double, Double> function2 = (Double doubleVal2) -> BaritoneEntityPlayerSP.resolveDouble(distance, doubleVal2);
|
||||
this.function = function2.compose((java.util.function.Function<net.minecraft.block.Block, java.lang.Double>) this::resolveDistance3);
|
||||
} else {
|
||||
this.function = (java.util.function.Function<net.minecraft.block.Block, java.lang.Double>) this::resolveDistance3;
|
||||
}
|
||||
}
|
||||
|
||||
private int resolveIndex(ItemStack stack) {
|
||||
if (stack != null && stack.getItem() instanceof ItemTool) {
|
||||
ItemTool itemTool = (ItemTool)stack.getItem();
|
||||
return ToolMaterial.valueOf(itemTool.getToolMaterialName()).ordinal();
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public double resolveDistance(IBlockState state2) {
|
||||
return this.lookupMap.computeIfAbsent(state2.getBlock(), this.function);
|
||||
}
|
||||
|
||||
private static final Double resolveDouble(double amountD, Double doubleVal) {
|
||||
return amountD * doubleVal;
|
||||
}
|
||||
|
||||
private double resolveDistance2(Block block2) {
|
||||
return BaritoneCore.getBaritoneSettings().blocksToAvoidBreaking.value.contains(block2) ? 0.1 : 1.0;
|
||||
}
|
||||
|
||||
private double getDistance() {
|
||||
double amountD = 1.0;
|
||||
if (this.entityPlayerSP.isPotionActive(Potion.digSpeed)) {
|
||||
amountD *= 1.0 + (this.entityPlayerSP.getActivePotionEffect(Potion.digSpeed).getAmplifier() + 1) * (0.2);
|
||||
}
|
||||
|
||||
if (this.entityPlayerSP.isPotionActive(Potion.digSlowdown)) {
|
||||
switch (this.entityPlayerSP.getActivePotionEffect(Potion.digSlowdown).getAmplifier()) {
|
||||
case 0:
|
||||
amountD *= 0.3;
|
||||
break;
|
||||
case 1:
|
||||
amountD *= 0.09;
|
||||
break;
|
||||
case 2:
|
||||
amountD *= 0.0027;
|
||||
break;
|
||||
default:
|
||||
amountD *= 8.1E-4;
|
||||
}
|
||||
}
|
||||
|
||||
return amountD;
|
||||
}
|
||||
|
||||
public byte resolveByte(Block block3) {
|
||||
|
||||
|
||||
byte byteData = 0;
|
||||
double amountD = (Double.NEGATIVE_INFINITY) + 1.957672713E9;
|
||||
int value = Integer.MIN_VALUE;
|
||||
IBlockState state3 = block3.getDefaultState();
|
||||
|
||||
for (byte byteData2 = 0; byteData2 < 9; byteData2++) {
|
||||
ItemStack stack2 = this.entityPlayerSP.inventory.getStackInSlot(byteData2);
|
||||
double amountD2 = resolveDistance4(stack2, state3);
|
||||
if (amountD2 > amountD) {
|
||||
amountD = amountD2;
|
||||
byteData = byteData2;
|
||||
value = this.resolveIndex(stack2);
|
||||
} else if (amountD2 == amountD) {
|
||||
int value2 = this.resolveIndex(stack2);
|
||||
if (value2 < value) {
|
||||
amountD = amountD2;
|
||||
byteData = byteData2;
|
||||
value = value2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return byteData;
|
||||
}
|
||||
|
||||
private double resolveDistance3(Block block4) {
|
||||
|
||||
|
||||
ItemStack stack3 = this.entityPlayerSP.inventory.getStackInSlot(this.resolveByte(block4));
|
||||
return resolveDistance4(stack3, block4.getDefaultState()) * this.resolveDistance2(block4);
|
||||
}
|
||||
|
||||
public static final double resolveDistance4(ItemStack stack4, IBlockState state4) {
|
||||
|
||||
|
||||
|
||||
float blockHardness = state4.getBlock().getBlockHardness(null, null);
|
||||
if (!(blockHardness < 0.0F)) {
|
||||
ItemStack stack5 = stack4;
|
||||
if (stack5 != null) {
|
||||
float strVsBlock = stack4.getStrVsBlock(state4.getBlock());
|
||||
float amountF;
|
||||
int value = (amountF = strVsBlock - 1.0F) == 0.0F ? 0 : (amountF < 0.0F ? -1 : 1);
|
||||
if (value > 0) {
|
||||
int enchantmentLevel = EnchantmentHelper.getEnchantmentLevel(Enchantment.efficiency.effectId, stack4);
|
||||
if (enchantmentLevel > 0 && !ItemStackUtil.canAcceptItemStack(stack4)) {
|
||||
strVsBlock += enchantmentLevel * enchantmentLevel + 1;
|
||||
}
|
||||
}
|
||||
|
||||
strVsBlock /= blockHardness;
|
||||
if (!state4.getBlock().getMaterial().isToolNotRequired()) {
|
||||
boolean enabled = ItemStackUtil.canAcceptItemStack(stack4);
|
||||
if (enabled || !stack4.canHarvestBlock(state4.getBlock())) {
|
||||
return strVsBlock / 100.0F;
|
||||
}
|
||||
}
|
||||
|
||||
return strVsBlock / 30.0F;
|
||||
}
|
||||
}
|
||||
|
||||
return (-1.0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package baritone.api.utils;
|
||||
import baritone.api.movement.BaritoneApiHelper;
|
||||
import baritone.api.pathing.goals.IGoal;
|
||||
|
||||
|
||||
import baritone.api.utils.BetterBlockPos;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public final class BaritoneGuiClientBlock extends BaritoneHelper {
|
||||
private transient List<BetterBlockPos> entries;
|
||||
private transient int offsetPx;
|
||||
private transient IGoal goal;
|
||||
private transient List<BaritoneApiHelper> entries2;
|
||||
|
||||
@Override
|
||||
public List<BetterBlockPos> getList2() {
|
||||
return Collections.unmodifiableList(this.entries);
|
||||
}
|
||||
|
||||
private BaritoneGuiClientBlock(List list, List list2, int offsetPx, IGoal goal) {
|
||||
super();
|
||||
|
||||
|
||||
this.entries = list;
|
||||
this.entries2 = list2;
|
||||
this.offsetPx = offsetPx;
|
||||
this.goal = goal;
|
||||
this.updateState();
|
||||
}
|
||||
|
||||
public static final Optional resolveOptional(BaritoneApi baritoneApi, BaritoneApi baritoneApi2, boolean enabled) {
|
||||
|
||||
|
||||
|
||||
if (baritoneApi2 != null && baritoneApi != null) {
|
||||
if (!baritoneApi.getBetterBlockPos2().equals(baritoneApi2.getBetterBlockPos())) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
HashSet set = new HashSet<>(baritoneApi2.getList2());
|
||||
int value = -1;
|
||||
|
||||
for (int idx = 0; idx < baritoneApi.getIndex() - 1; idx++) {
|
||||
if (set.contains(baritoneApi.getList2().get(idx))) {
|
||||
value = idx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (value != -1) {
|
||||
if (!enabled) {
|
||||
return Optional.empty();
|
||||
}
|
||||
} else {
|
||||
value = baritoneApi.getIndex() - 1;
|
||||
}
|
||||
|
||||
int value2 = baritoneApi2.getList2().indexOf(baritoneApi.getList2().get(value));
|
||||
if (!enabled && value2 != 0) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
ArrayList list = new ArrayList();
|
||||
ArrayList list2 = new ArrayList();
|
||||
list.addAll(baritoneApi.getList2().subList(0, value + 1));
|
||||
list2.addAll(baritoneApi.getList().subList(0, value));
|
||||
list.addAll(baritoneApi2.getList2().subList(value2 + 1, baritoneApi2.getIndex()));
|
||||
list2.addAll(baritoneApi2.getList().subList(value2, baritoneApi2.getIndex() - 1));
|
||||
return Optional.of(new BaritoneGuiClientBlock(list, list2, baritoneApi.getCount() + baritoneApi2.getCount(), baritoneApi.getGuiClientBlockPos()));
|
||||
} else {
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIndex() {
|
||||
return this.entries.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGoal getGuiClientBlockPos() {
|
||||
return this.goal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return this.offsetPx;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BaritoneApiHelper> getList() {
|
||||
return Collections.unmodifiableList(this.entries2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,265 @@
|
||||
package baritone.api.utils;
|
||||
import baritone.api.event.AbstractGameListener;
|
||||
import baritone.api.pathing.goals.IGoal;
|
||||
import baritone.api.process.GuiClientBlockUtil;
|
||||
import baritone.api.process.IBaritoneProcess;
|
||||
import baritone.api.process.PathingCommandType;
|
||||
|
||||
|
||||
import baritone.api.utils.BetterBlockPos;
|
||||
import baritone.pathing.PathExecutor;
|
||||
import baritone.pathing.PathingBehavior;
|
||||
import baritone.pathing.BaritoneCore;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
public final class BaritoneGuiClientHelper implements ISelectionManager {
|
||||
private transient GuiClientBlockUtil guiClientBlockUtil;
|
||||
private transient IBaritoneProcess baritoneProcess;
|
||||
private transient IBaritoneProcess baritoneProcess2;
|
||||
private transient List<IBaritoneProcess> entries;
|
||||
|
||||
private transient BaritoneCore baritoneCore;
|
||||
private static int[] intValueArray;
|
||||
private transient HashSet<IBaritoneProcess> visitedSet;
|
||||
|
||||
public boolean canAcceptGoal(IGoal goal) {
|
||||
PathExecutor pathExecutor = this.baritoneCore.getPathingBehavior().getPathExecutor();
|
||||
if (pathExecutor != null) {
|
||||
return goal.canAcceptBlockPos(pathExecutor.getBaritoneApi().getBetterBlockPos2()) ? false : !goal.toString().equals(pathExecutor.getBaritoneApi().getGuiClientBlockPos().toString());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<IBaritoneProcess> getOptional() {
|
||||
return Optional.ofNullable(this.baritoneProcess2);
|
||||
}
|
||||
|
||||
public BaritoneGuiClientHelper(BaritoneCore baritoneCore) {
|
||||
this.baritoneCore = baritoneCore;
|
||||
this.visitedSet = new HashSet<>();
|
||||
this.entries = new ArrayList<>();
|
||||
baritoneCore.getGameEventHandler().updateGameEventNotifier(new AbstractGameListener(this));
|
||||
}
|
||||
|
||||
public void updateState() {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
this.baritoneProcess = null;
|
||||
this.baritoneProcess2 = null;
|
||||
this.guiClientBlockUtil = null;
|
||||
this.entries.clear();
|
||||
|
||||
for (IBaritoneProcess inactiveApi3 : this.visitedSet) {
|
||||
inactiveApi3.resetState();
|
||||
if (inactiveApi3.isActive2() && !inactiveApi3.isActive()) {
|
||||
throw new IllegalStateException(inactiveApi3.getString2());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canAcceptGoal2(IGoal goal) {
|
||||
PathExecutor pathExecutor = this.baritoneCore.getPathingBehavior().getPathExecutor();
|
||||
if (pathExecutor != null) {
|
||||
IGoal goal2 = pathExecutor.getBaritoneApi().getGuiClientBlockPos();
|
||||
BetterBlockPos pos = pathExecutor.getBaritoneApi().getBetterBlockPos2();
|
||||
if (goal2.canAcceptBlockPos(pos) && !goal.canAcceptBlockPos(pos)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<GuiClientBlockUtil> getOptional2() {
|
||||
return Optional.ofNullable(this.guiClientBlockUtil);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static final void updateBaritoneGuiClientHelper(BaritoneGuiClientHelper baritoneGuiClientHelper) {
|
||||
|
||||
|
||||
baritoneGuiClientHelper.updateState2();
|
||||
}
|
||||
|
||||
public GuiClientBlockUtil getGuiClientBlockUtil() {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
for (IBaritoneProcess inactiveApi4 : this.visitedSet) {
|
||||
if (inactiveApi4.isActive2()) {
|
||||
if (!this.entries.contains(inactiveApi4)) {
|
||||
this.entries.add(0, inactiveApi4);
|
||||
}
|
||||
} else {
|
||||
this.entries.remove(inactiveApi4);
|
||||
}
|
||||
}
|
||||
|
||||
this.entries.sort(Comparator.comparingDouble((java.util.function.ToDoubleFunction<baritone.api.process.IBaritoneProcess>) IBaritoneProcess::getDistance).reversed());
|
||||
Iterator iter = this.entries.iterator();
|
||||
|
||||
while (iter.hasNext()) {
|
||||
IBaritoneProcess inactiveApi5 = (IBaritoneProcess)iter.next();
|
||||
GuiClientBlockUtil guiClientBlockUtil2 = inactiveApi5.resolveGuiClientBlockUtil(
|
||||
Objects.equals(inactiveApi5, this.baritoneProcess) && this.baritoneCore.getPathingBehavior().isHasLinkedBlockingQueue(),
|
||||
this.baritoneCore.getPathingBehavior().isActive2()
|
||||
);
|
||||
if (guiClientBlockUtil2 == null) {
|
||||
if (inactiveApi5.isActive2()) {
|
||||
throw new IllegalStateException(inactiveApi5.getString2() + " actively returned null PathingCommand");
|
||||
}
|
||||
} else if (guiClientBlockUtil2.pathingCommandType != PathingCommandType.DEFER) {
|
||||
this.baritoneProcess2 = inactiveApi5;
|
||||
if (!inactiveApi5.isActive()) {
|
||||
iter.forEachRemaining((java.util.function.Consumer<baritone.api.process.IBaritoneProcess>) IBaritoneProcess::resetState);
|
||||
}
|
||||
|
||||
return guiClientBlockUtil2;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static final int[] getIndexArray() {
|
||||
if (intValueArray != null) {
|
||||
return intValueArray;
|
||||
}
|
||||
|
||||
int[] intValArr = new int[PathingCommandType.values().length];
|
||||
|
||||
try {
|
||||
intValArr[PathingCommandType.CANCEL_AND_SET_GOAL.ordinal()] = 3;
|
||||
} catch (NoSuchFieldError noSuchFieldError) {
|
||||
}
|
||||
|
||||
try {
|
||||
intValArr[PathingCommandType.DEFER.ordinal()] = 6;
|
||||
} catch (NoSuchFieldError noSuchFieldError2) {
|
||||
}
|
||||
|
||||
try {
|
||||
intValArr[PathingCommandType.FORCE_REVALIDATE_GOAL_AND_PATH.ordinal()] = 5;
|
||||
} catch (NoSuchFieldError noSuchFieldError3) {
|
||||
}
|
||||
|
||||
try {
|
||||
intValArr[PathingCommandType.REQUEST_PAUSE.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError noSuchFieldError4) {
|
||||
}
|
||||
|
||||
try {
|
||||
intValArr[PathingCommandType.REVALIDATE_GOAL_AND_PATH.ordinal()] = 4;
|
||||
} catch (NoSuchFieldError noSuchFieldError5) {
|
||||
}
|
||||
|
||||
try {
|
||||
intValArr[PathingCommandType.SET_GOAL_AND_PATH.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError noSuchFieldError6) {
|
||||
}
|
||||
|
||||
intValueArray = intValArr;
|
||||
return intValArr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateBaritoneProcess(IBaritoneProcess inactiveApi6) {
|
||||
inactiveApi6.resetState();
|
||||
this.visitedSet.add(inactiveApi6);
|
||||
}
|
||||
|
||||
private void updateState2() {
|
||||
|
||||
|
||||
if (this.guiClientBlockUtil != null) {
|
||||
PathingBehavior pathingBehavior = this.baritoneCore.getPathingBehavior();
|
||||
switch (getIndexArray()[this.guiClientBlockUtil.pathingCommandType.ordinal()]) {
|
||||
case 4:
|
||||
if (BaritoneCore.getBaritoneSettings().cancelOnGoalInvalidation.value
|
||||
&& (this.guiClientBlockUtil.goal == null || this.canAcceptGoal2(this.guiClientBlockUtil.goal))) {
|
||||
pathingBehavior.updateState4();
|
||||
}
|
||||
|
||||
pathingBehavior.canAcceptGuiClientBlockUtil(this.guiClientBlockUtil);
|
||||
break;
|
||||
case 5:
|
||||
if (this.guiClientBlockUtil.goal == null
|
||||
|| this.canAcceptGoal(this.guiClientBlockUtil.goal)
|
||||
|| this.canAcceptGoal2(this.guiClientBlockUtil.goal)) {
|
||||
pathingBehavior.updateState4();
|
||||
}
|
||||
|
||||
pathingBehavior.canAcceptGuiClientBlockUtil(this.guiClientBlockUtil);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateState3() {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
this.baritoneProcess = this.baritoneProcess2;
|
||||
this.baritoneProcess2 = null;
|
||||
PathingBehavior pathingBehavior = this.baritoneCore.getPathingBehavior();
|
||||
this.guiClientBlockUtil = this.getGuiClientBlockUtil();
|
||||
if (this.guiClientBlockUtil == null) {
|
||||
pathingBehavior.isActive3();
|
||||
pathingBehavior.setGoal((IGoal)null);
|
||||
} else {
|
||||
if (!Objects.equals(this.baritoneProcess2, this.baritoneProcess)
|
||||
&& this.guiClientBlockUtil.pathingCommandType != PathingCommandType.REQUEST_PAUSE
|
||||
&& this.baritoneProcess != null
|
||||
&& !this.baritoneProcess.isActive()) {
|
||||
pathingBehavior.isActive3();
|
||||
}
|
||||
|
||||
switch (getIndexArray()[this.guiClientBlockUtil.pathingCommandType.ordinal()]) {
|
||||
case 1:
|
||||
if (this.guiClientBlockUtil.goal != null) {
|
||||
this.baritoneCore.getPathingBehavior().canAcceptGuiClientBlockUtil(this.guiClientBlockUtil);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
pathingBehavior.resetState();
|
||||
break;
|
||||
case 3:
|
||||
pathingBehavior.setGoal(this.guiClientBlockUtil.goal);
|
||||
pathingBehavior.isActive3();
|
||||
break;
|
||||
case 4:
|
||||
if (!pathingBehavior.isActive4() && !pathingBehavior.getOptional().isPresent()) {
|
||||
pathingBehavior.canAcceptGuiClientBlockUtil(this.guiClientBlockUtil);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
if (!pathingBehavior.isActive4() && !pathingBehavior.getOptional().isPresent()) {
|
||||
pathingBehavior.canAcceptGuiClientBlockUtil(this.guiClientBlockUtil);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package baritone.api.utils;
|
||||
import baritone.api.movement.BlockStateInterface;
|
||||
import baritone.api.pathing.goals.IGoal;
|
||||
|
||||
|
||||
import baritone.pathing.BaritoneCore;
|
||||
import net.minecraft.util.BlockPos;
|
||||
|
||||
public abstract class BaritoneHelper implements BaritoneApi {
|
||||
@Override
|
||||
public BaritoneApi resolveBaritoneApi2(IGoal goal) {
|
||||
|
||||
return this.resolveBaritoneHelper2(goal);
|
||||
}
|
||||
|
||||
public BaritoneHelper resolveBaritoneHelper(Object target) {
|
||||
|
||||
|
||||
|
||||
if (!BaritoneCore.getBaritoneSettings().cutoffAtLoadBoundary.value) {
|
||||
return this;
|
||||
}
|
||||
|
||||
BlockStateInterface blockStateInterface = (BlockStateInterface)target;
|
||||
|
||||
for (int idx = 0; idx < this.getList2().size(); idx++) {
|
||||
BlockPos pos = this.getList2().get(idx);
|
||||
if (!blockStateInterface.canAcceptIndex2(pos.getX(), pos.getZ())) {
|
||||
return new BaritoneHelperEntry(this, idx);
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaritoneApi resolveBaritoneApi(Object target) {
|
||||
|
||||
return this.resolveBaritoneHelper(target);
|
||||
}
|
||||
|
||||
public BaritoneHelper resolveBaritoneHelper2(IGoal goal) {
|
||||
|
||||
|
||||
int value = BaritoneBaritoneSettingsUtil.getBaritoneSettings().pathCutoffMinimumLength.value;
|
||||
if (this.getIndex() < value) {
|
||||
return this;
|
||||
} else if (goal != null && !goal.canAcceptBlockPos(this.getBetterBlockPos2())) {
|
||||
double value2 = BaritoneBaritoneSettingsUtil.getBaritoneSettings().pathCutoffFactor.value;
|
||||
int value3 = (int)((this.getIndex() - value) * value2) + value - 1;
|
||||
return new BaritoneHelperEntry(this, value3);
|
||||
} else {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package baritone.api.utils;
|
||||
import baritone.api.movement.BaritoneApiHelper;
|
||||
import baritone.api.pathing.goals.IGoal;
|
||||
|
||||
|
||||
import baritone.api.utils.BetterBlockPos;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public final class BaritoneHelperEntry extends BaritoneHelper {
|
||||
private transient int count;
|
||||
private transient IGoal goal;
|
||||
private transient List<BetterBlockPos> entries;
|
||||
private transient List<BaritoneApiHelper> entries2;
|
||||
|
||||
@Override
|
||||
public IGoal getGuiClientBlockPos() {
|
||||
return this.goal;
|
||||
}
|
||||
|
||||
public BaritoneHelperEntry(BaritoneApi baritoneApi, int value) {
|
||||
this(baritoneApi, 0, value);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public BaritoneHelperEntry(BaritoneApi baritoneApi2, int value, int value2) {
|
||||
super();
|
||||
|
||||
|
||||
this.entries = baritoneApi2.getList2().subList(value, value2 + 1);
|
||||
this.entries2 = baritoneApi2.getList().subList(value, value2);
|
||||
this.count = baritoneApi2.getCount();
|
||||
this.goal = baritoneApi2.getGuiClientBlockPos();
|
||||
this.updateState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BaritoneApiHelper> getList() {
|
||||
return Collections.unmodifiableList(this.entries2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return this.count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BetterBlockPos> getList2() {
|
||||
return Collections.unmodifiableList(this.entries);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
package baritone.api.utils;
|
||||
|
||||
import baritone.api.utils.BetterBlockPos;
|
||||
import baritone.pathing.BaritoneCore;
|
||||
import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.monster.EntityEnderman;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.entity.monster.EntityPigZombie;
|
||||
import net.minecraft.entity.monster.EntitySpider;
|
||||
import net.minecraft.util.BlockPos;
|
||||
|
||||
public final class BaritoneHelperHandler {
|
||||
|
||||
private transient int count;
|
||||
private transient int count2;
|
||||
private transient int count3;
|
||||
private transient int count4;
|
||||
private transient double coordVal;
|
||||
private transient int count5;
|
||||
|
||||
private static final boolean canAcceptEntity(Entity entity2) {
|
||||
return !(entity2 instanceof EntityEnderman) || ((EntityEnderman)entity2).isScreaming();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static final List resolveList(IPlayerContext playerContext) {
|
||||
|
||||
|
||||
|
||||
if (!BaritoneCore.getBaritoneSettings().avoidance.value) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
ArrayList list = new ArrayList();
|
||||
double value = BaritoneCore.getBaritoneSettings().mobSpawnerAvoidanceCoefficient.value;
|
||||
double value2 = BaritoneCore.getBaritoneSettings().mobAvoidanceCoefficient.value;
|
||||
double amountD;
|
||||
int value3 = (amountD = value - (1.0)) == 0.0 ? 0 : (amountD < 0.0 ? -1 : 1);
|
||||
if (((value3)) != 0) {
|
||||
playerContext.getCachedWorldData()
|
||||
.getCacheBaritoneComponent022()
|
||||
.resolveArrayList("mob_spawner", 1, playerContext.playerFeet().blockX, playerContext.playerFeet().blockZ, 2)
|
||||
.forEach((BlockPos pos3) -> BaritoneHelperHandler.handleList2(list, value, pos3));
|
||||
}
|
||||
|
||||
double amountD2;
|
||||
value3 = (amountD2 = value2 - (1.0)) == 0.0 ? 0 : (amountD2 < 0.0 ? -1 : 1);
|
||||
|
||||
if (((value3)) != 0) {
|
||||
playerContext.world()
|
||||
.loadedEntityList
|
||||
.stream()
|
||||
.filter(BaritoneHelperHandler::canAcceptEntity2)
|
||||
.filter((Entity entity7) -> BaritoneHelperHandler.canAcceptPlayerContext(playerContext, entity7))
|
||||
.filter((java.util.function.Predicate<net.minecraft.entity.Entity>) BaritoneHelperHandler::canAcceptEntity3)
|
||||
.filter((java.util.function.Predicate<net.minecraft.entity.Entity>) BaritoneHelperHandler::canAcceptEntity)
|
||||
.forEach((Entity entity8) -> BaritoneHelperHandler.handleList(list, value2, entity8));
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private static final void handleList(List list, double amountD, Entity entity3) {
|
||||
list.add(new BaritoneHelperHandler(new BlockPos(entity3), amountD, BaritoneCore.getBaritoneSettings().mobAvoidanceRadius.value));
|
||||
}
|
||||
|
||||
// $VF: Irreducible bytecode was duplicated to produce valid code
|
||||
public void updateLong2DoubleOpenHashMap(Long2DoubleOpenHashMap long2DoubleOpenHashMap) {
|
||||
|
||||
int value = -this.count3;
|
||||
if ((value <= this.count3)) {
|
||||
label68:
|
||||
do {
|
||||
int value2 = -this.count3;
|
||||
if ((value2 <= this.count3)) {
|
||||
while (true) {
|
||||
int value3 = -this.count3;
|
||||
|
||||
|
||||
while (true) {
|
||||
while (value3 <= this.count3) {
|
||||
int value4 = value * value + value2 * value2 + value3 * value3;
|
||||
int value5 = this.count3 * this.count3;
|
||||
if (value4 <= value5) {
|
||||
long timestampMs = BetterBlockPos.longHash(this.count2 + value, this.count5 + value2, this.count + value3);
|
||||
long2DoubleOpenHashMap.put(timestampMs, long2DoubleOpenHashMap.get(timestampMs) * this.coordVal);
|
||||
value3++;
|
||||
} else {
|
||||
value3++;
|
||||
}
|
||||
}
|
||||
|
||||
if (++value2 > this.count3) {
|
||||
continue label68;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (++value <= this.count3);
|
||||
}
|
||||
}
|
||||
|
||||
private static final boolean canAcceptPlayerContext(IPlayerContext playerContext, Entity entity4) {
|
||||
return !(entity4 instanceof EntitySpider) || playerContext.player().getBrightness(0.0F) < 0.5;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public BaritoneHelperHandler(int count2, int count5, int count, double coordVal, int count3) {
|
||||
this.count2 = count2;
|
||||
this.count5 = count5;
|
||||
this.count = count;
|
||||
this.coordVal = coordVal;
|
||||
this.count3 = count3;
|
||||
this.count4 = count3 * count3;
|
||||
}
|
||||
|
||||
private static final boolean canAcceptEntity2(Entity entity5) {
|
||||
return entity5 instanceof EntityMob;
|
||||
}
|
||||
|
||||
public double resolveDistance(int posX, int posY, int posZ) {
|
||||
int value = posX - this.count2;
|
||||
int value2 = posY - this.count5;
|
||||
int value3 = posZ - this.count;
|
||||
return value * value + value2 * value2 + value3 * value3 <= this.count4 ? this.coordVal : 1.0;
|
||||
}
|
||||
|
||||
private static final boolean canAcceptEntity3(Entity entity6) {
|
||||
return !(entity6 instanceof EntityPigZombie) || ((EntityPigZombie)entity6).isAngry();
|
||||
}
|
||||
|
||||
public BaritoneHelperHandler(BlockPos pos, double amountD, int value) {
|
||||
this(pos.getX(), pos.getY(), pos.getZ(), amountD, value);
|
||||
}
|
||||
|
||||
private static final void handleList2(List list2, double amountD, BlockPos pos2) {
|
||||
list2.add(new BaritoneHelperHandler(pos2, amountD, BaritoneCore.getBaritoneSettings().mobSpawnerAvoidanceRadius.value));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package baritone.api.utils;
|
||||
import baritone.api.pathing.goals.IGoal;
|
||||
|
||||
|
||||
import baritone.api.utils.BetterBlockPos;
|
||||
|
||||
public final class BaritoneHelperUtil {
|
||||
public transient double coordVal;
|
||||
public transient int calculatedImplausibleField;
|
||||
public transient int count;
|
||||
public transient BaritoneHelperUtil baritoneHelperUtil;
|
||||
|
||||
public transient int count2;
|
||||
public transient double coordVal2;
|
||||
public transient double coordVal3;
|
||||
public transient int count3;
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (int)BetterBlockPos.longHash(this.count, this.count3, this.count2);
|
||||
}
|
||||
|
||||
public BaritoneHelperUtil(int count, int count3, int posZ, IGoal goal) {
|
||||
|
||||
|
||||
this.baritoneHelperUtil = null;
|
||||
this.coordVal2 = 1000000.0;
|
||||
|
||||
this.coordVal3 = goal.resolveDistance(count, count3, posZ);
|
||||
BaritoneHelperUtil baritoneHelperUtil2 = this;
|
||||
if (Double.isNaN(this.coordVal3)) {
|
||||
throw new IllegalStateException(goal + " calculated implausible heuristic");
|
||||
}
|
||||
|
||||
this.calculatedImplausibleField = -1;
|
||||
this.count = count;
|
||||
this.count3 = count3;
|
||||
baritoneHelperUtil2 = this;
|
||||
|
||||
baritoneHelperUtil2.count2 = posZ;
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
return this.calculatedImplausibleField != -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object target) {
|
||||
|
||||
BaritoneHelperUtil baritoneHelperUtil3 = (BaritoneHelperUtil)target;
|
||||
|
||||
int count = this.count;
|
||||
if (this.count == baritoneHelperUtil3.count && this.count3 == baritoneHelperUtil3.count3 && this.count2 == baritoneHelperUtil3.count2) {
|
||||
return true;
|
||||
}
|
||||
|
||||
count = 0;
|
||||
|
||||
return (((count) & 1) != 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package baritone.api.utils;
|
||||
|
||||
public interface BaritoneHelperUtilApi {
|
||||
BaritoneHelperUtil getBaritoneHelperUtil();
|
||||
|
||||
boolean isActive();
|
||||
|
||||
void updateBaritoneHelperUtil(BaritoneHelperUtil baritoneHelperUtil);
|
||||
|
||||
void updateBaritoneHelperUtil2(BaritoneHelperUtil baritoneHelperUtil2);
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package baritone.api.utils;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public final class BaritoneHelperUtilEntry implements BaritoneHelperUtilApi {
|
||||
private transient int count = 0;
|
||||
private transient BaritoneHelperUtil[] baritoneHelperUtilArray;
|
||||
private static int count2;
|
||||
|
||||
@Override
|
||||
public final boolean isActive() {
|
||||
return this.count == 0;
|
||||
}
|
||||
|
||||
public BaritoneHelperUtilEntry(int value) {
|
||||
this.baritoneHelperUtilArray = new BaritoneHelperUtil[value];
|
||||
}
|
||||
|
||||
public BaritoneHelperUtilEntry() {
|
||||
this(1024);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void updateBaritoneHelperUtil(BaritoneHelperUtil baritoneHelperUtil) {
|
||||
if (this.count >= this.baritoneHelperUtilArray.length - 1) {
|
||||
this.baritoneHelperUtilArray = Arrays.copyOf(this.baritoneHelperUtilArray, this.baritoneHelperUtilArray.length << 1);
|
||||
}
|
||||
|
||||
this.count++;
|
||||
baritoneHelperUtil.calculatedImplausibleField = this.count;
|
||||
this.baritoneHelperUtilArray[this.count] = baritoneHelperUtil;
|
||||
this.updateBaritoneHelperUtil2(baritoneHelperUtil);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final BaritoneHelperUtil getBaritoneHelperUtil() {
|
||||
|
||||
if (this.count == 0) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
BaritoneHelperUtil baritoneHelperUtil2 = this.baritoneHelperUtilArray[1];
|
||||
BaritoneHelperUtil baritoneHelperUtil3 = this.baritoneHelperUtilArray[this.count];
|
||||
this.baritoneHelperUtilArray[1] = baritoneHelperUtil3;
|
||||
baritoneHelperUtil3.calculatedImplausibleField = 1;
|
||||
this.baritoneHelperUtilArray[this.count] = null;
|
||||
this.count--;
|
||||
baritoneHelperUtil2.calculatedImplausibleField = -1;
|
||||
if (this.count < 2) {
|
||||
return baritoneHelperUtil2;
|
||||
}
|
||||
|
||||
int value = 1;
|
||||
int value2 = 2;
|
||||
double coordVal = baritoneHelperUtil3.coordVal;
|
||||
|
||||
do {
|
||||
BaritoneHelperUtil baritoneHelperUtil4 = this.baritoneHelperUtilArray[value2];
|
||||
double coordVal2 = baritoneHelperUtil4.coordVal;
|
||||
if (value2 < this.count) {
|
||||
BaritoneHelperUtil baritoneHelperUtil5 = this.baritoneHelperUtilArray[value2 + 1];
|
||||
double coordVal3 = baritoneHelperUtil5.coordVal;
|
||||
if (coordVal2 > coordVal3) {
|
||||
value2++;
|
||||
coordVal2 = coordVal3;
|
||||
baritoneHelperUtil4 = baritoneHelperUtil5;
|
||||
}
|
||||
}
|
||||
|
||||
if (coordVal <= coordVal2) {
|
||||
break;
|
||||
}
|
||||
|
||||
this.baritoneHelperUtilArray[value] = baritoneHelperUtil4;
|
||||
this.baritoneHelperUtilArray[value2] = baritoneHelperUtil3;
|
||||
baritoneHelperUtil3.calculatedImplausibleField = value2;
|
||||
baritoneHelperUtil4.calculatedImplausibleField = value;
|
||||
value = value2;
|
||||
} while ((value2 <<= 1) <= this.count);
|
||||
|
||||
return baritoneHelperUtil2;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return this.count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void updateBaritoneHelperUtil2(BaritoneHelperUtil baritoneHelperUtil6) {
|
||||
int value = baritoneHelperUtil6.calculatedImplausibleField;
|
||||
int value2 = value >>> 1;
|
||||
double coordVal = baritoneHelperUtil6.coordVal;
|
||||
|
||||
for (BaritoneHelperUtil baritoneHelperUtil7 = this.baritoneHelperUtilArray[value2]; value > 1 && baritoneHelperUtil7.coordVal > coordVal; baritoneHelperUtil7 = this.baritoneHelperUtilArray[value2]) {
|
||||
this.baritoneHelperUtilArray[value] = baritoneHelperUtil7;
|
||||
this.baritoneHelperUtilArray[value2] = baritoneHelperUtil6;
|
||||
baritoneHelperUtil6.calculatedImplausibleField = value2;
|
||||
baritoneHelperUtil7.calculatedImplausibleField = value;
|
||||
value = value2;
|
||||
value2 = value >>> 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
package baritone.api.utils;
|
||||
import baritone.api.event.BaritoneTickEvent;
|
||||
import baritone.api.event.BaritoneTickType;
|
||||
import intent.zeroday.util.AbstractListHelper;
|
||||
import intent.zeroday.util.ItemStackUtil;
|
||||
|
||||
|
||||
import baritone.pathing.BaritoneCore;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.OptionalInt;
|
||||
import java.util.Random;
|
||||
import java.util.function.Predicate;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemPickaxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public final class BaritoneItemStackUtil extends BaritoneBaritoneApiUtil {
|
||||
public static ItemStack itemStack = new ItemStack((Item)null);
|
||||
|
||||
private int resolveIndex(Block block2, Class targetClass) {
|
||||
|
||||
|
||||
AbstractListHelper abstractListHelper = new AbstractListHelper<>(Arrays.asList((Object[])this.playerContext.player().inventory.mainInventory), ItemStack.class);
|
||||
int value = -1;
|
||||
double amountD = (-1.0);
|
||||
|
||||
for (int idx = 0; idx < abstractListHelper.size(); idx++) {
|
||||
ItemStack stack = (ItemStack)abstractListHelper.get(idx);
|
||||
if (!ItemStackUtil.canAcceptItemStack(stack) && targetClass.isInstance(stack.getItem())) {
|
||||
double amountD2 = BaritoneEntityPlayerSP.resolveDistance4(stack, block2.getDefaultState());
|
||||
if (amountD2 > amountD) {
|
||||
amountD = amountD2;
|
||||
value = idx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
private static final boolean canAcceptItem(Item item2, ItemStack stack2) {
|
||||
return item2.equals(stack2.getItem());
|
||||
}
|
||||
|
||||
private static final boolean canAcceptBlockState(IBlockState state2, ItemStack stack3) {
|
||||
return stack3.getItem() instanceof ItemBlock && ((ItemBlock)stack3.getItem()).getBlock().equals(state2.getBlock());
|
||||
}
|
||||
|
||||
public boolean canAcceptFlag(boolean enabled, int posX, int posY, int posZ) {
|
||||
|
||||
|
||||
IBlockState state3 = this.baritoneCore.getBuilderProcess().resolveBlockState4(posX, posY, posZ);
|
||||
if (state3 != null && this.canAcceptFlag2(enabled, (ItemStack stack6) -> BaritoneItemStackUtil.canAcceptBlockState(state3, stack6))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (Item item3 : BaritoneCore.getBaritoneSettings().acceptableThrowawayItems.value) {
|
||||
if (this.canAcceptFlag2(enabled, (ItemStack stack7) -> BaritoneItemStackUtil.canAcceptItem2(item3, stack7))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void handleIndex(int value, int value2) {
|
||||
|
||||
|
||||
this.playerContext
|
||||
.playerController()
|
||||
.resolveItemStack(
|
||||
this.playerContext.player().inventoryContainer.windowId,
|
||||
value < 9 ? value + 36 : value,
|
||||
value2,
|
||||
2,
|
||||
this.playerContext.player()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBaritoneTick(BaritoneTickEvent baritoneTickEvent) {
|
||||
|
||||
|
||||
if (BaritoneCore.getBaritoneSettings().allowInventory.value) {
|
||||
if (baritoneTickEvent.getBaritoneTickType() != BaritoneTickType.OUT) {
|
||||
if (this.playerContext.player().openContainer == this.playerContext.player().inventoryContainer) {
|
||||
if (this.getIndex() >= 9) {
|
||||
this.handleIndex(this.getIndex(), 8);
|
||||
}
|
||||
|
||||
int value = this.resolveIndex(Blocks.stone, ItemPickaxe.class);
|
||||
if (value >= 9) {
|
||||
this.handleIndex(value, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canAcceptFlag2(boolean enabled, Predicate<? super ItemStack> predicate) {
|
||||
EntityPlayerSP player = this.playerContext.player();
|
||||
|
||||
for (byte byteData = 0; byteData < 9; byteData++) {
|
||||
ItemStack stack4 = player.inventory.mainInventory[byteData];
|
||||
if (stack4 != null && stack4.getItem() != null && predicate.test(stack4)) {
|
||||
if (enabled) {
|
||||
player.inventory.currentItem = byteData;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static final boolean canAcceptItem2(Item item4, ItemStack stack5) {
|
||||
return item4.equals(stack5.getItem());
|
||||
}
|
||||
|
||||
public void handleIndex2(int value, Predicate predicate2) {
|
||||
|
||||
|
||||
OptionalInt optionalInt = this.resolveOptionalInt(predicate2);
|
||||
if (optionalInt.isPresent()) {
|
||||
this.handleIndex(value, optionalInt.getAsInt());
|
||||
}
|
||||
}
|
||||
|
||||
public BaritoneItemStackUtil(BaritoneCore baritone) {
|
||||
super(baritone);
|
||||
}
|
||||
|
||||
private int getIndex() {
|
||||
AbstractListHelper abstractListHelper2 = new AbstractListHelper<>(Arrays.asList((Object[])this.playerContext.player().inventory.mainInventory), ItemStack.class);
|
||||
|
||||
for (int idx = 0; idx < abstractListHelper2.size(); idx++) {
|
||||
if (abstractListHelper2.get(idx) != null && BaritoneCore.getBaritoneSettings().acceptableThrowawayItems.value.contains(((ItemStack)abstractListHelper2.get(idx)).getItem())) {
|
||||
return idx;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public OptionalInt resolveOptionalInt(Predicate<Integer> predicate3) {
|
||||
|
||||
ArrayList list = new ArrayList();
|
||||
|
||||
for (int idx = 1; idx < 8; idx++) {
|
||||
if (this.playerContext.player().inventory.mainInventory[idx] == null && !predicate3.test(idx)) {
|
||||
list.add(idx);
|
||||
}
|
||||
}
|
||||
|
||||
if (list.isEmpty()) {
|
||||
for (int idx2 = 1; idx2 < 8; idx2++) {
|
||||
if (!predicate3.test(idx2)) {
|
||||
list.add(idx2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list.isEmpty() ? OptionalInt.empty() : OptionalInt.of((Integer)list.get(new Random().nextInt(list.size())));
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
for (Item item5 : BaritoneCore.getBaritoneSettings().acceptableThrowawayItems.value) {
|
||||
if (this.canAcceptFlag2(false, (ItemStack stack8) -> BaritoneItemStackUtil.canAcceptItem(item5, stack8))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package baritone.api.utils;
|
||||
import baritone.api.movement.CalculationContext;
|
||||
|
||||
|
||||
import baritone.api.utils.BetterBlockPos;
|
||||
import baritone.pathing.BaritoneHelperCore;
|
||||
import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap;
|
||||
import java.util.Iterator;
|
||||
|
||||
public final class BaritoneLong2DoubleOpenHash {
|
||||
|
||||
private transient Long2DoubleOpenHashMap long2DoubleOpenHashMap;
|
||||
|
||||
// $VF: Irreducible bytecode was duplicated to produce valid code
|
||||
public BaritoneLong2DoubleOpenHash(IPlayerContext playerContext, BaritoneApi baritoneApi, CalculationContext calcContext) {
|
||||
this(baritoneApi, calcContext);
|
||||
|
||||
|
||||
|
||||
|
||||
Iterator iter = BaritoneHelperHandler.resolveList(playerContext).iterator();
|
||||
|
||||
|
||||
while (true) {
|
||||
Object target;
|
||||
if (!iter.hasNext()) {
|
||||
target = BaritoneHelperCore.a_;
|
||||
BaritoneHelperCore.a_.updateString("Favoring size: " + this.long2DoubleOpenHashMap.size());
|
||||
return;
|
||||
} else {
|
||||
target = iter.next();
|
||||
}
|
||||
|
||||
BaritoneHelperHandler baritoneHelperHandler = (BaritoneHelperHandler)target;
|
||||
baritoneHelperHandler.updateLong2DoubleOpenHashMap(this.long2DoubleOpenHashMap);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
return this.long2DoubleOpenHashMap.isEmpty();
|
||||
}
|
||||
|
||||
public BaritoneLong2DoubleOpenHash(BaritoneApi baritoneApi2, CalculationContext calcContext) {
|
||||
|
||||
this.long2DoubleOpenHashMap = new Long2DoubleOpenHashMap();
|
||||
this.long2DoubleOpenHashMap.defaultReturnValue(1.0);
|
||||
double value5 = calcContext.value5;
|
||||
|
||||
if (value5 != 1.0) {
|
||||
BaritoneApi baritoneApi3 = baritoneApi2;
|
||||
if (baritoneApi2 == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
baritoneApi3 = baritoneApi2;
|
||||
|
||||
baritoneApi3.getList2().forEach((BetterBlockPos pos2) -> this.handleDistance(value5, pos2));
|
||||
}
|
||||
}
|
||||
|
||||
private void handleDistance(double amountD, BetterBlockPos pos) {
|
||||
this.long2DoubleOpenHashMap.put(BetterBlockPos.longHash2(pos), amountD);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public double resolveDistance(long timestampMs) {
|
||||
return this.long2DoubleOpenHashMap.get(timestampMs);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package baritone.api.utils;
|
||||
import intent.zeroday.util.MaterialsHelper;
|
||||
import intent.zeroday.util.module.AutoPlayMinecraftHelper;
|
||||
|
||||
|
||||
import baritone.pathing.BuilderProcess;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.BlockPos;
|
||||
|
||||
public final class BaritoneMinecraftUtil {
|
||||
public static Minecraft minecraft = Minecraft.getMinecraft();
|
||||
|
||||
public static final void handleBlock(Block block2, int value) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
boolean active2 = getBuilderProcess().isActive2();
|
||||
if (!active2) {
|
||||
int value2 = AutoPlayMinecraftHelper.resolveIndex5(Item.getItemFromBlock(block2));
|
||||
if (value2 > 0) {
|
||||
for (int idx = -value; idx < value; idx++) {
|
||||
for (int idx2 = value; idx2 > -value; idx2--) {
|
||||
for (int idx3 = -value; idx3 < value; idx3++) {
|
||||
BlockPos pos = new BlockPos(
|
||||
minecraft.thePlayer.posX + idx, minecraft.thePlayer.posY + idx2, minecraft.thePlayer.posZ + idx3
|
||||
);
|
||||
BlockPos pos2 = new BlockPos(
|
||||
minecraft.thePlayer.posX + idx, minecraft.thePlayer.posY + idx2 - (1.0), minecraft.thePlayer.posZ + idx3
|
||||
);
|
||||
boolean enabled = minecraft.theWorld.getBlockState(pos).getBlock().canPlaceBlockAt(minecraft.theWorld, pos);
|
||||
if (enabled && minecraft.theWorld.getBlockState(pos2).getBlock().isBlockNormalCube()) {
|
||||
getBuilderProcess()
|
||||
.handleString(block2.getLocalizedName(), new MaterialsHelper(1, 1, 1, new IBlockState[][][]{{{block2.getDefaultState()}}}), pos);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final BuilderProcess getBuilderProcess() {
|
||||
return (BuilderProcess)BaritoneBaritoneSettingsUtil.getGuiZeroEntityPlayer().getBaritoneCore().getBuilderProcess2();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package baritone.api.utils;
|
||||
import baritone.api.event.BaritoneEventState;
|
||||
import baritone.api.event.PlayerUpdateEvent;
|
||||
import baritone.api.event.RotationMovePhase;
|
||||
import baritone.api.event.RotationMoveStateEvent;
|
||||
import baritone.api.movement.ILookBehavior;
|
||||
|
||||
|
||||
import baritone.pathing.BaritoneCore;
|
||||
|
||||
public final class BaritonePitchHelperHelper extends BaritoneBaritoneApiUtil implements ILookBehavior {
|
||||
private static int[] intValueArray;
|
||||
private transient float targetYaw;
|
||||
private transient PlayerRotation playerRotation;
|
||||
private transient boolean hasValue;
|
||||
|
||||
public void updateState2() {
|
||||
if (this.playerRotation != null) {
|
||||
this.playerContext.player().rotationYaw = this.playerRotation.getYaw();
|
||||
}
|
||||
}
|
||||
|
||||
public BaritonePitchHelperHelper(BaritoneCore baritone) {
|
||||
super(baritone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRotationMoveState(RotationMoveStateEvent rotationMoveStateEvent) {
|
||||
if (this.playerRotation != null) {
|
||||
rotationMoveStateEvent.setFactor(this.playerRotation.getYaw());
|
||||
if (!BaritoneCore.getBaritoneSettings().antiCheatCompatibility.value
|
||||
&& rotationMoveStateEvent.getRotationMovePhase() == RotationMovePhase.MOTION_UPDATE
|
||||
&& !this.hasValue) {
|
||||
this.playerRotation = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateState3() {
|
||||
if (this.playerContext.player().rotationPitch < -20.0F) {
|
||||
this.playerContext.player().rotationPitch++;
|
||||
} else if (this.playerContext.player().rotationPitch > 10.0F) {
|
||||
this.playerContext.player().rotationPitch--;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerUpdate(PlayerUpdateEvent playerUpdateEvent) {
|
||||
|
||||
if (this.playerRotation != null) {
|
||||
if (BaritoneCore.getBaritoneSettings().antiCheatCompatibility.value && !this.hasValue) {
|
||||
switch (getIndexArray()[playerUpdateEvent.getBaritoneEventState().ordinal()]) {
|
||||
case 1:
|
||||
if (this.hasValue) {
|
||||
this.playerContext.player().rotationYaw = this.playerRotation.getYaw();
|
||||
float pitch = this.playerContext.player().rotationPitch;
|
||||
float pitch2 = this.playerRotation.getPitch();
|
||||
this.playerContext.player().rotationPitch = pitch2;
|
||||
if (pitch2 == pitch && !BaritoneCore.getBaritoneSettings().freeLook.value) {
|
||||
this.updateState3();
|
||||
}
|
||||
|
||||
this.playerRotation = null;
|
||||
} else {
|
||||
this.updateState3();
|
||||
}
|
||||
|
||||
this.targetYaw = this.playerContext.player().rotationYaw;
|
||||
this.playerContext.player().rotationYaw = this.playerRotation.getYaw();
|
||||
break;
|
||||
case 2:
|
||||
this.playerContext.player().rotationYaw = this.targetYaw;
|
||||
this.playerRotation = null;
|
||||
}
|
||||
} else {
|
||||
switch (getIndexArray()[playerUpdateEvent.getBaritoneEventState().ordinal()]) {
|
||||
case 1:
|
||||
if (this.hasValue) {
|
||||
this.playerContext.player().rotationYaw = this.playerRotation.getYaw();
|
||||
float pitch3 = this.playerContext.player().rotationPitch;
|
||||
float pitch4 = this.playerRotation.getPitch();
|
||||
this.playerContext.player().rotationPitch = pitch4;
|
||||
if (pitch4 == pitch3 && !BaritoneCore.getBaritoneSettings().freeLook.value) {
|
||||
this.updateState3();
|
||||
}
|
||||
|
||||
this.playerRotation = null;
|
||||
} else {
|
||||
this.updateState3();
|
||||
}
|
||||
case 2:
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final int[] getIndexArray() {
|
||||
if (intValueArray != null) {
|
||||
return intValueArray;
|
||||
}
|
||||
|
||||
int[] intValArr = new int[BaritoneEventState.values().length];
|
||||
|
||||
try {
|
||||
intValArr[BaritoneEventState.POST.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError noSuchFieldError) {
|
||||
}
|
||||
|
||||
try {
|
||||
intValArr[BaritoneEventState.PRE.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError noSuchFieldError2) {
|
||||
}
|
||||
|
||||
intValueArray = intValArr;
|
||||
return intValArr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlePlayerRotation(PlayerRotation playerRotation, boolean enabled) {
|
||||
this.playerRotation = playerRotation;
|
||||
this.hasValue = enabled || !BaritoneCore.getBaritoneSettings().freeLook.value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package baritone.api.utils;
|
||||
import intent.zeroday.ui.component.GuiZeroEntityPlayer;
|
||||
|
||||
|
||||
import baritone.pathing.BaritoneCore;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public final class BaritoneProviderImpl implements GuiZeroEntityPlayer {
|
||||
private transient List<IBaritone> entries;
|
||||
private transient BaritoneCore baritoneCore = new BaritoneCore();
|
||||
|
||||
@Override
|
||||
public IBaritone getBaritoneCore() {
|
||||
return this.baritoneCore;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaritoneApiUtilApi getBaritoneApiUtilApi() {
|
||||
return BaritoneType.INSTANCE;
|
||||
}
|
||||
|
||||
public BaritoneProviderImpl() {
|
||||
this.entries = Collections.singletonList(this.baritoneCore);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IBaritone> getEntries() {
|
||||
return this.entries;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package baritone.api.utils;
|
||||
|
||||
import net.minecraft.util.*;
|
||||
|
||||
import intent.zeroday.util.EntityUtilHelper;
|
||||
import baritone.api.utils.IBaritone;
|
||||
import baritone.api.utils.IPlayerContext;
|
||||
import intent.zeroday.util.BlockUtilHelper;
|
||||
import intent.zeroday.util.MathHelperExt;
|
||||
import baritone.api.utils.BaritoneBaritoneSettingsUtil;
|
||||
import intent.zeroday.util.MovingObjectPositionUtil;
|
||||
import baritone.api.utils.PlayerRotation;
|
||||
import java.util.Optional;
|
||||
import net.minecraft.block.BlockFire;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
|
||||
|
||||
public final class BaritoneRotationUtil {
|
||||
public static double coordVal;
|
||||
private static Vec3[] vec3Array = new Vec3[]{
|
||||
new Vec3(0.5, 0.0, 0.5),
|
||||
new Vec3(0.5, 1.0, 0.5),
|
||||
new Vec3(0.5, 0.5, 0.0),
|
||||
new Vec3(0.5, 0.5, 1.0),
|
||||
new Vec3(0.0, 0.5, 0.5),
|
||||
new Vec3(1.0, 0.5, 0.5)
|
||||
};
|
||||
public static double coordVal2;
|
||||
|
||||
public static final PlayerRotation transformPlayerRotation(PlayerRotation rotation, PlayerRotation rotation2) {
|
||||
return rotation.canAcceptPlayerRotation(rotation2)
|
||||
? new PlayerRotation(rotation.getYaw(), rotation2.getPitch())
|
||||
: rotation2.subtract(rotation).withNormalizedYaw().add(rotation);
|
||||
}
|
||||
|
||||
public static final Optional resolveOptional(EntityPlayerSP player, BlockPos pos, double amountD) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
IBaritone baritone = BaritoneBaritoneSettingsUtil.getGuiZeroEntityPlayer().resolveBaritone(player);
|
||||
|
||||
if (baritone.getBaritoneApiUtil().canAcceptBlockPos(pos)) {
|
||||
return Optional.of(new PlayerRotation(player.rotationYaw, player.rotationPitch + 1.0E-4F));
|
||||
}
|
||||
|
||||
Optional optional = resolveOptional4((Entity)player, pos, amountD);
|
||||
Optional optional2 = optional;
|
||||
if (!optional.isPresent()) {
|
||||
IBlockState state2 = player.worldObj.getBlockState(pos);
|
||||
AxisAlignedBB box = BlockUtilHelper.resolveAxisAlignedBB(state2);
|
||||
Vec3[] vecArr = vec3Array;
|
||||
int length = vec3Array.length;
|
||||
|
||||
for (int idx = 0; idx < length; idx++) {
|
||||
Vec3 vec = vecArr[idx];
|
||||
double amountD2 = box.minX * vec.xCoord + box.maxX * (1.0 - vec.xCoord);
|
||||
double amountD3 = box.minY * vec.yCoord + box.maxY * (1.0 - vec.yCoord);
|
||||
double amountD4 = box.minZ * vec.zCoord + box.maxZ * (1.0 - vec.zCoord);
|
||||
optional = resolveOptional3(player, pos, new Vec3(pos.getX(), pos.getY(), pos.getZ()).addVector(amountD2, amountD3, amountD4), amountD);
|
||||
if (optional.isPresent()) {
|
||||
return optional;
|
||||
}
|
||||
}
|
||||
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
optional2 = optional;
|
||||
|
||||
return optional2;
|
||||
}
|
||||
|
||||
public static final Optional resolveOptional2(IPlayerContext playerContext, BlockPos pos2) {
|
||||
|
||||
|
||||
return resolveOptional(playerContext.player(), pos2, playerContext.playerController().getDistance());
|
||||
}
|
||||
|
||||
private static final PlayerRotation resolvePlayerRotation(Vec3 vec2, Vec3 vec3) {
|
||||
double[] doubleValArr = new double[]{vec2.xCoord - vec3.xCoord, vec2.yCoord - vec3.yCoord, vec2.zCoord - vec3.zCoord};
|
||||
double amountD = MathHelperExt.transformDistance3(doubleValArr[0], -doubleValArr[2]);
|
||||
double distance = Math.sqrt(doubleValArr[0] * doubleValArr[0] + doubleValArr[2] * doubleValArr[2]);
|
||||
double amountD2 = MathHelperExt.transformDistance3(doubleValArr[1], distance);
|
||||
return new PlayerRotation((float)(amountD * (57.29577951308232)), (float)(amountD2 * (57.29577951308232)));
|
||||
}
|
||||
|
||||
public static final PlayerRotation resolvePlayerRotation2(BlockPos pos3, BlockPos pos4) {
|
||||
return resolvePlayerRotation(new Vec3(pos3.getX(), pos3.getY(), pos3.getZ()), new Vec3(pos4.getX(), pos4.getY(), pos4.getZ()));
|
||||
}
|
||||
|
||||
public static final Vec3 resolveVec3(PlayerRotation rotation) {
|
||||
float amountF = MathHelperExt.transformAngle(-rotation.getYaw() * (float) (Math.PI / 180.0) - (float) Math.PI);
|
||||
float amountF2 = MathHelperExt.transformAngle6(-rotation.getYaw() * (float) (Math.PI / 180.0) - (float) Math.PI);
|
||||
float amountF3 = -MathHelperExt.transformAngle(-rotation.getPitch() * (float) (Math.PI / 180.0));
|
||||
float amountF4 = MathHelperExt.transformAngle6(-rotation.getPitch() * (float) (Math.PI / 180.0));
|
||||
return new Vec3(amountF2 * amountF3, amountF4, amountF * amountF3);
|
||||
}
|
||||
|
||||
public static final PlayerRotation resolvePlayerRotation3(Vec3 vec4, Vec3 vec5, PlayerRotation rotation) {
|
||||
return transformPlayerRotation(rotation, resolvePlayerRotation(vec4, vec5));
|
||||
}
|
||||
|
||||
private BaritoneRotationUtil() {
|
||||
}
|
||||
|
||||
public static final Optional resolveOptional3(Entity entity2, BlockPos pos5, Vec3 vec6, double amountD) {
|
||||
|
||||
|
||||
|
||||
PlayerRotation rotation = resolvePlayerRotation3(entity2.getPositionEyes(1.0F), vec6, new PlayerRotation(entity2.rotationYaw, entity2.rotationPitch));
|
||||
MovingObjectPosition movingObjectPosition = MovingObjectPositionUtil.resolveMovingObjectPosition(entity2, rotation, amountD);
|
||||
if (movingObjectPosition != null && movingObjectPosition.typeOfHit == MovingObjectType.BLOCK) {
|
||||
if (movingObjectPosition.getBlockPos().equals(pos5)) {
|
||||
return Optional.of(rotation);
|
||||
}
|
||||
|
||||
if (entity2.worldObj.getBlockState(pos5).getBlock() instanceof BlockFire && movingObjectPosition.getBlockPos().equals(pos5.down())) {
|
||||
return Optional.of(rotation);
|
||||
}
|
||||
}
|
||||
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
public static final Optional resolveOptional4(Entity entity3, BlockPos pos6, double amountD) {
|
||||
|
||||
|
||||
|
||||
return resolveOptional3(entity3, pos6, EntityUtilHelper.resolveVec3(entity3.worldObj, pos6), amountD);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
package baritone.api.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.IntStream;
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.SecretKeyFactory;
|
||||
import javax.crypto.spec.DESKeySpec;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.multiplayer.ChunkProviderClient;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||
|
||||
public enum BaritoneType implements BaritoneApiUtilApi {
|
||||
@com.google.gson.annotations.SerializedName("gMZV3AYRhqbS") INSTANCE;
|
||||
|
||||
private static int[] intValueArray;
|
||||
|
||||
public List resolveList2(IPlayerContext playerContext, List list, int posX, int posY, int posZ) {
|
||||
|
||||
if (list.contains(null)) {
|
||||
return new ArrayList();
|
||||
}
|
||||
|
||||
ArrayList list2 = new ArrayList();
|
||||
if (list.isEmpty()) {
|
||||
return list2;
|
||||
}
|
||||
|
||||
ChunkProviderClient chunkProviderClient = (ChunkProviderClient)playerContext.world().getChunkProvider();
|
||||
int value = posZ * posZ;
|
||||
int value2 = playerContext.playerFeet().getX() >> 4;
|
||||
int value3 = playerContext.playerFeet().getZ() >> 4;
|
||||
int posY2 = playerContext.playerFeet().getY();
|
||||
int value4 = posY2 >> 4;
|
||||
int[] intValArr = IntStream.range(0, 16).boxed().sorted(Comparator.comparingInt((Integer integer3) -> BaritoneType.transformIndex(value4, integer3))).mapToInt(BaritoneType::resolveIndex).toArray();
|
||||
int value5 = 0;
|
||||
boolean enabled = false;
|
||||
|
||||
while (true) {
|
||||
boolean enabled2 = true;
|
||||
boolean enabled3 = false;
|
||||
|
||||
for (int idx = -value5; idx <= value5; idx++) {
|
||||
for (int idx2 = -value5; idx2 <= value5; idx2++) {
|
||||
int value6 = idx * idx + idx2 * idx2;
|
||||
int value7 = value5;
|
||||
int value8 = value6;
|
||||
if (value8 == value7) {
|
||||
enabled3 = true;
|
||||
int value9 = idx + value2;
|
||||
int value10 = idx2 + value3;
|
||||
Chunk chunk2 = (Chunk)chunkProviderClient.chunkMapping.getValueByKey(ChunkCoordIntPair.chunkXZ2Int(value9, value10));
|
||||
if (chunk2 != null) {
|
||||
enabled2 = false;
|
||||
boolean enabled4 = this.canAcceptIndex(value9 << 4, value10 << 4, chunk2, list, list2, posX, posY, posY2, intValArr);
|
||||
if (enabled4) {
|
||||
enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean enabled5 = enabled2;
|
||||
if (enabled5 && enabled3 || list2.size() >= posX && (value5 > value || value5 > 1 && enabled)) {
|
||||
return list2;
|
||||
}
|
||||
|
||||
value5++;
|
||||
}
|
||||
}
|
||||
|
||||
private static final String a(byte[] byteValArr) {
|
||||
int value = 0;
|
||||
int length;
|
||||
char[] charValArr = new char[length = byteValArr.length];
|
||||
|
||||
for (int idx = 0; idx < length; idx++) {
|
||||
int value2;
|
||||
if ((value2 = 255 & byteValArr[idx]) < 192) {
|
||||
charValArr[value++] = (char)value2;
|
||||
} else if (value2 < 224) {
|
||||
char charCode = (char)((char)(value2 & 31) << 6);
|
||||
byte byteData = byteValArr[++idx];
|
||||
charCode = (char)(charCode | (char)(byteData & 63));
|
||||
charValArr[value++] = charCode;
|
||||
} else if (idx < length - 2) {
|
||||
char charCode2 = (char)((char)(value2 & 15) << '\f');
|
||||
byte byteData2 = byteValArr[++idx];
|
||||
charCode2 = (char)(charCode2 | (char)(byteData2 & 63) << 6);
|
||||
byteData2 = byteValArr[++idx];
|
||||
charCode2 = (char)(charCode2 | (char)(byteData2 & 63));
|
||||
charValArr[value++] = charCode2;
|
||||
}
|
||||
}
|
||||
|
||||
return new String(charValArr, 0, value);
|
||||
}
|
||||
|
||||
private boolean canAcceptIndex(int value, int value2, Chunk chunk3, List<Block> list2, Collection<BlockPos> collection, int posX, int posY, int posZ, int[] intValArr2) {
|
||||
ExtendedBlockStorage[] extendedBlockStorageArr = chunk3.getBlockStorageArray();
|
||||
boolean enabled = false;
|
||||
|
||||
for (int idx = 0; idx < 16; idx++) {
|
||||
int value3 = intValArr2[idx];
|
||||
ExtendedBlockStorage extendedBlockStorage = extendedBlockStorageArr[value3];
|
||||
if (extendedBlockStorage != null && extendedBlockStorage.getData() != null) {
|
||||
int value4 = value3 << 4;
|
||||
|
||||
for (int idx2 = 0; idx2 < 16; idx2++) {
|
||||
for (int idx3 = 0; idx3 < 16; idx3++) {
|
||||
for (int idx4 = 0; idx4 < 16; idx4++) {
|
||||
IBlockState state2 = extendedBlockStorage.get(idx4, idx2, idx3);
|
||||
if (list2.contains(state2.getBlock())) {
|
||||
int value5 = value4 | idx2;
|
||||
if (collection.size() >= posX) {
|
||||
if (Math.abs(value5 - posZ) < posY) {
|
||||
enabled = true;
|
||||
} else if (enabled) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
collection.add(new BlockPos(value | idx4, value5, value2 | idx3));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return enabled;
|
||||
}
|
||||
|
||||
private static final int resolveIndex(Integer integer) {
|
||||
return integer;
|
||||
}
|
||||
|
||||
private static final int transformIndex(int value, Integer integer2) {
|
||||
return Math.abs(integer2 - value);
|
||||
}
|
||||
|
||||
static {
|
||||
intValueArray = IntStream.range(0, 16).toArray();
|
||||
}
|
||||
|
||||
|
||||
public List resolveList(IPlayerContext playerContext, List list3, ChunkCoordIntPair chunkCoordIntPair, int value, int value2) {
|
||||
|
||||
if (list3.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
} else {
|
||||
ChunkProviderClient chunkProviderClient2 = (ChunkProviderClient)playerContext.world().getChunkProvider();
|
||||
Chunk chunk4 = (Chunk)chunkProviderClient2.chunkMapping.getValueByKey(ChunkCoordIntPair.chunkXZ2Int(chunkCoordIntPair.chunkXPos, chunkCoordIntPair.chunkZPos));
|
||||
int posY = playerContext.playerFeet().getY();
|
||||
if (chunk4 != null && !chunk4.isEmpty()) {
|
||||
ArrayList list = new ArrayList();
|
||||
this.canAcceptIndex(chunkCoordIntPair.chunkXPos << 4, chunkCoordIntPair.chunkZPos << 4, chunk4, list3, list, value, value2, posY, intValueArray);
|
||||
return list;
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,241 @@
|
||||
package baritone.api.utils;
|
||||
import intent.zeroday.util.BitSetHelper;
|
||||
import intent.zeroday.util.BlockUtilHelper;
|
||||
import intent.zeroday.util.ChunkFaceMask;
|
||||
|
||||
|
||||
import baritone.pathing.MovementHelper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.BitSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDoublePlant;
|
||||
import net.minecraft.block.BlockFlower;
|
||||
import net.minecraft.block.BlockLiquid;
|
||||
import net.minecraft.block.BlockTallGrass;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||
|
||||
public final class BaritoneUtil {
|
||||
private static int[] intValueArray;
|
||||
|
||||
public static final IBlockState resolveBlockState(ChunkFaceMask chunkFaceMask, int value) {
|
||||
switch (getIndexArray()[chunkFaceMask.ordinal()]) {
|
||||
case 1:
|
||||
return Blocks.air.getDefaultState();
|
||||
case 2:
|
||||
return Blocks.water.getDefaultState();
|
||||
case 3:
|
||||
return Blocks.lava.getDefaultState();
|
||||
case 4:
|
||||
switch (value) {
|
||||
case -1:
|
||||
return Blocks.netherrack.getDefaultState();
|
||||
case 0:
|
||||
default:
|
||||
return Blocks.stone.getDefaultState();
|
||||
case 1:
|
||||
return Blocks.end_stone.getDefaultState();
|
||||
}
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// $VF: Irreducible bytecode was duplicated to produce valid code
|
||||
public static final BitSetHelper resolveBitSetHelper(Chunk chunk2) {
|
||||
|
||||
|
||||
|
||||
|
||||
Entity[] entityArr = null;
|
||||
HashMap map = new HashMap();
|
||||
BitSet bitSet = new BitSet(131072);
|
||||
Entity[] entityArr2 = entityArr;
|
||||
|
||||
try {
|
||||
ExtendedBlockStorage[] extendedBlockStorageArr = chunk2.getBlockStorageArray();
|
||||
int value = 0;
|
||||
if ((value < 16)) {
|
||||
do {
|
||||
ExtendedBlockStorage extendedBlockStorage = extendedBlockStorageArr[value];
|
||||
if ((extendedBlockStorage == null)) {
|
||||
value++;
|
||||
} else {
|
||||
int value2 = value << 4;
|
||||
int value3 = 0;
|
||||
if ((value3 >= 16)) {
|
||||
value++;
|
||||
} else {
|
||||
do {
|
||||
int value4 = value3 | value2;
|
||||
int value5 = 0;
|
||||
if ((value5 < 16)) {
|
||||
do {
|
||||
int value6 = 0;
|
||||
if ((value6 < 16)) {
|
||||
do {
|
||||
int value7 = BitSetHelper.transformIndex(value6, value4, value5);
|
||||
IBlockState state2 = extendedBlockStorage.get(value6, value3, value5);
|
||||
boolean[] booleanValArr = resolveChunkFaceMask(state2, chunk2, value6, value4, value5).getEnabledFlagArray();
|
||||
bitSet.set(value7, booleanValArr[0]);
|
||||
bitSet.set(value7 + 1, booleanValArr[1]);
|
||||
Block block2 = state2.getBlock();
|
||||
if (BitSetHelper.immutableSet.contains(block2)) {
|
||||
String str = BlockUtilHelper.resolveString(block2);
|
||||
((java.util.List) map.computeIfAbsent(str, (java.util.function.Function<java.lang.String, java.util.List>) BaritoneUtil::resolveList)).add(new BlockPos(value6, value4, value5));
|
||||
}
|
||||
} while (++value6 < 16);
|
||||
}
|
||||
} while (++value5 < 16);
|
||||
}
|
||||
} while (++value3 < 16);
|
||||
|
||||
value++;
|
||||
}
|
||||
}
|
||||
} while (value < 16);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
IBlockState[] stateArr = new IBlockState[256];
|
||||
int value8 = 0;
|
||||
if ((value8 >= 16)) {
|
||||
return new BitSetHelper(chunk2.xPosition, chunk2.zPosition, bitSet, stateArr, map, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
do {
|
||||
int value9 = 0;
|
||||
if ((value9 < 16)) {
|
||||
label134:
|
||||
do {
|
||||
int value10 = 255;
|
||||
if ((value10 < 0)) {
|
||||
stateArr[value8 << 4 | value9] = Blocks.air.getDefaultState();
|
||||
|
||||
value9++;
|
||||
} else {
|
||||
do {
|
||||
int value11 = BitSetHelper.transformIndex(value9, value10, value8);
|
||||
if (!bitSet.get(value11)) {
|
||||
if (bitSet.get(value11 + 1)) {
|
||||
stateArr[value8 << 4 | value9] = chunk2.getBlockState(new BlockPos(value9, value10, value8));
|
||||
if (entityArr2 == null) {
|
||||
value9++;
|
||||
continue label134;
|
||||
}
|
||||
|
||||
value10--;
|
||||
} else {
|
||||
value10--;
|
||||
}
|
||||
} else {
|
||||
stateArr[value8 << 4 | value9] = chunk2.getBlockState(new BlockPos(value9, value10, value8));
|
||||
if (entityArr2 == null) {
|
||||
value9++;
|
||||
continue label134;
|
||||
}
|
||||
|
||||
value10--;
|
||||
}
|
||||
} while (value10 >= 0);
|
||||
|
||||
stateArr[value8 << 4 | value9] = Blocks.air.getDefaultState();
|
||||
|
||||
value9++;
|
||||
}
|
||||
} while (value9 < 16);
|
||||
}
|
||||
} while (++value8 < 16);
|
||||
|
||||
return new BitSetHelper(chunk2.xPosition, chunk2.zPosition, bitSet, stateArr, map, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
private static final List resolveList(String str) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
private static final ChunkFaceMask resolveChunkFaceMask(IBlockState state3, Chunk chunk3, int posX, int posY, int posZ) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Block block3 = state3.getBlock();
|
||||
if (block3 != Blocks.water && block3 != Blocks.flowing_water) {
|
||||
if (MovementHelper.canAcceptBlock2(block3) || MovementHelper.canAcceptBlockState3(state3)) {
|
||||
return ChunkFaceMask.AVOID;
|
||||
} else {
|
||||
return block3 != Blocks.air
|
||||
&& !(block3 instanceof BlockTallGrass)
|
||||
&& !(block3 instanceof BlockDoublePlant)
|
||||
&& !(block3 instanceof BlockFlower)
|
||||
? ChunkFaceMask.SOLID
|
||||
: ChunkFaceMask.AIR;
|
||||
}
|
||||
} else {
|
||||
if (MovementHelper.canAcceptBlockState4(state3)) {
|
||||
return ChunkFaceMask.AVOID;
|
||||
}
|
||||
|
||||
if ((posX == 15 || !MovementHelper.canAcceptBlockState4(chunk3.getBlockState(new BlockPos(posX + 1, posY, posZ))))
|
||||
&& (posX == 0 || !MovementHelper.canAcceptBlockState4(chunk3.getBlockState(new BlockPos(posX - 1, posY, posZ))))
|
||||
&& (posZ == 15 || !MovementHelper.canAcceptBlockState4(chunk3.getBlockState(new BlockPos(posX, posY, posZ + 1))))
|
||||
&& (posZ == 0 || !MovementHelper.canAcceptBlockState4(chunk3.getBlockState(new BlockPos(posX, posY, posZ - 1))))) {
|
||||
if (posX != 0 && posX != 15 && posZ != 0 && posZ != 15) {
|
||||
return ChunkFaceMask.WATER;
|
||||
} else {
|
||||
return BlockLiquid.getFlowDirection(
|
||||
chunk3.getWorld(), new BlockPos(posX + chunk3.xPosition << 4, posY, posZ + chunk3.zPosition << 4), state3.getBlock().getMaterial()
|
||||
)
|
||||
== (-1000.0)
|
||||
? ChunkFaceMask.WATER
|
||||
: ChunkFaceMask.AVOID;
|
||||
}
|
||||
} else {
|
||||
return ChunkFaceMask.AVOID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private BaritoneUtil() {
|
||||
}
|
||||
|
||||
public static final int[] getIndexArray() {
|
||||
if (intValueArray != null) {
|
||||
return intValueArray;
|
||||
}
|
||||
|
||||
int[] intValArr = new int[ChunkFaceMask.values().length];
|
||||
|
||||
try {
|
||||
intValArr[ChunkFaceMask.AIR.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError noSuchFieldError) {
|
||||
}
|
||||
|
||||
try {
|
||||
intValArr[ChunkFaceMask.AVOID.ordinal()] = 3;
|
||||
} catch (NoSuchFieldError noSuchFieldError2) {
|
||||
}
|
||||
|
||||
try {
|
||||
intValArr[ChunkFaceMask.SOLID.ordinal()] = 4;
|
||||
} catch (NoSuchFieldError noSuchFieldError3) {
|
||||
}
|
||||
|
||||
try {
|
||||
intValArr[ChunkFaceMask.WATER.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError noSuchFieldError4) {
|
||||
}
|
||||
|
||||
intValueArray = intValArr;
|
||||
return intValArr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package baritone.api.utils;
|
||||
import intent.zeroday.util.BlockPosApiUtil;
|
||||
import intent.zeroday.util.IBlockStateEntry;
|
||||
import intent.zeroday.util.WouldHelper;
|
||||
|
||||
|
||||
import baritone.pathing.CachedWorld;
|
||||
import baritone.pathing.BaritoneCore;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
|
||||
public final class BaritoneWorldData implements ICachedWorldData {
|
||||
public transient int count;
|
||||
public transient CachedWorld cachedWorld;
|
||||
private transient ContainerMemoryStore containerMemoryStore;
|
||||
private transient WouldHelper waypointsWouldHelper;
|
||||
public transient Path path;
|
||||
|
||||
private void syncStorage() {
|
||||
System.out.println("Started saving saved containers in a new thread");
|
||||
|
||||
try {
|
||||
this.containerMemoryStore.syncStorage();
|
||||
} catch (IOException ioException) {
|
||||
ioException.printStackTrace();
|
||||
System.out.println("Failed to save saved containers");
|
||||
}
|
||||
}
|
||||
|
||||
public BaritoneWorldData(Path path2, int count) {
|
||||
|
||||
|
||||
|
||||
|
||||
this.path = path2;
|
||||
this.cachedWorld = new CachedWorld(path2.resolve("cache"), count);
|
||||
this.waypointsWouldHelper = new WouldHelper(path2.resolve("waypoints"));
|
||||
this.containerMemoryStore = new ContainerMemoryStore(path2.resolve("containers"));
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public void updateState() {
|
||||
BaritoneCore.getBaritoneThreadPoolExecutor().execute(this::syncStorage2);
|
||||
BaritoneCore.getBaritoneThreadPoolExecutor().execute(this::syncStorage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IContainerMemory getContainersBaritoneHelper2() {
|
||||
return this.containerMemoryStore;
|
||||
}
|
||||
|
||||
private void syncStorage2() {
|
||||
|
||||
|
||||
System.out.println("Started saving the world in a new thread");
|
||||
this.cachedWorld.syncStorage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockStateEntry getCacheBaritoneComponent022() {
|
||||
return this.cachedWorld;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPosApiUtil getWaypointsWouldHelper() {
|
||||
return this.waypointsWouldHelper;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
package baritone.api.utils;
|
||||
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3i;
|
||||
|
||||
public final class BetterBlockPos
|
||||
extends BlockPos {
|
||||
public transient int blockY;
|
||||
public transient int blockZ;
|
||||
public transient int blockX;
|
||||
|
||||
public BlockPos west(int value) {
|
||||
return this.westBy(value);
|
||||
}
|
||||
|
||||
public static final long longHash(int posX, int posY, int posZ) {
|
||||
long timestampMs = 3241L;
|
||||
long timestampMs2 = 3457689L * 3241L + (long)posX;
|
||||
long timestampMs3 = 8734625L * timestampMs2 + (long)posY;
|
||||
long timestampMs4 = 2873465L * timestampMs3 + (long)posZ;
|
||||
return timestampMs4;
|
||||
}
|
||||
|
||||
public BetterBlockPos northBy(int value) {
|
||||
return value == 0 ? this : new BetterBlockPos(this.blockX, this.blockY, this.blockZ - value);
|
||||
}
|
||||
|
||||
public BlockPos down() {
|
||||
return this.downPos();
|
||||
}
|
||||
|
||||
public BlockPos offset(EnumFacing enumFacing, int value) {
|
||||
return this.offsetFacing2(enumFacing, value);
|
||||
}
|
||||
|
||||
public BetterBlockPos westBy(int value) {
|
||||
return value == 0 ? this : new BetterBlockPos(this.blockX - value, this.blockY, this.blockZ);
|
||||
}
|
||||
|
||||
public BetterBlockPos(double posX, double posY, double posZ) {
|
||||
this(MathHelper.floor_double((double)posX), MathHelper.floor_double((double)posY), MathHelper.floor_double((double)posZ));
|
||||
}
|
||||
|
||||
public BetterBlockPos(BlockPos blockPos) {
|
||||
this(blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
||||
}
|
||||
|
||||
public BlockPos south() {
|
||||
return this.southPos();
|
||||
}
|
||||
|
||||
public BetterBlockPos eastBy(int value) {
|
||||
return value == 0 ? this : new BetterBlockPos(this.blockX + value, this.blockY, this.blockZ);
|
||||
}
|
||||
|
||||
public BetterBlockPos westPos() {
|
||||
return new BetterBlockPos(this.blockX - 1, this.blockY, this.blockZ);
|
||||
}
|
||||
|
||||
public BetterBlockPos eastPos() {
|
||||
return new BetterBlockPos(this.blockX + 1, this.blockY, this.blockZ);
|
||||
}
|
||||
|
||||
public BetterBlockPos downBy(int value) {
|
||||
return value == 0 ? this : new BetterBlockPos(this.blockX, this.blockY - value, this.blockZ);
|
||||
}
|
||||
|
||||
public BlockPos down(int value) {
|
||||
return this.downBy(value);
|
||||
}
|
||||
|
||||
public BlockPos east() {
|
||||
return this.eastPos();
|
||||
}
|
||||
|
||||
public BlockPos north() {
|
||||
return this.northPos();
|
||||
}
|
||||
|
||||
public BlockPos east(int value) {
|
||||
return this.eastBy(value);
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return (int)BetterBlockPos.longHash(this.blockX, this.blockY, this.blockZ);
|
||||
}
|
||||
|
||||
public static final long longHash2(BetterBlockPos betterBlockPos) {
|
||||
return BetterBlockPos.longHash(betterBlockPos.blockX, betterBlockPos.blockY, betterBlockPos.blockZ);
|
||||
}
|
||||
|
||||
public BetterBlockPos southPos() {
|
||||
return new BetterBlockPos(this.blockX, this.blockY, this.blockZ + 1);
|
||||
}
|
||||
|
||||
public BlockPos up(int value) {
|
||||
return this.upBy(value);
|
||||
}
|
||||
|
||||
public BlockPos north(int value) {
|
||||
return this.northBy(value);
|
||||
}
|
||||
|
||||
public BetterBlockPos upBy(int value) {
|
||||
return value == 0 ? this : new BetterBlockPos(this.blockX, this.blockY + value, this.blockZ);
|
||||
}
|
||||
|
||||
public BlockPos west() {
|
||||
return this.westPos();
|
||||
}
|
||||
|
||||
public boolean equals(Object target) {
|
||||
Object target2 = target;
|
||||
if (target2 == null) {
|
||||
return false;
|
||||
}
|
||||
Object target3 = target;
|
||||
if (target3 instanceof BetterBlockPos) {
|
||||
BetterBlockPos betterBlockPos = (BetterBlockPos)((Object)target);
|
||||
return betterBlockPos.blockX == this.blockX && betterBlockPos.blockY == this.blockY && betterBlockPos.blockZ == this.blockZ;
|
||||
}
|
||||
BlockPos blockPos = (BlockPos)target;
|
||||
int posX = blockPos.getX();
|
||||
return posX == this.blockX && blockPos.getY() == this.blockY && blockPos.getZ() == this.blockZ;
|
||||
}
|
||||
|
||||
public BlockPos south(int value) {
|
||||
return this.resolveBetterBlockPos(value);
|
||||
}
|
||||
|
||||
public BetterBlockPos(int blockX, int blockY, int blockZ) {
|
||||
super(blockX, blockY, blockZ);
|
||||
this.blockX = blockX;
|
||||
this.blockY = blockY;
|
||||
this.blockZ = blockZ;
|
||||
}
|
||||
|
||||
public BlockPos up() {
|
||||
return this.upPos();
|
||||
}
|
||||
|
||||
public BetterBlockPos offsetFacing(EnumFacing enumFacing) {
|
||||
Vec3i vec3i = enumFacing.getDirectionVec();
|
||||
return new BetterBlockPos(this.blockX + vec3i.getX(), this.blockY + vec3i.getY(), this.blockZ + vec3i.getZ());
|
||||
}
|
||||
|
||||
public BetterBlockPos upPos() {
|
||||
return new BetterBlockPos(this.blockX, this.blockY + 1, this.blockZ);
|
||||
}
|
||||
|
||||
public BetterBlockPos northPos() {
|
||||
return new BetterBlockPos(this.blockX, this.blockY, this.blockZ - 1);
|
||||
}
|
||||
|
||||
public BlockPos offset(EnumFacing enumFacing) {
|
||||
return this.offsetFacing(enumFacing);
|
||||
}
|
||||
|
||||
public BetterBlockPos downPos() {
|
||||
return new BetterBlockPos(this.blockX, this.blockY - 1, this.blockZ);
|
||||
}
|
||||
|
||||
public BetterBlockPos resolveBetterBlockPos(int value) {
|
||||
return value == 0 ? this : new BetterBlockPos(this.blockX, this.blockY, this.blockZ + value);
|
||||
}
|
||||
|
||||
public BetterBlockPos offsetFacing2(EnumFacing enumFacing, int value) {
|
||||
if (value == 0) {
|
||||
return this;
|
||||
}
|
||||
Vec3i vec3i = enumFacing.getDirectionVec();
|
||||
return new BetterBlockPos(this.blockX + vec3i.getX() * value, this.blockY + vec3i.getY() * value, this.blockZ + vec3i.getZ() * value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
package baritone.api.utils;
|
||||
|
||||
import baritone.pathing.BaritoneCore;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.NoSuchFileException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Map.Entry;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.BlockPos;
|
||||
|
||||
public final class ContainerMemoryStore implements IContainerMemory {
|
||||
private transient Map<BlockPos, TrackedInventory> lookupMap;
|
||||
private transient Path path;
|
||||
|
||||
public synchronized void syncStorage() throws IOException {
|
||||
|
||||
if (BaritoneCore.getBaritoneSettings().containerMemory.value) {
|
||||
ByteBuf byteBuf = Unpooled.buffer(0, Integer.MAX_VALUE);
|
||||
PacketBuffer packetBuffer = new PacketBuffer(byteBuf);
|
||||
packetBuffer.writeInt(this.lookupMap.size());
|
||||
|
||||
for (Entry mapEntry : this.lookupMap.entrySet()) {
|
||||
packetBuffer = new PacketBuffer(packetBuffer.writeInt(((BlockPos)mapEntry.getKey()).getX()));
|
||||
packetBuffer = new PacketBuffer(packetBuffer.writeInt(((BlockPos)mapEntry.getKey()).getY()));
|
||||
packetBuffer = new PacketBuffer(packetBuffer.writeInt(((BlockPos)mapEntry.getKey()).getZ()));
|
||||
packetBuffer = resolvePacketBuffer(((TrackedInventory)mapEntry.getValue()).getList(), packetBuffer);
|
||||
}
|
||||
|
||||
Files.write(this.path, packetBuffer.array());
|
||||
}
|
||||
}
|
||||
|
||||
public static final byte[] resolveByteArray(List<ItemStack> list) {
|
||||
ByteBuf byteBuf2 = Unpooled.buffer(0, Integer.MAX_VALUE);
|
||||
PacketBuffer packetBuffer2 = new PacketBuffer(byteBuf2);
|
||||
packetBuffer2 = resolvePacketBuffer(list, packetBuffer2);
|
||||
return packetBuffer2.array();
|
||||
}
|
||||
|
||||
public static final PacketBuffer resolvePacketBuffer(List<ItemStack> list2, PacketBuffer packetBuffer3) {
|
||||
PacketBuffer packetBuffer4 = packetBuffer3;
|
||||
packetBuffer4 = new PacketBuffer(packetBuffer4.writeInt(list2.size()));
|
||||
|
||||
for (ItemStack stack : list2) {
|
||||
packetBuffer4.writeItemStackToBuffer(stack);
|
||||
}
|
||||
|
||||
return packetBuffer4;
|
||||
}
|
||||
|
||||
private void updateByteArray(byte[] byteValArr) throws IOException {
|
||||
|
||||
|
||||
PacketBuffer packetBuffer5 = new PacketBuffer(Unpooled.wrappedBuffer(byteValArr));
|
||||
int value = packetBuffer5.readInt();
|
||||
|
||||
for (int idx = 0; idx < value; idx++) {
|
||||
int value2 = packetBuffer5.readInt();
|
||||
int value3 = packetBuffer5.readInt();
|
||||
int value4 = packetBuffer5.readInt();
|
||||
TrackedInventory trackedInventory = new TrackedInventory(null);
|
||||
TrackedInventory.resolveList(trackedInventory).addAll(resolveList(packetBuffer5));
|
||||
TrackedInventory.handleTrackedInventory(trackedInventory, TrackedInventory.resolveList(trackedInventory).size());
|
||||
TrackedInventory.handleTrackedInventory2(trackedInventory, -1);
|
||||
if (!TrackedInventory.resolveList(trackedInventory).isEmpty()) {
|
||||
this.lookupMap.put(new BlockPos(value2, value3, value4), trackedInventory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void handleBlockPos(BlockPos pos, int value, int value2) {
|
||||
TrackedInventory trackedInventory = this.lookupMap.computeIfAbsent(pos, ContainerMemoryStore::resolveTrackedInventory);
|
||||
TrackedInventory.handleTrackedInventory2(trackedInventory, value);
|
||||
TrackedInventory.handleTrackedInventory(trackedInventory, value2);
|
||||
}
|
||||
|
||||
private static final TrackedInventory resolveTrackedInventory(BlockPos pos2) {
|
||||
return new TrackedInventory(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final synchronized Map<BlockPos, ITrackedInventory> getMap() {
|
||||
return new HashMap<>(this.lookupMap);
|
||||
}
|
||||
|
||||
public synchronized Optional<TrackedInventory> resolveOptional(int value) {
|
||||
return this.lookupMap.values().stream().filter(((trackedInventory) -> ContainerMemoryStore.canAcceptIndex(value, trackedInventory))).findFirst();
|
||||
}
|
||||
|
||||
public static final List resolveList(PacketBuffer packetBuffer6) throws IOException {
|
||||
|
||||
|
||||
int value = packetBuffer6.readInt();
|
||||
ArrayList list = new ArrayList();
|
||||
|
||||
for (int idx = 0; idx < value; idx++) {
|
||||
list.add(packetBuffer6.readItemStackFromBuffer());
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public ContainerMemoryStore(Path path2) {
|
||||
|
||||
|
||||
this.lookupMap = new HashMap<>();
|
||||
this.path = path2;
|
||||
|
||||
try {
|
||||
this.updateByteArray(Files.readAllBytes(path2));
|
||||
} catch (NoSuchFileException noSuchFileException) {
|
||||
this.lookupMap.clear();
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
this.lookupMap.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public final synchronized TrackedInventory resolveTrackedInventory2(BlockPos pos3) {
|
||||
return this.lookupMap.get(pos3);
|
||||
}
|
||||
|
||||
private static final boolean canAcceptIndex(int value, TrackedInventory trackedInventory) {
|
||||
return TrackedInventory.resolveIndex(trackedInventory) == value;
|
||||
}
|
||||
|
||||
public static final List resolveList2(byte[] byteValArr2) throws IOException {
|
||||
|
||||
|
||||
PacketBuffer packetBuffer7 = new PacketBuffer(Unpooled.wrappedBuffer(byteValArr2));
|
||||
return resolveList(packetBuffer7);
|
||||
}
|
||||
|
||||
public ITrackedInventory resolveTrackedInventory3(BlockPos pos4) {
|
||||
return this.resolveTrackedInventory2(pos4);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package baritone.api.utils;
|
||||
import baritone.api.event.IBaritoneEventBus;
|
||||
import baritone.api.movement.IInputOverrideHandler;
|
||||
import baritone.api.movement.ILookBehavior;
|
||||
import baritone.api.movement.IPathingBehavior;
|
||||
import baritone.api.process.IBuilderProcess;
|
||||
import baritone.api.process.ICustomGoalProcess;
|
||||
import baritone.api.process.IExploreProcess;
|
||||
import baritone.api.process.IFarmProcess;
|
||||
import baritone.api.process.IFishProcess;
|
||||
import baritone.api.process.IFollowProcess;
|
||||
import baritone.api.process.IGetToBlockProcess;
|
||||
import baritone.api.process.IMineProcess;
|
||||
|
||||
|
||||
public interface IBaritone {
|
||||
IMineProcess getMineProcess();
|
||||
|
||||
IFollowProcess getFollowProcess();
|
||||
|
||||
void updateState();
|
||||
|
||||
IBuilderProcess getBuilderProcess2();
|
||||
|
||||
IInputOverrideHandler getInputOverrideHandler();
|
||||
|
||||
IExploreProcess getExploreProcess();
|
||||
|
||||
ICustomGoalProcess getCustomGoalProcess2();
|
||||
|
||||
IFarmProcess getFarmProcess2();
|
||||
|
||||
ISelectionManager getSelectionManager();
|
||||
|
||||
IPathingBehavior getPathingBehavior2();
|
||||
|
||||
ILookBehavior getLookBehavior();
|
||||
|
||||
IBaritoneEventBus getGameEventHandler();
|
||||
|
||||
IFishProcess getFishProcess2();
|
||||
|
||||
IPlayerContext getBaritoneApiUtil();
|
||||
|
||||
IGetToBlockProcess getGetToBlockProcess();
|
||||
|
||||
void updateState3();
|
||||
|
||||
IBaritoneWorldProvider getBaritoneWorldProvider2();
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package baritone.api.utils;
|
||||
|
||||
public interface IBaritoneWorldProvider {
|
||||
ICachedWorldData getCachedWorldData();
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package baritone.api.utils;
|
||||
import intent.zeroday.util.BlockPosApiUtil;
|
||||
import intent.zeroday.util.IBlockStateEntry;
|
||||
|
||||
|
||||
public interface ICachedWorldData {
|
||||
IContainerMemory getContainersBaritoneHelper2();
|
||||
|
||||
IBlockStateEntry getCacheBaritoneComponent022();
|
||||
|
||||
BlockPosApiUtil getWaypointsWouldHelper();
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package baritone.api.utils;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public interface IChunkLoaderAccess {
|
||||
File getFileRef();
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package baritone.api.utils;
|
||||
|
||||
import java.util.Map;
|
||||
import net.minecraft.util.BlockPos;
|
||||
|
||||
public interface IContainerMemory {
|
||||
ITrackedInventory resolveTrackedInventory3(BlockPos pos);
|
||||
|
||||
Map<BlockPos, ITrackedInventory> getMap();
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package baritone.api.utils;
|
||||
|
||||
import baritone.api.utils.BetterBlockPos;
|
||||
import java.util.Optional;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IPlayerContext {
|
||||
IPlayerController playerController();
|
||||
|
||||
default Vec3 playerHead() {
|
||||
return new Vec3(this.player().posX, this.player().posY + this.player().getEyeHeight(), this.player().posZ);
|
||||
}
|
||||
|
||||
EntityPlayerSP player();
|
||||
|
||||
default Optional getOptional() {
|
||||
|
||||
|
||||
|
||||
|
||||
MovingObjectPosition movingObjectPosition = this.objectMouseOver();
|
||||
|
||||
|
||||
MovingObjectPosition movingObjectPosition2 = movingObjectPosition;
|
||||
if (movingObjectPosition2 != null) {
|
||||
MovingObjectPosition movingObjectPosition3 = movingObjectPosition;
|
||||
if (movingObjectPosition3.typeOfHit == MovingObjectType.BLOCK) {
|
||||
return Optional.of(movingObjectPosition.getBlockPos());
|
||||
}
|
||||
}
|
||||
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
default boolean canAcceptBlockPos(BlockPos pos) {
|
||||
|
||||
|
||||
return this.getOptional().equals(Optional.of(pos));
|
||||
}
|
||||
|
||||
default BetterBlockPos playerFeet() {
|
||||
|
||||
|
||||
BetterBlockPos pos2 = new BetterBlockPos(this.player().posX, this.player().posY + 0.1251, this.player().posZ);
|
||||
return this.world().getBlockState(pos2).getBlock() instanceof BlockSlab ? pos2.upPos() : pos2;
|
||||
}
|
||||
|
||||
World world();
|
||||
|
||||
MovingObjectPosition objectMouseOver();
|
||||
|
||||
default PlayerRotation playerRotations() {
|
||||
return new PlayerRotation(this.player().rotationYaw, this.player().rotationPitch);
|
||||
}
|
||||
|
||||
ICachedWorldData getCachedWorldData();
|
||||
|
||||
default Vec3 getVec3() {
|
||||
return new Vec3(this.player().posX, this.player().posY, this.player().posZ);
|
||||
}
|
||||
|
||||
default Optional getOptional2() {
|
||||
|
||||
|
||||
|
||||
|
||||
MovingObjectPosition movingObjectPosition4 = this.objectMouseOver();
|
||||
|
||||
|
||||
MovingObjectPosition movingObjectPosition5 = movingObjectPosition4;
|
||||
if (movingObjectPosition5 != null) {
|
||||
MovingObjectPosition movingObjectPosition6 = movingObjectPosition4;
|
||||
if (movingObjectPosition6.typeOfHit == MovingObjectType.ENTITY) {
|
||||
return Optional.of(movingObjectPosition4.entityHit);
|
||||
}
|
||||
}
|
||||
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package baritone.api.utils;
|
||||
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldSettings.GameType;
|
||||
|
||||
public interface IPlayerController {
|
||||
ItemStack resolveItemStack(int value, int value2, int value3, int value4, EntityPlayer player2);
|
||||
|
||||
boolean canAcceptBlockPos(BlockPos pos, EnumFacing enumFacing);
|
||||
|
||||
boolean canAcceptEntityPlayerSP2(EntityPlayerSP player3, World world2, BlockPos pos2, EnumFacing enumFacing2, Vec3 vec);
|
||||
|
||||
void updateState();
|
||||
|
||||
void updateWorldSettingsGameType(GameType gameType);
|
||||
|
||||
GameType getWorldSettingsGameType();
|
||||
|
||||
default double getDistance() {
|
||||
return this.getWorldSettingsGameType().isCreative() ? 5.0F : 4.5F;
|
||||
}
|
||||
|
||||
boolean canAcceptEntityPlayerSP(EntityPlayerSP player4, World world3);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package baritone.api.utils;
|
||||
import baritone.api.process.GuiClientBlockUtil;
|
||||
import baritone.api.process.IBaritoneProcess;
|
||||
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public interface ISelectionManager {
|
||||
void updateBaritoneProcess(IBaritoneProcess inactiveApi);
|
||||
|
||||
Optional<GuiClientBlockUtil> getOptional2();
|
||||
|
||||
Optional<IBaritoneProcess> getOptional();
|
||||
}
|
||||
Loaded 100 of 7398 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user