mirror of https://github.com/cabaletta/baritone
Baritone 1.16.1
This commit is contained in:
parent
6e78384bcf
commit
854985e5b5
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
group 'baritone'
|
group 'baritone'
|
||||||
version '1.5.3'
|
version '1.6.1'
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
|
@ -85,7 +85,7 @@ task sourceJar(type: Jar, dependsOn: classes) {
|
||||||
}
|
}
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
mappings channel: 'snapshot', version: '20200515-1.15.1'
|
mappings channel: 'snapshot', version: '20200514-1.16'
|
||||||
|
|
||||||
if (getProject().hasProperty("baritone.forge_build")) {
|
if (getProject().hasProperty("baritone.forge_build")) {
|
||||||
reobfMappings 'searge'
|
reobfMappings 'searge'
|
||||||
|
@ -146,7 +146,7 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
minecraft 'com.github.ImpactDevelopment:Vanilla:1.15.2'
|
minecraft 'com.github.ImpactDevelopment:Vanilla:1.16.1'
|
||||||
|
|
||||||
runtime launchCompile('net.minecraft:launchwrapper:1.12') {
|
runtime launchCompile('net.minecraft:launchwrapper:1.12') {
|
||||||
exclude module: 'lwjgl'
|
exclude module: 'lwjgl'
|
||||||
|
|
|
@ -23,7 +23,7 @@ import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.util.math.Vec3i;
|
import net.minecraft.util.math.vector.Vector3i;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
@ -757,7 +757,7 @@ public final class Settings {
|
||||||
/**
|
/**
|
||||||
* How far to move before repeating the build. 0 to disable repeating on a certain axis, 0,0,0 to disable entirely
|
* How far to move before repeating the build. 0 to disable repeating on a certain axis, 0,0,0 to disable entirely
|
||||||
*/
|
*/
|
||||||
public final Setting<Vec3i> buildRepeat = new Setting<>(new Vec3i(0, 0, 0));
|
public final Setting<Vector3i> buildRepeat = new Setting<>(new Vector3i(0, 0, 0));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* How many times to buildrepeat. -1 for infinite.
|
* How many times to buildrepeat. -1 for infinite.
|
||||||
|
|
|
@ -36,7 +36,7 @@ public enum ForDirection implements IDatatypeFor<Direction> {
|
||||||
public Stream<String> tabComplete(IDatatypeContext ctx) throws CommandException {
|
public Stream<String> tabComplete(IDatatypeContext ctx) throws CommandException {
|
||||||
return new TabCompleteHelper()
|
return new TabCompleteHelper()
|
||||||
.append(Stream.of(Direction.values())
|
.append(Stream.of(Direction.values())
|
||||||
.map(Direction::getName).map(String::toLowerCase))
|
.map(Direction::getName2).map(String::toLowerCase))
|
||||||
.filterPrefix(ctx.getConsumer().getString())
|
.filterPrefix(ctx.getConsumer().getString())
|
||||||
.stream();
|
.stream();
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import baritone.api.command.exception.CommandInvalidTypeException;
|
||||||
import baritone.api.command.argument.IArgConsumer;
|
import baritone.api.command.argument.IArgConsumer;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.util.text.StringTextComponent;
|
import net.minecraft.util.text.StringTextComponent;
|
||||||
|
import net.minecraft.util.text.TextComponent;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.util.text.event.ClickEvent;
|
import net.minecraft.util.text.event.ClickEvent;
|
||||||
import net.minecraft.util.text.event.HoverEvent;
|
import net.minecraft.util.text.event.HoverEvent;
|
||||||
|
@ -74,40 +75,40 @@ public class Paginator<E> implements Helper {
|
||||||
}
|
}
|
||||||
boolean hasPrevPage = commandPrefix != null && validPage(page - 1);
|
boolean hasPrevPage = commandPrefix != null && validPage(page - 1);
|
||||||
boolean hasNextPage = commandPrefix != null && validPage(page + 1);
|
boolean hasNextPage = commandPrefix != null && validPage(page + 1);
|
||||||
ITextComponent prevPageComponent = new StringTextComponent("<<");
|
TextComponent prevPageComponent = new StringTextComponent("<<");
|
||||||
if (hasPrevPage) {
|
if (hasPrevPage) {
|
||||||
prevPageComponent.getStyle()
|
prevPageComponent.func_230530_a_(prevPageComponent.getStyle()
|
||||||
.setClickEvent(new ClickEvent(
|
.func_240715_a_(new ClickEvent(
|
||||||
ClickEvent.Action.RUN_COMMAND,
|
ClickEvent.Action.RUN_COMMAND,
|
||||||
String.format("%s %d", commandPrefix, page - 1)
|
String.format("%s %d", commandPrefix, page - 1)
|
||||||
))
|
))
|
||||||
.setHoverEvent(new HoverEvent(
|
.func_240716_a_(new HoverEvent(
|
||||||
HoverEvent.Action.SHOW_TEXT,
|
HoverEvent.Action.field_230550_a_,
|
||||||
new StringTextComponent("Click to view previous page")
|
new StringTextComponent("Click to view previous page")
|
||||||
));
|
)));
|
||||||
} else {
|
} else {
|
||||||
prevPageComponent.getStyle().setColor(TextFormatting.DARK_GRAY);
|
prevPageComponent.func_230530_a_(prevPageComponent.getStyle().func_240712_a_(TextFormatting.DARK_GRAY));
|
||||||
}
|
}
|
||||||
ITextComponent nextPageComponent = new StringTextComponent(">>");
|
TextComponent nextPageComponent = new StringTextComponent(">>");
|
||||||
if (hasNextPage) {
|
if (hasNextPage) {
|
||||||
nextPageComponent.getStyle()
|
nextPageComponent.func_230530_a_(nextPageComponent.getStyle()
|
||||||
.setClickEvent(new ClickEvent(
|
.func_240715_a_(new ClickEvent(
|
||||||
ClickEvent.Action.RUN_COMMAND,
|
ClickEvent.Action.RUN_COMMAND,
|
||||||
String.format("%s %d", commandPrefix, page + 1)
|
String.format("%s %d", commandPrefix, page + 1)
|
||||||
))
|
))
|
||||||
.setHoverEvent(new HoverEvent(
|
.func_240716_a_(new HoverEvent(
|
||||||
HoverEvent.Action.SHOW_TEXT,
|
HoverEvent.Action.field_230550_a_,
|
||||||
new StringTextComponent("Click to view next page")
|
new StringTextComponent("Click to view next page")
|
||||||
));
|
)));
|
||||||
} else {
|
} else {
|
||||||
nextPageComponent.getStyle().setColor(TextFormatting.DARK_GRAY);
|
nextPageComponent.func_230530_a_(nextPageComponent.getStyle().func_240712_a_(TextFormatting.DARK_GRAY));
|
||||||
}
|
}
|
||||||
ITextComponent pagerComponent = new StringTextComponent("");
|
TextComponent pagerComponent = new StringTextComponent("");
|
||||||
pagerComponent.getStyle().setColor(TextFormatting.GRAY);
|
pagerComponent.func_230530_a_(pagerComponent.getStyle().func_240712_a_(TextFormatting.GRAY));
|
||||||
pagerComponent.appendSibling(prevPageComponent);
|
pagerComponent.func_230529_a_(prevPageComponent); // appendSibling
|
||||||
pagerComponent.appendText(" | ");
|
pagerComponent.func_240702_b_(" | "); // appendText
|
||||||
pagerComponent.appendSibling(nextPageComponent);
|
pagerComponent.func_230529_a_(nextPageComponent);
|
||||||
pagerComponent.appendText(String.format(" %d/%d", page, getMaxPage()));
|
pagerComponent.func_240702_b_(String.format(" %d/%d", page, getMaxPage()));
|
||||||
logDirect(pagerComponent);
|
logDirect(pagerComponent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
package baritone.api.event.events;
|
package baritone.api.event.events;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import net.minecraft.client.renderer.Matrix4f;
|
import net.minecraft.util.math.vector.Matrix4f;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Brady
|
* @author Brady
|
||||||
|
|
|
@ -19,7 +19,7 @@ package baritone.api.event.events;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Brady
|
* @author Brady
|
||||||
|
@ -70,7 +70,7 @@ public final class RotationMoveEvent {
|
||||||
/**
|
/**
|
||||||
* Called when the player's motion is updated.
|
* Called when the player's motion is updated.
|
||||||
*
|
*
|
||||||
* @see Entity#moveRelative(float, Vec3d)
|
* @see Entity#moveRelative(float, Vector3d)
|
||||||
*/
|
*/
|
||||||
MOTION_UPDATE,
|
MOTION_UPDATE,
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ import net.minecraft.client.gui.screen.DeathScreen;
|
||||||
import net.minecraft.client.world.ClientWorld;
|
import net.minecraft.client.world.ClientWorld;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.network.IPacket;
|
import net.minecraft.network.IPacket;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Brady
|
* @author Brady
|
||||||
|
@ -106,7 +106,7 @@ public interface IGameEventListener {
|
||||||
* and before and after the player jumps.
|
* and before and after the player jumps.
|
||||||
*
|
*
|
||||||
* @param event The event
|
* @param event The event
|
||||||
* @see Entity#moveRelative(float, Vec3d)
|
* @see Entity#moveRelative(float, Vector3d)
|
||||||
*/
|
*/
|
||||||
void onPlayerRotationMove(RotationMoveEvent event);
|
void onPlayerRotationMove(RotationMoveEvent event);
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ import baritone.api.BaritoneAPI;
|
||||||
import baritone.api.utils.BetterBlockPos;
|
import baritone.api.utils.BetterBlockPos;
|
||||||
import baritone.api.utils.SettingsUtil;
|
import baritone.api.utils.SettingsUtil;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Useful for long-range goals that don't have a specific Y level.
|
* Useful for long-range goals that don't have a specific Y level.
|
||||||
|
@ -94,7 +94,7 @@ public class GoalXZ implements Goal {
|
||||||
return (diagonal + straight) * BaritoneAPI.getSettings().costHeuristic.value; // big TODO tune
|
return (diagonal + straight) * BaritoneAPI.getSettings().costHeuristic.value; // big TODO tune
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GoalXZ fromDirection(Vec3d origin, float yaw, double distance) {
|
public static GoalXZ fromDirection(Vector3d origin, float yaw, double distance) {
|
||||||
float theta = (float) Math.toRadians(yaw);
|
float theta = (float) Math.toRadians(yaw);
|
||||||
double x = origin.x - MathHelper.sin(theta) * distance;
|
double x = origin.x - MathHelper.sin(theta) * distance;
|
||||||
double z = origin.z + MathHelper.cos(theta) * distance;
|
double z = origin.z + MathHelper.cos(theta) * distance;
|
||||||
|
|
|
@ -21,7 +21,7 @@ import baritone.api.schematic.ISchematic;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3i;
|
import net.minecraft.util.math.vector.Vector3i;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -39,7 +39,7 @@ public interface IBuilderProcess extends IBaritoneProcess {
|
||||||
* @param schematic The object representation of the schematic
|
* @param schematic The object representation of the schematic
|
||||||
* @param origin The origin position of the schematic being built
|
* @param origin The origin position of the schematic being built
|
||||||
*/
|
*/
|
||||||
void build(String name, ISchematic schematic, Vec3i origin);
|
void build(String name, ISchematic schematic, Vector3i origin);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Requests a build for the specified schematic, labeled as specified, with the specified origin.
|
* Requests a build for the specified schematic, labeled as specified, with the specified origin.
|
||||||
|
@ -49,7 +49,7 @@ public interface IBuilderProcess extends IBaritoneProcess {
|
||||||
* @param origin The origin position of the schematic being built
|
* @param origin The origin position of the schematic being built
|
||||||
* @return Whether or not the schematic was able to load from file
|
* @return Whether or not the schematic was able to load from file
|
||||||
*/
|
*/
|
||||||
boolean build(String name, File schematic, Vec3i origin);
|
boolean build(String name, File schematic, Vector3i origin);
|
||||||
|
|
||||||
default boolean build(String schematicFile, BlockPos origin) {
|
default boolean build(String schematicFile, BlockPos origin) {
|
||||||
File file = new File(new File(Minecraft.getInstance().gameDir, "schematics"), schematicFile);
|
File file = new File(new File(Minecraft.getInstance().gameDir, "schematics"), schematicFile);
|
||||||
|
|
|
@ -20,7 +20,7 @@ package baritone.api.selection;
|
||||||
import baritone.api.utils.BetterBlockPos;
|
import baritone.api.utils.BetterBlockPos;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.Vec3i;
|
import net.minecraft.util.math.vector.Vector3i;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A selection is an immutable object representing the current selection. The selection is commonly used for certain
|
* A selection is an immutable object representing the current selection. The selection is commonly used for certain
|
||||||
|
@ -51,7 +51,7 @@ public interface ISelection {
|
||||||
/**
|
/**
|
||||||
* @return The size of this ISelection.
|
* @return The size of this ISelection.
|
||||||
*/
|
*/
|
||||||
Vec3i size();
|
Vector3i size();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return An {@link AxisAlignedBB} encompassing all blocks in this selection.
|
* @return An {@link AxisAlignedBB} encompassing all blocks in this selection.
|
||||||
|
|
|
@ -20,7 +20,7 @@ package baritone.api.utils;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.math.Vec3i;
|
import net.minecraft.util.math.vector.Vector3i;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ public final class BetterBlockPos extends BlockPos {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BetterBlockPos offset(Direction dir) {
|
public BetterBlockPos offset(Direction dir) {
|
||||||
Vec3i vec = dir.getDirectionVec();
|
Vector3i vec = dir.getDirectionVec();
|
||||||
return new BetterBlockPos(x + vec.getX(), y + vec.getY(), z + vec.getZ());
|
return new BetterBlockPos(x + vec.getX(), y + vec.getY(), z + vec.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ public final class BetterBlockPos extends BlockPos {
|
||||||
if (dist == 0) {
|
if (dist == 0) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
Vec3i vec = dir.getDirectionVec();
|
Vector3i vec = dir.getDirectionVec();
|
||||||
return new BetterBlockPos(x + vec.getX() * dist, y + vec.getY() * dist, z + vec.getZ() * dist);
|
return new BetterBlockPos(x + vec.getX() * dist, y + vec.getY() * dist, z + vec.getZ() * dist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,11 +24,11 @@ import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.loot.*;
|
||||||
import net.minecraft.resources.*;
|
import net.minecraft.resources.*;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.Unit;
|
import net.minecraft.util.Unit;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.storage.loot.*;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -36,7 +36,6 @@ import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.regex.MatchResult;
|
import java.util.regex.MatchResult;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public final class BlockOptionalMeta {
|
public final class BlockOptionalMeta {
|
||||||
|
|
||||||
|
@ -133,11 +132,10 @@ public final class BlockOptionalMeta {
|
||||||
|
|
||||||
public static LootTableManager getManager() {
|
public static LootTableManager getManager() {
|
||||||
if (manager == null) {
|
if (manager == null) {
|
||||||
ResourcePackList rpl = new ResourcePackList<>(ResourcePackInfo::new);
|
ResourcePackList rpl = new ResourcePackList<>(ResourcePackInfo::new, new ServerPackFinder());
|
||||||
rpl.addPackFinder(new ServerPackFinder());
|
|
||||||
rpl.reloadPacksFromFinders();
|
rpl.reloadPacksFromFinders();
|
||||||
IResourcePack thePack = ((ResourcePackInfo) rpl.getAllPacks().iterator().next()).getResourcePack();
|
IResourcePack thePack = ((ResourcePackInfo) rpl.getAllPacks().iterator().next()).getResourcePack();
|
||||||
IReloadableResourceManager resourceManager = new SimpleReloadableResourceManager(ResourcePackType.SERVER_DATA, null);
|
IReloadableResourceManager resourceManager = new SimpleReloadableResourceManager(ResourcePackType.SERVER_DATA);
|
||||||
manager = new LootTableManager(predicate);
|
manager = new LootTableManager(predicate);
|
||||||
resourceManager.addReloadListener(manager);
|
resourceManager.addReloadListener(manager);
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -21,6 +21,7 @@ import baritone.api.BaritoneAPI;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.util.text.StringTextComponent;
|
import net.minecraft.util.text.StringTextComponent;
|
||||||
|
import net.minecraft.util.text.TextComponent;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -50,15 +51,15 @@ public interface Helper {
|
||||||
// Inner text component
|
// Inner text component
|
||||||
final Calendar now = Calendar.getInstance();
|
final Calendar now = Calendar.getInstance();
|
||||||
final boolean xd = now.get(Calendar.MONTH) == Calendar.APRIL && now.get(Calendar.DAY_OF_MONTH) <= 3;
|
final boolean xd = now.get(Calendar.MONTH) == Calendar.APRIL && now.get(Calendar.DAY_OF_MONTH) <= 3;
|
||||||
ITextComponent baritone = new StringTextComponent(xd ? "Baritoe" : BaritoneAPI.getSettings().shortBaritonePrefix.value ? "B" : "Baritone");
|
TextComponent baritone = new StringTextComponent(xd ? "Baritoe" : BaritoneAPI.getSettings().shortBaritonePrefix.value ? "B" : "Baritone");
|
||||||
baritone.getStyle().setColor(TextFormatting.LIGHT_PURPLE);
|
baritone.func_230530_a_(baritone.getStyle().func_240712_a_(TextFormatting.LIGHT_PURPLE));
|
||||||
|
|
||||||
// Outer brackets
|
// Outer brackets
|
||||||
ITextComponent prefix = new StringTextComponent("");
|
TextComponent prefix = new StringTextComponent("");
|
||||||
prefix.getStyle().setColor(TextFormatting.DARK_PURPLE);
|
prefix.func_230530_a_(baritone.getStyle().func_240712_a_(TextFormatting.DARK_PURPLE));
|
||||||
prefix.appendText("[");
|
prefix.func_240702_b_("[");
|
||||||
prefix.appendSibling(baritone);
|
prefix.func_230529_a_(baritone);
|
||||||
prefix.appendText("]");
|
prefix.func_240702_b_("]");
|
||||||
|
|
||||||
return prefix;
|
return prefix;
|
||||||
}
|
}
|
||||||
|
@ -83,10 +84,10 @@ public interface Helper {
|
||||||
* @param components The components to send
|
* @param components The components to send
|
||||||
*/
|
*/
|
||||||
default void logDirect(ITextComponent... components) {
|
default void logDirect(ITextComponent... components) {
|
||||||
ITextComponent component = new StringTextComponent("");
|
TextComponent component = new StringTextComponent("");
|
||||||
component.appendSibling(getPrefix());
|
component.func_230529_a_(getPrefix());
|
||||||
component.appendSibling(new StringTextComponent(" "));
|
component.func_230529_a_(new StringTextComponent(" "));
|
||||||
Arrays.asList(components).forEach(component::appendSibling);
|
Arrays.asList(components).forEach(component::func_230529_a_);
|
||||||
mc.execute(() -> BaritoneAPI.getSettings().logger.value.accept(component));
|
mc.execute(() -> BaritoneAPI.getSettings().logger.value.accept(component));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,8 +100,8 @@ public interface Helper {
|
||||||
*/
|
*/
|
||||||
default void logDirect(String message, TextFormatting color) {
|
default void logDirect(String message, TextFormatting color) {
|
||||||
Stream.of(message.split("\n")).forEach(line -> {
|
Stream.of(message.split("\n")).forEach(line -> {
|
||||||
ITextComponent component = new StringTextComponent(line.replace("\t", " "));
|
TextComponent component = new StringTextComponent(line.replace("\t", " "));
|
||||||
component.getStyle().setColor(color);
|
component.func_230530_a_(component.getStyle().func_240712_a_(color));
|
||||||
logDirect(component);
|
logDirect(component);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,8 @@ import net.minecraft.client.entity.player.ClientPlayerEntity;
|
||||||
import net.minecraft.client.world.ClientWorld;
|
import net.minecraft.client.world.ClientWorld;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.util.math.*;
|
import net.minecraft.util.math.*;
|
||||||
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
|
import net.minecraft.util.math.vector.Vector3f;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
@ -75,12 +77,12 @@ public interface IPlayerContext {
|
||||||
return feet;
|
return feet;
|
||||||
}
|
}
|
||||||
|
|
||||||
default Vec3d playerFeetAsVec() {
|
default Vector3d playerFeetAsVec() {
|
||||||
return new Vec3d(player().getPositionVec().x, player().getPositionVec().y, player().getPositionVec().z);
|
return new Vector3d(player().getPositionVec().x, player().getPositionVec().y, player().getPositionVec().z);
|
||||||
}
|
}
|
||||||
|
|
||||||
default Vec3d playerHead() {
|
default Vector3d playerHead() {
|
||||||
return new Vec3d(player().getPositionVec().x, player().getPositionVec().y + player().getEyeHeight(), player().getPositionVec().z);
|
return new Vector3d(player().getPositionVec().x, player().getPositionVec().y + player().getEyeHeight(), player().getPositionVec().z);
|
||||||
}
|
}
|
||||||
|
|
||||||
default Rotation playerRotations() {
|
default Rotation playerRotations() {
|
||||||
|
|
|
@ -20,7 +20,7 @@ package baritone.api.utils;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.util.math.RayTraceContext;
|
import net.minecraft.util.math.RayTraceContext;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Brady
|
* @author Brady
|
||||||
|
@ -45,14 +45,14 @@ public final class RayTraceUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RayTraceResult rayTraceTowards(Entity entity, Rotation rotation, double blockReachDistance, boolean wouldSneak) {
|
public static RayTraceResult rayTraceTowards(Entity entity, Rotation rotation, double blockReachDistance, boolean wouldSneak) {
|
||||||
Vec3d start;
|
Vector3d start;
|
||||||
if (wouldSneak) {
|
if (wouldSneak) {
|
||||||
start = inferSneakingEyePosition(entity);
|
start = inferSneakingEyePosition(entity);
|
||||||
} else {
|
} else {
|
||||||
start = entity.getEyePosition(1.0F); // do whatever is correct
|
start = entity.getEyePosition(1.0F); // do whatever is correct
|
||||||
}
|
}
|
||||||
Vec3d direction = RotationUtils.calcVec3dFromRotation(rotation);
|
Vector3d direction = RotationUtils.calcVector3dFromRotation(rotation);
|
||||||
Vec3d end = start.add(
|
Vector3d end = start.add(
|
||||||
direction.x * blockReachDistance,
|
direction.x * blockReachDistance,
|
||||||
direction.y * blockReachDistance,
|
direction.y * blockReachDistance,
|
||||||
direction.z * blockReachDistance
|
direction.z * blockReachDistance
|
||||||
|
@ -60,7 +60,7 @@ public final class RayTraceUtils {
|
||||||
return entity.world.rayTraceBlocks(new RayTraceContext(start, end, RayTraceContext.BlockMode.OUTLINE, RayTraceContext.FluidMode.NONE, entity));
|
return entity.world.rayTraceBlocks(new RayTraceContext(start, end, RayTraceContext.BlockMode.OUTLINE, RayTraceContext.FluidMode.NONE, entity));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vec3d inferSneakingEyePosition(Entity entity) {
|
public static Vector3d inferSneakingEyePosition(Entity entity) {
|
||||||
return new Vec3d(entity.getPosX(), entity.getPosY() + IPlayerContext.eyeHeight(true), entity.getPosZ());
|
return new Vector3d(entity.getPosX(), entity.getPosY() + IPlayerContext.eyeHeight(true), entity.getPosZ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.*;
|
import net.minecraft.util.math.*;
|
||||||
import net.minecraft.util.math.shapes.VoxelShape;
|
import net.minecraft.util.math.shapes.VoxelShape;
|
||||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||||
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@ -49,13 +50,13 @@ public final class RotationUtils {
|
||||||
/**
|
/**
|
||||||
* Offsets from the root block position to the center of each side.
|
* Offsets from the root block position to the center of each side.
|
||||||
*/
|
*/
|
||||||
private static final Vec3d[] BLOCK_SIDE_MULTIPLIERS = new Vec3d[]{
|
private static final Vector3d[] BLOCK_SIDE_MULTIPLIERS = new Vector3d[]{
|
||||||
new Vec3d(0.5, 0, 0.5), // Down
|
new Vector3d(0.5, 0, 0.5), // Down
|
||||||
new Vec3d(0.5, 1, 0.5), // Up
|
new Vector3d(0.5, 1, 0.5), // Up
|
||||||
new Vec3d(0.5, 0.5, 0), // North
|
new Vector3d(0.5, 0.5, 0), // North
|
||||||
new Vec3d(0.5, 0.5, 1), // South
|
new Vector3d(0.5, 0.5, 1), // South
|
||||||
new Vec3d(0, 0.5, 0.5), // West
|
new Vector3d(0, 0.5, 0.5), // West
|
||||||
new Vec3d(1, 0.5, 0.5) // East
|
new Vector3d(1, 0.5, 0.5) // East
|
||||||
};
|
};
|
||||||
|
|
||||||
private RotationUtils() {}
|
private RotationUtils() {}
|
||||||
|
@ -68,7 +69,7 @@ public final class RotationUtils {
|
||||||
* @return The rotation from the origin to the destination
|
* @return The rotation from the origin to the destination
|
||||||
*/
|
*/
|
||||||
public static Rotation calcRotationFromCoords(BlockPos orig, BlockPos dest) {
|
public static Rotation calcRotationFromCoords(BlockPos orig, BlockPos dest) {
|
||||||
return calcRotationFromVec3d(new Vec3d(orig), new Vec3d(dest));
|
return calcRotationFromVec3d(new Vector3d(orig.getX(), orig.getY(), orig.getZ()), new Vector3d(dest.getX(), dest.getY(), dest.getZ()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -97,7 +98,7 @@ public final class RotationUtils {
|
||||||
* @return The rotation from the origin to the destination
|
* @return The rotation from the origin to the destination
|
||||||
* @see #wrapAnglesToRelative(Rotation, Rotation)
|
* @see #wrapAnglesToRelative(Rotation, Rotation)
|
||||||
*/
|
*/
|
||||||
public static Rotation calcRotationFromVec3d(Vec3d orig, Vec3d dest, Rotation current) {
|
public static Rotation calcRotationFromVec3d(Vector3d orig, Vector3d dest, Rotation current) {
|
||||||
return wrapAnglesToRelative(current, calcRotationFromVec3d(orig, dest));
|
return wrapAnglesToRelative(current, calcRotationFromVec3d(orig, dest));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +109,7 @@ public final class RotationUtils {
|
||||||
* @param dest The destination position
|
* @param dest The destination position
|
||||||
* @return The rotation from the origin to the destination
|
* @return The rotation from the origin to the destination
|
||||||
*/
|
*/
|
||||||
private static Rotation calcRotationFromVec3d(Vec3d orig, Vec3d dest) {
|
private static Rotation calcRotationFromVec3d(Vector3d orig, Vector3d dest) {
|
||||||
double[] delta = {orig.x - dest.x, orig.y - dest.y, orig.z - dest.z};
|
double[] delta = {orig.x - dest.x, orig.y - dest.y, orig.z - dest.z};
|
||||||
double yaw = MathHelper.atan2(delta[0], -delta[2]);
|
double yaw = MathHelper.atan2(delta[0], -delta[2]);
|
||||||
double dist = Math.sqrt(delta[0] * delta[0] + delta[2] * delta[2]);
|
double dist = Math.sqrt(delta[0] * delta[0] + delta[2] * delta[2]);
|
||||||
|
@ -125,12 +126,12 @@ public final class RotationUtils {
|
||||||
* @param rotation The input rotation
|
* @param rotation The input rotation
|
||||||
* @return Look vector for the rotation
|
* @return Look vector for the rotation
|
||||||
*/
|
*/
|
||||||
public static Vec3d calcVec3dFromRotation(Rotation rotation) {
|
public static Vector3d calcVector3dFromRotation(Rotation rotation) {
|
||||||
float f = MathHelper.cos(-rotation.getYaw() * (float) DEG_TO_RAD - (float) Math.PI);
|
float f = MathHelper.cos(-rotation.getYaw() * (float) DEG_TO_RAD - (float) Math.PI);
|
||||||
float f1 = MathHelper.sin(-rotation.getYaw() * (float) DEG_TO_RAD - (float) Math.PI);
|
float f1 = MathHelper.sin(-rotation.getYaw() * (float) DEG_TO_RAD - (float) Math.PI);
|
||||||
float f2 = -MathHelper.cos(-rotation.getPitch() * (float) DEG_TO_RAD);
|
float f2 = -MathHelper.cos(-rotation.getPitch() * (float) DEG_TO_RAD);
|
||||||
float f3 = MathHelper.sin(-rotation.getPitch() * (float) DEG_TO_RAD);
|
float f3 = MathHelper.sin(-rotation.getPitch() * (float) DEG_TO_RAD);
|
||||||
return new Vec3d((double) (f1 * f2), (double) f3, (double) (f * f2));
|
return new Vector3d((double) (f1 * f2), (double) f3, (double) (f * f2));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -198,11 +199,11 @@ public final class RotationUtils {
|
||||||
if (shape.isEmpty()) {
|
if (shape.isEmpty()) {
|
||||||
shape = VoxelShapes.fullCube();
|
shape = VoxelShapes.fullCube();
|
||||||
}
|
}
|
||||||
for (Vec3d sideOffset : BLOCK_SIDE_MULTIPLIERS) {
|
for (Vector3d sideOffset : BLOCK_SIDE_MULTIPLIERS) {
|
||||||
double xDiff = shape.getStart(Direction.Axis.X) * sideOffset.x + shape.getEnd(Direction.Axis.X) * (1 - sideOffset.x);
|
double xDiff = shape.getStart(Direction.Axis.X) * sideOffset.x + shape.getEnd(Direction.Axis.X) * (1 - sideOffset.x);
|
||||||
double yDiff = shape.getStart(Direction.Axis.Y) * sideOffset.y + shape.getEnd(Direction.Axis.Y) * (1 - sideOffset.y);
|
double yDiff = shape.getStart(Direction.Axis.Y) * sideOffset.y + shape.getEnd(Direction.Axis.Y) * (1 - sideOffset.y);
|
||||||
double zDiff = shape.getStart(Direction.Axis.Z) * sideOffset.z + shape.getEnd(Direction.Axis.Z) * (1 - sideOffset.z);
|
double zDiff = shape.getStart(Direction.Axis.Z) * sideOffset.z + shape.getEnd(Direction.Axis.Z) * (1 - sideOffset.z);
|
||||||
possibleRotation = reachableOffset(entity, pos, new Vec3d(pos).add(xDiff, yDiff, zDiff), blockReachDistance, wouldSneak);
|
possibleRotation = reachableOffset(entity, pos, new Vector3d(pos.getX(), pos.getY(), pos.getZ()).add(xDiff, yDiff, zDiff), blockReachDistance, wouldSneak);
|
||||||
if (possibleRotation.isPresent()) {
|
if (possibleRotation.isPresent()) {
|
||||||
return possibleRotation;
|
return possibleRotation;
|
||||||
}
|
}
|
||||||
|
@ -221,8 +222,8 @@ public final class RotationUtils {
|
||||||
* @param blockReachDistance The block reach distance of the entity
|
* @param blockReachDistance The block reach distance of the entity
|
||||||
* @return The optional rotation
|
* @return The optional rotation
|
||||||
*/
|
*/
|
||||||
public static Optional<Rotation> reachableOffset(Entity entity, BlockPos pos, Vec3d offsetPos, double blockReachDistance, boolean wouldSneak) {
|
public static Optional<Rotation> reachableOffset(Entity entity, BlockPos pos, Vector3d offsetPos, double blockReachDistance, boolean wouldSneak) {
|
||||||
Vec3d eyes = wouldSneak ? RayTraceUtils.inferSneakingEyePosition(entity) : entity.getEyePosition(1.0F);
|
Vector3d eyes = wouldSneak ? RayTraceUtils.inferSneakingEyePosition(entity) : entity.getEyePosition(1.0F);
|
||||||
Rotation rotation = calcRotationFromVec3d(eyes, offsetPos, new Rotation(entity.rotationYaw, entity.rotationPitch));
|
Rotation rotation = calcRotationFromVec3d(eyes, offsetPos, new Rotation(entity.rotationYaw, entity.rotationPitch));
|
||||||
RayTraceResult result = RayTraceUtils.rayTraceTowards(entity, rotation, blockReachDistance, wouldSneak);
|
RayTraceResult result = RayTraceUtils.rayTraceTowards(entity, rotation, blockReachDistance, wouldSneak);
|
||||||
//System.out.println(result);
|
//System.out.println(result);
|
||||||
|
|
|
@ -24,7 +24,7 @@ import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.Vec3i;
|
import net.minecraft.util.math.vector.Vector3i;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
@ -225,8 +225,8 @@ public class SettingsUtil {
|
||||||
color -> color.getRed() + "," + color.getGreen() + "," + color.getBlue()
|
color -> color.getRed() + "," + color.getGreen() + "," + color.getBlue()
|
||||||
),
|
),
|
||||||
VEC3I(
|
VEC3I(
|
||||||
Vec3i.class,
|
Vector3i.class,
|
||||||
str -> new Vec3i(Integer.parseInt(str.split(",")[0]), Integer.parseInt(str.split(",")[1]), Integer.parseInt(str.split(",")[2])),
|
str -> new Vector3i(Integer.parseInt(str.split(",")[0]), Integer.parseInt(str.split(",")[1]), Integer.parseInt(str.split(",")[2])),
|
||||||
vec -> vec.getX() + "," + vec.getY() + "," + vec.getZ()
|
vec -> vec.getX() + "," + vec.getY() + "," + vec.getZ()
|
||||||
),
|
),
|
||||||
BLOCK(
|
BLOCK(
|
||||||
|
|
|
@ -22,8 +22,8 @@ import net.minecraft.block.FireBlock;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
|
||||||
import net.minecraft.util.math.shapes.VoxelShape;
|
import net.minecraft.util.math.shapes.VoxelShape;
|
||||||
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,7 +42,7 @@ public final class VecUtils {
|
||||||
* @return The center of the block's bounding box
|
* @return The center of the block's bounding box
|
||||||
* @see #getBlockPosCenter(BlockPos)
|
* @see #getBlockPosCenter(BlockPos)
|
||||||
*/
|
*/
|
||||||
public static Vec3d calculateBlockCenter(World world, BlockPos pos) {
|
public static Vector3d calculateBlockCenter(World world, BlockPos pos) {
|
||||||
BlockState b = world.getBlockState(pos);
|
BlockState b = world.getBlockState(pos);
|
||||||
VoxelShape shape = b.getCollisionShape(world, pos);
|
VoxelShape shape = b.getCollisionShape(world, pos);
|
||||||
if (shape.isEmpty()) {
|
if (shape.isEmpty()) {
|
||||||
|
@ -57,7 +57,7 @@ public final class VecUtils {
|
||||||
if (b.getBlock() instanceof FireBlock) {//look at bottom of fire when putting it out
|
if (b.getBlock() instanceof FireBlock) {//look at bottom of fire when putting it out
|
||||||
yDiff = 0;
|
yDiff = 0;
|
||||||
}
|
}
|
||||||
return new Vec3d(
|
return new Vector3d(
|
||||||
pos.getX() + xDiff,
|
pos.getX() + xDiff,
|
||||||
pos.getY() + yDiff,
|
pos.getY() + yDiff,
|
||||||
pos.getZ() + zDiff
|
pos.getZ() + zDiff
|
||||||
|
@ -74,8 +74,8 @@ public final class VecUtils {
|
||||||
* @return The assumed center of the position
|
* @return The assumed center of the position
|
||||||
* @see #calculateBlockCenter(World, BlockPos)
|
* @see #calculateBlockCenter(World, BlockPos)
|
||||||
*/
|
*/
|
||||||
public static Vec3d getBlockPosCenter(BlockPos pos) {
|
public static Vector3d getBlockPosCenter(BlockPos pos) {
|
||||||
return new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
|
return new Vector3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -24,7 +24,6 @@ import net.minecraft.client.entity.player.ClientPlayerEntity;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.util.math.Vec3d;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
|
|
@ -18,11 +18,11 @@
|
||||||
package baritone.launch.mixins;
|
package baritone.launch.mixins;
|
||||||
|
|
||||||
import baritone.api.utils.BlockOptionalMeta;
|
import baritone.api.utils.BlockOptionalMeta;
|
||||||
|
import net.minecraft.loot.LootContext;
|
||||||
|
import net.minecraft.loot.LootPredicateManager;
|
||||||
|
import net.minecraft.loot.LootTableManager;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.world.server.ServerWorld;
|
import net.minecraft.world.server.ServerWorld;
|
||||||
import net.minecraft.world.storage.loot.LootContext;
|
|
||||||
import net.minecraft.world.storage.loot.LootPredicateManager;
|
|
||||||
import net.minecraft.world.storage.loot.LootTableManager;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
@ -48,7 +48,7 @@ public class MixinLootContext {
|
||||||
method = "build",
|
method = "build",
|
||||||
at = @At(
|
at = @At(
|
||||||
value = "INVOKE",
|
value = "INVOKE",
|
||||||
target = "net/minecraft/server/MinecraftServer.getLootTableManager()Lnet/minecraft/world/storage/loot/LootTableManager;"
|
target = "net/minecraft/server/MinecraftServer.getLootTableManager()Lnet/minecraft/loot/LootTableManager;"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
private LootTableManager getLootTableManager(MinecraftServer server) {
|
private LootTableManager getLootTableManager(MinecraftServer server) {
|
||||||
|
@ -62,7 +62,7 @@ public class MixinLootContext {
|
||||||
method = "build",
|
method = "build",
|
||||||
at = @At(
|
at = @At(
|
||||||
value = "INVOKE",
|
value = "INVOKE",
|
||||||
target = "net/minecraft/server/MinecraftServer.func_229736_aP_()Lnet/minecraft/world/storage/loot/LootPredicateManager;"
|
target = "net/minecraft/server/MinecraftServer.func_229736_aP_()Lnet/minecraft/loot/LootPredicateManager;"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
private LootPredicateManager getLootPredicateManager(MinecraftServer server) {
|
private LootPredicateManager getLootPredicateManager(MinecraftServer server) {
|
||||||
|
|
|
@ -57,6 +57,7 @@ public class MixinMinecraft {
|
||||||
BaritoneAPI.getProvider().getPrimaryBaritone();
|
BaritoneAPI.getProvider().getPrimaryBaritone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
@Inject(
|
@Inject(
|
||||||
method = "startTimerHackThread",
|
method = "startTimerHackThread",
|
||||||
at = @At("HEAD")
|
at = @At("HEAD")
|
||||||
|
@ -64,6 +65,7 @@ public class MixinMinecraft {
|
||||||
private void preInit(CallbackInfo ci) {
|
private void preInit(CallbackInfo ci) {
|
||||||
BaritoneAutoTest.INSTANCE.onPreInit();
|
BaritoneAutoTest.INSTANCE.onPreInit();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
@Inject(
|
@Inject(
|
||||||
method = "runTick",
|
method = "runTick",
|
||||||
|
@ -131,12 +133,12 @@ public class MixinMinecraft {
|
||||||
at = @At(
|
at = @At(
|
||||||
value = "FIELD",
|
value = "FIELD",
|
||||||
opcode = Opcodes.GETFIELD,
|
opcode = Opcodes.GETFIELD,
|
||||||
target = "net/minecraft/client/gui/screen/Screen.passEvents:Z"
|
target = "net/minecraft/client/gui/screen/Screen.field_230711_n_:Z"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
private boolean passEvents(Screen screen) {
|
private boolean passEvents(Screen screen) {
|
||||||
// allow user input is only the primary baritone
|
// allow user input is only the primary baritone
|
||||||
return (BaritoneAPI.getProvider().getPrimaryBaritone().getPathingBehavior().isPathing() && player != null) || screen.passEvents;
|
return (BaritoneAPI.getProvider().getPrimaryBaritone().getPathingBehavior().isPathing() && player != null) || screen.field_230711_n_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
|
@ -28,6 +28,6 @@ import java.net.URI;
|
||||||
public abstract class MixinScreen implements IGuiScreen {
|
public abstract class MixinScreen implements IGuiScreen {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Invoker("openLink")
|
@Invoker("func_231156_a_")
|
||||||
public abstract void openLinkInvoker(URI url);
|
public abstract void openLinkInvoker(URI url);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import baritone.api.IBaritone;
|
||||||
import baritone.api.event.events.RenderEvent;
|
import baritone.api.event.events.RenderEvent;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import net.minecraft.client.renderer.*;
|
import net.minecraft.client.renderer.*;
|
||||||
|
import net.minecraft.util.math.vector.Matrix4f;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
|
|
@ -30,7 +30,7 @@ import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.NonNullList;
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.math.BlockRayTraceResult;
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.OptionalInt;
|
import java.util.OptionalInt;
|
||||||
|
@ -137,7 +137,7 @@ public final class InventoryBehavior extends Behavior {
|
||||||
|
|
||||||
public boolean selectThrowawayForLocation(boolean select, int x, int y, int z) {
|
public boolean selectThrowawayForLocation(boolean select, int x, int y, int z) {
|
||||||
BlockState maybe = baritone.getBuilderProcess().placeAt(x, y, z, baritone.bsi.get0(x, y, z));
|
BlockState maybe = baritone.getBuilderProcess().placeAt(x, y, z, baritone.bsi.get0(x, y, z));
|
||||||
if (maybe != null && throwaway(select, stack -> stack.getItem() instanceof BlockItem && maybe.equals(((BlockItem) stack.getItem()).getBlock().getStateForPlacement(new BlockItemUseContext(new ItemUseContext(ctx.world(), ctx.player(), Hand.MAIN_HAND, stack, new BlockRayTraceResult(new Vec3d(ctx.player().getPositionVec().x, ctx.player().getPositionVec().y, ctx.player().getPositionVec().z), Direction.UP, ctx.playerFeet(), false)) {}))))) {
|
if (maybe != null && throwaway(select, stack -> stack.getItem() instanceof BlockItem && maybe.equals(((BlockItem) stack.getItem()).getBlock().getStateForPlacement(new BlockItemUseContext(new ItemUseContext(ctx.world(), ctx.player(), Hand.MAIN_HAND, stack, new BlockRayTraceResult(new Vector3d(ctx.player().getPositionVec().x, ctx.player().getPositionVec().y, ctx.player().getPositionVec().z), Direction.UP, ctx.playerFeet(), false)) {}))))) {
|
||||||
return true; // gotem
|
return true; // gotem
|
||||||
}
|
}
|
||||||
if (maybe != null && throwaway(select, stack -> stack.getItem() instanceof BlockItem && ((BlockItem) stack.getItem()).getBlock().equals(maybe.getBlock()))) {
|
if (maybe != null && throwaway(select, stack -> stack.getItem() instanceof BlockItem && ((BlockItem) stack.getItem()).getBlock().equals(maybe.getBlock()))) {
|
||||||
|
|
|
@ -380,7 +380,7 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
|
||||||
public BetterBlockPos pathStart() { // TODO move to a helper or util class
|
public BetterBlockPos pathStart() { // TODO move to a helper or util class
|
||||||
BetterBlockPos feet = ctx.playerFeet();
|
BetterBlockPos feet = ctx.playerFeet();
|
||||||
if (!MovementHelper.canWalkOn(ctx, feet.down())) {
|
if (!MovementHelper.canWalkOn(ctx, feet.down())) {
|
||||||
if (ctx.player().onGround) {
|
if (ctx.player().func_233570_aj_()) {
|
||||||
double playerX = ctx.player().getPositionVec().x;
|
double playerX = ctx.player().getPositionVec().x;
|
||||||
double playerZ = ctx.player().getPositionVec().z;
|
double playerZ = ctx.player().getPositionVec().z;
|
||||||
ArrayList<BetterBlockPos> closest = new ArrayList<>();
|
ArrayList<BetterBlockPos> closest = new ArrayList<>();
|
||||||
|
|
|
@ -24,7 +24,9 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
|
import net.minecraft.util.RegistryKey;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.BitSet;
|
import java.util.BitSet;
|
||||||
|
@ -178,7 +180,7 @@ public final class CachedChunk {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public final BlockState getBlock(int x, int y, int z, int dimension) {
|
public final BlockState getBlock(int x, int y, int z, RegistryKey<World> dimension) {
|
||||||
int index = getPositionIndex(x, y, z);
|
int index = getPositionIndex(x, y, z);
|
||||||
PathingBlockType type = getType(index);
|
PathingBlockType type = getType(index);
|
||||||
int internalPos = z << 4 | x;
|
int internalPos = z << 4 | x;
|
||||||
|
@ -200,11 +202,11 @@ public final class CachedChunk {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == PathingBlockType.SOLID) {
|
if (type == PathingBlockType.SOLID) {
|
||||||
if (y == 127 && dimension == -1) {
|
if (y == 127 && dimension == World.field_234919_h_) {
|
||||||
// nether roof is always unbreakable
|
// nether roof is always unbreakable
|
||||||
return Blocks.BEDROCK.getDefaultState();
|
return Blocks.BEDROCK.getDefaultState();
|
||||||
}
|
}
|
||||||
if (y < 5 && dimension == 0) {
|
if (y < 5 && dimension == World.field_234918_g_) {
|
||||||
// solid blocks below 5 are commonly bedrock
|
// solid blocks below 5 are commonly bedrock
|
||||||
// however, returning bedrock always would be a little yikes
|
// however, returning bedrock always would be a little yikes
|
||||||
// discourage paths that include breaking blocks below 5 a little more heavily just so that it takes paths breaking what's known to be stone (at 5 or above) instead of what could maybe be bedrock (below 5)
|
// discourage paths that include breaking blocks below 5 a little more heavily just so that it takes paths breaking what's known to be stone (at 5 or above) instead of what could maybe be bedrock (below 5)
|
||||||
|
|
|
@ -21,7 +21,9 @@ import baritone.Baritone;
|
||||||
import baritone.api.cache.ICachedRegion;
|
import baritone.api.cache.ICachedRegion;
|
||||||
import baritone.api.utils.BlockUtils;
|
import baritone.api.utils.BlockUtils;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.util.RegistryKey;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
@ -60,14 +62,14 @@ public final class CachedRegion implements ICachedRegion {
|
||||||
*/
|
*/
|
||||||
private final int z;
|
private final int z;
|
||||||
|
|
||||||
private final int dimension;
|
private final RegistryKey<World> dimension;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Has this region been modified since its most recent load or save
|
* Has this region been modified since its most recent load or save
|
||||||
*/
|
*/
|
||||||
private boolean hasUnsavedChanges;
|
private boolean hasUnsavedChanges;
|
||||||
|
|
||||||
CachedRegion(int x, int z, int dimension) {
|
CachedRegion(int x, int z, RegistryKey<World> dimension) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.z = z;
|
this.z = z;
|
||||||
this.hasUnsavedChanges = false;
|
this.hasUnsavedChanges = false;
|
||||||
|
|
|
@ -25,7 +25,9 @@ import baritone.api.cache.IWorldData;
|
||||||
import baritone.api.utils.Helper;
|
import baritone.api.utils.Helper;
|
||||||
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
|
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
|
||||||
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
||||||
|
import net.minecraft.util.RegistryKey;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -58,9 +60,9 @@ public final class CachedWorld implements ICachedWorld, Helper {
|
||||||
|
|
||||||
private final LinkedBlockingQueue<Chunk> toPack = new LinkedBlockingQueue<>();
|
private final LinkedBlockingQueue<Chunk> toPack = new LinkedBlockingQueue<>();
|
||||||
|
|
||||||
private final int dimension;
|
private final RegistryKey<World> dimension;
|
||||||
|
|
||||||
CachedWorld(Path directory, int dimension) {
|
CachedWorld(Path directory, RegistryKey<World> dimension) {
|
||||||
if (!Files.exists(directory)) {
|
if (!Files.exists(directory)) {
|
||||||
try {
|
try {
|
||||||
Files.createDirectories(directory);
|
Files.createDirectories(directory);
|
||||||
|
|
|
@ -21,9 +21,11 @@ import baritone.api.utils.BlockUtils;
|
||||||
import baritone.pathing.movement.MovementHelper;
|
import baritone.pathing.movement.MovementHelper;
|
||||||
import baritone.utils.pathing.PathingBlockType;
|
import baritone.utils.pathing.PathingBlockType;
|
||||||
import net.minecraft.block.*;
|
import net.minecraft.block.*;
|
||||||
|
import net.minecraft.util.RegistryKey;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
import net.minecraft.util.palette.PalettedContainer;
|
import net.minecraft.util.palette.PalettedContainer;
|
||||||
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
import net.minecraft.world.chunk.ChunkSection;
|
import net.minecraft.world.chunk.ChunkSection;
|
||||||
|
|
||||||
|
@ -123,7 +125,7 @@ public final class ChunkPacker {
|
||||||
return PathingBlockType.AVOID;
|
return PathingBlockType.AVOID;
|
||||||
}
|
}
|
||||||
if (x == 0 || x == 15 || z == 0 || z == 15) {
|
if (x == 0 || x == 15 || z == 0 || z == 15) {
|
||||||
Vec3d flow = state.getFluidState().getFlow(chunk.getWorld(), new BlockPos(x + chunk.getPos().x << 4, y, z + chunk.getPos().z << 4));
|
Vector3d flow = state.getFluidState().getFlow(chunk.getWorld(), new BlockPos(x + chunk.getPos().x << 4, y, z + chunk.getPos().z << 4));
|
||||||
if (flow.x != 0.0 || flow.z != 0.0) {
|
if (flow.x != 0.0 || flow.z != 0.0) {
|
||||||
return PathingBlockType.WATER;
|
return PathingBlockType.WATER;
|
||||||
}
|
}
|
||||||
|
@ -146,7 +148,7 @@ public final class ChunkPacker {
|
||||||
return PathingBlockType.SOLID;
|
return PathingBlockType.SOLID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlockState pathingTypeToBlock(PathingBlockType type, int dimension) {
|
public static BlockState pathingTypeToBlock(PathingBlockType type, RegistryKey<World> dimension) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case AIR:
|
case AIR:
|
||||||
return Blocks.AIR.getDefaultState();
|
return Blocks.AIR.getDefaultState();
|
||||||
|
@ -156,14 +158,14 @@ public final class ChunkPacker {
|
||||||
return Blocks.LAVA.getDefaultState();
|
return Blocks.LAVA.getDefaultState();
|
||||||
case SOLID:
|
case SOLID:
|
||||||
// Dimension solid types
|
// Dimension solid types
|
||||||
switch (dimension) {
|
if (dimension == World.field_234918_g_) {
|
||||||
case -1:
|
return Blocks.STONE.getDefaultState();
|
||||||
return Blocks.NETHERRACK.getDefaultState();
|
}
|
||||||
case 0:
|
if (dimension == World.field_234919_h_) {
|
||||||
default: // The fallback solid type
|
return Blocks.NETHERRACK.getDefaultState();
|
||||||
return Blocks.STONE.getDefaultState();
|
}
|
||||||
case 1:
|
if (dimension == World.field_234920_i_) {
|
||||||
return Blocks.END_STONE.getDefaultState();
|
return Blocks.END_STONE.getDefaultState();
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -22,6 +22,8 @@ import baritone.api.cache.ICachedWorld;
|
||||||
import baritone.api.cache.IContainerMemory;
|
import baritone.api.cache.IContainerMemory;
|
||||||
import baritone.api.cache.IWaypointCollection;
|
import baritone.api.cache.IWaypointCollection;
|
||||||
import baritone.api.cache.IWorldData;
|
import baritone.api.cache.IWorldData;
|
||||||
|
import net.minecraft.util.RegistryKey;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
@ -38,9 +40,9 @@ public class WorldData implements IWorldData {
|
||||||
private final ContainerMemory containerMemory;
|
private final ContainerMemory containerMemory;
|
||||||
//public final MapData map;
|
//public final MapData map;
|
||||||
public final Path directory;
|
public final Path directory;
|
||||||
public final int dimension;
|
public final RegistryKey<World> dimension;
|
||||||
|
|
||||||
WorldData(Path directory, int dimension) {
|
WorldData(Path directory, RegistryKey<World> dimension) {
|
||||||
this.directory = directory;
|
this.directory = directory;
|
||||||
this.cache = new CachedWorld(directory.resolve("cache"), dimension);
|
this.cache = new CachedWorld(directory.resolve("cache"), dimension);
|
||||||
this.waypoints = new WaypointCollection(directory.resolve("waypoints"));
|
this.waypoints = new WaypointCollection(directory.resolve("waypoints"));
|
||||||
|
|
|
@ -21,8 +21,10 @@ import baritone.Baritone;
|
||||||
import baritone.api.cache.IWorldProvider;
|
import baritone.api.cache.IWorldProvider;
|
||||||
import baritone.api.utils.Helper;
|
import baritone.api.utils.Helper;
|
||||||
import net.minecraft.server.integrated.IntegratedServer;
|
import net.minecraft.server.integrated.IntegratedServer;
|
||||||
import net.minecraft.world.dimension.DimensionType;
|
import net.minecraft.util.RegistryKey;
|
||||||
import net.minecraft.world.server.ServerWorld;
|
import net.minecraft.world.DimensionType;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.storage.FolderName;
|
||||||
import org.apache.commons.lang3.SystemUtils;
|
import org.apache.commons.lang3.SystemUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -51,10 +53,8 @@ public class WorldProvider implements IWorldProvider, Helper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a new world is initialized to discover the
|
* Called when a new world is initialized to discover the
|
||||||
*
|
|
||||||
* @param dimension The ID of the world's dimension
|
|
||||||
*/
|
*/
|
||||||
public final void initWorld(DimensionType dimension) {
|
public final void initWorld(RegistryKey<World> world) {
|
||||||
File directory;
|
File directory;
|
||||||
File readme;
|
File readme;
|
||||||
|
|
||||||
|
@ -62,8 +62,7 @@ public class WorldProvider implements IWorldProvider, Helper {
|
||||||
|
|
||||||
// If there is an integrated server running (Aka Singleplayer) then do magic to find the world save file
|
// If there is an integrated server running (Aka Singleplayer) then do magic to find the world save file
|
||||||
if (mc.isSingleplayer()) {
|
if (mc.isSingleplayer()) {
|
||||||
ServerWorld localServerWorld = integratedServer.getWorld(dimension);
|
directory = DimensionType.func_236031_a_(world, integratedServer.func_240776_a_(FolderName.field_237253_i_).toFile());
|
||||||
directory = dimension.getDirectory(localServerWorld.getSaveHandler().getWorldDirectory());
|
|
||||||
|
|
||||||
// Gets the "depth" of this directory relative the the game's run directory, 2 is the location of the world
|
// Gets the "depth" of this directory relative the the game's run directory, 2 is the location of the world
|
||||||
if (directory.toPath().relativize(mc.gameDir.toPath()).getNameCount() != 2) {
|
if (directory.toPath().relativize(mc.gameDir.toPath()).getNameCount() != 2) {
|
||||||
|
@ -89,7 +88,7 @@ public class WorldProvider implements IWorldProvider, Helper {
|
||||||
} catch (IOException ignored) {}
|
} catch (IOException ignored) {}
|
||||||
|
|
||||||
// We will actually store the world data in a subfolder: "DIM<id>"
|
// We will actually store the world data in a subfolder: "DIM<id>"
|
||||||
Path dir = new File(directory, "DIM" + dimension.getId()).toPath();
|
Path dir = DimensionType.func_236031_a_(world, directory).toPath();
|
||||||
if (!Files.exists(dir)) {
|
if (!Files.exists(dir)) {
|
||||||
try {
|
try {
|
||||||
Files.createDirectories(dir);
|
Files.createDirectories(dir);
|
||||||
|
@ -98,7 +97,7 @@ public class WorldProvider implements IWorldProvider, Helper {
|
||||||
|
|
||||||
System.out.println("Baritone world data dir: " + dir);
|
System.out.println("Baritone world data dir: " + dir);
|
||||||
synchronized (worldCache) {
|
synchronized (worldCache) {
|
||||||
this.currentWorld = worldCache.computeIfAbsent(dir, d -> new WorldData(d, dimension.getId()));
|
this.currentWorld = worldCache.computeIfAbsent(dir, d -> new WorldData(d, world));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ import baritone.command.manager.CommandManager;
|
||||||
import net.minecraft.util.Tuple;
|
import net.minecraft.util.Tuple;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.util.text.StringTextComponent;
|
import net.minecraft.util.text.StringTextComponent;
|
||||||
|
import net.minecraft.util.text.TextComponent;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.util.text.event.ClickEvent;
|
import net.minecraft.util.text.event.ClickEvent;
|
||||||
import net.minecraft.util.text.event.HoverEvent;
|
import net.minecraft.util.text.event.HoverEvent;
|
||||||
|
@ -79,17 +80,17 @@ public class BaritoneChatControl implements Helper, AbstractGameEventListener {
|
||||||
if (settings.echoCommands.value) {
|
if (settings.echoCommands.value) {
|
||||||
String msg = command + rest;
|
String msg = command + rest;
|
||||||
String toDisplay = settings.censorRanCommands.value ? command + " ..." : msg;
|
String toDisplay = settings.censorRanCommands.value ? command + " ..." : msg;
|
||||||
ITextComponent component = new StringTextComponent(String.format("> %s", toDisplay));
|
TextComponent component = new StringTextComponent(String.format("> %s", toDisplay));
|
||||||
component.getStyle()
|
component.func_230530_a_(component.getStyle()
|
||||||
.setColor(TextFormatting.WHITE)
|
.func_240712_a_(TextFormatting.WHITE)
|
||||||
.setHoverEvent(new HoverEvent(
|
.func_240716_a_(new HoverEvent(
|
||||||
HoverEvent.Action.SHOW_TEXT,
|
HoverEvent.Action.field_230550_a_,
|
||||||
new StringTextComponent("Click to rerun command")
|
new StringTextComponent("Click to rerun command")
|
||||||
))
|
))
|
||||||
.setClickEvent(new ClickEvent(
|
.func_240715_a_(new ClickEvent(
|
||||||
ClickEvent.Action.RUN_COMMAND,
|
ClickEvent.Action.RUN_COMMAND,
|
||||||
FORCE_COMMAND_PREFIX + msg
|
FORCE_COMMAND_PREFIX + msg
|
||||||
));
|
)));
|
||||||
logDirect(component);
|
logDirect(component);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,9 @@ import baritone.api.command.exception.CommandInvalidStateException;
|
||||||
import baritone.api.command.argument.IArgConsumer;
|
import baritone.api.command.argument.IArgConsumer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.text.IFormattableTextComponent;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
import net.minecraft.util.text.TextComponent;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -54,8 +56,8 @@ public class ChestsCommand extends Command {
|
||||||
IRememberedInventory inv = entry.getValue();
|
IRememberedInventory inv = entry.getValue();
|
||||||
logDirect(pos.toString());
|
logDirect(pos.toString());
|
||||||
for (ItemStack item : inv.getContents()) {
|
for (ItemStack item : inv.getContents()) {
|
||||||
ITextComponent component = item.getTextComponent();
|
IFormattableTextComponent component = (IFormattableTextComponent) item.getTextComponent();
|
||||||
component.appendText(String.format(" x %d", item.getCount()));
|
component.func_240702_b_(String.format(" x %d", item.getCount()));
|
||||||
logDirect(component);
|
logDirect(component);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class ComeCommand extends Command {
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
throw new CommandInvalidStateException("render view entity is null");
|
throw new CommandInvalidStateException("render view entity is null");
|
||||||
}
|
}
|
||||||
baritone.getCustomGoalProcess().setGoalAndPath(new GoalBlock(new BlockPos(entity)));
|
baritone.getCustomGoalProcess().setGoalAndPath(new GoalBlock(entity.func_233580_cy_()));
|
||||||
logDirect("Coming");
|
logDirect("Coming");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,8 @@ import baritone.api.command.exception.CommandNotFoundException;
|
||||||
import baritone.api.command.argument.IArgConsumer;
|
import baritone.api.command.argument.IArgConsumer;
|
||||||
import baritone.api.command.helpers.Paginator;
|
import baritone.api.command.helpers.Paginator;
|
||||||
import baritone.api.command.helpers.TabCompleteHelper;
|
import baritone.api.command.helpers.TabCompleteHelper;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
|
||||||
import net.minecraft.util.text.StringTextComponent;
|
import net.minecraft.util.text.StringTextComponent;
|
||||||
|
import net.minecraft.util.text.TextComponent;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.util.text.event.ClickEvent;
|
import net.minecraft.util.text.event.ClickEvent;
|
||||||
import net.minecraft.util.text.event.HoverEvent;
|
import net.minecraft.util.text.event.HoverEvent;
|
||||||
|
@ -58,22 +58,22 @@ public class HelpCommand extends Command {
|
||||||
command -> {
|
command -> {
|
||||||
String names = String.join("/", command.getNames());
|
String names = String.join("/", command.getNames());
|
||||||
String name = command.getNames().get(0);
|
String name = command.getNames().get(0);
|
||||||
ITextComponent shortDescComponent = new StringTextComponent(" - " + command.getShortDesc());
|
TextComponent shortDescComponent = new StringTextComponent(" - " + command.getShortDesc());
|
||||||
shortDescComponent.getStyle().setColor(TextFormatting.DARK_GRAY);
|
shortDescComponent.func_230530_a_(shortDescComponent.getStyle().func_240712_a_(TextFormatting.DARK_GRAY));
|
||||||
ITextComponent namesComponent = new StringTextComponent(names);
|
TextComponent namesComponent = new StringTextComponent(names);
|
||||||
namesComponent.getStyle().setColor(TextFormatting.WHITE);
|
namesComponent.func_230530_a_(namesComponent.getStyle().func_240712_a_(TextFormatting.WHITE));
|
||||||
ITextComponent hoverComponent = new StringTextComponent("");
|
TextComponent hoverComponent = new StringTextComponent("");
|
||||||
hoverComponent.getStyle().setColor(TextFormatting.GRAY);
|
hoverComponent.func_230530_a_(hoverComponent.getStyle().func_240712_a_(TextFormatting.GRAY));
|
||||||
hoverComponent.appendSibling(namesComponent);
|
hoverComponent.func_230529_a_(namesComponent);
|
||||||
hoverComponent.appendText("\n" + command.getShortDesc());
|
hoverComponent.func_240702_b_("\n" + command.getShortDesc());
|
||||||
hoverComponent.appendText("\n\nClick to view full help");
|
hoverComponent.func_240702_b_("\n\nClick to view full help");
|
||||||
String clickCommand = FORCE_COMMAND_PREFIX + String.format("%s %s", label, command.getNames().get(0));
|
String clickCommand = FORCE_COMMAND_PREFIX + String.format("%s %s", label, command.getNames().get(0));
|
||||||
ITextComponent component = new StringTextComponent(name);
|
TextComponent component = new StringTextComponent(name);
|
||||||
component.getStyle().setColor(TextFormatting.GRAY);
|
component.func_230530_a_(component.getStyle().func_240712_a_(TextFormatting.GRAY));
|
||||||
component.appendSibling(shortDescComponent);
|
component.func_230529_a_(shortDescComponent);
|
||||||
component.getStyle()
|
component.func_230530_a_(component.getStyle()
|
||||||
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverComponent))
|
.func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, hoverComponent))
|
||||||
.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, clickCommand));
|
.func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, clickCommand)));
|
||||||
return component;
|
return component;
|
||||||
},
|
},
|
||||||
FORCE_COMMAND_PREFIX + label
|
FORCE_COMMAND_PREFIX + label
|
||||||
|
@ -88,11 +88,11 @@ public class HelpCommand extends Command {
|
||||||
logDirect("");
|
logDirect("");
|
||||||
command.getLongDesc().forEach(this::logDirect);
|
command.getLongDesc().forEach(this::logDirect);
|
||||||
logDirect("");
|
logDirect("");
|
||||||
ITextComponent returnComponent = new StringTextComponent("Click to return to the help menu");
|
TextComponent returnComponent = new StringTextComponent("Click to return to the help menu");
|
||||||
returnComponent.getStyle().setClickEvent(new ClickEvent(
|
returnComponent.func_230530_a_(returnComponent.getStyle().func_240715_a_(new ClickEvent(
|
||||||
ClickEvent.Action.RUN_COMMAND,
|
ClickEvent.Action.RUN_COMMAND,
|
||||||
FORCE_COMMAND_PREFIX + label
|
FORCE_COMMAND_PREFIX + label
|
||||||
));
|
)));
|
||||||
logDirect(returnComponent);
|
logDirect(returnComponent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,8 +41,7 @@ import baritone.utils.IRenderer;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.vector.Vector3i;
|
||||||
import net.minecraft.util.math.Vec3i;
|
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -84,7 +83,7 @@ public class SelCommand extends Command {
|
||||||
if (action == Action.POS2 && pos1 == null) {
|
if (action == Action.POS2 && pos1 == null) {
|
||||||
throw new CommandInvalidStateException("Set pos1 first before using pos2");
|
throw new CommandInvalidStateException("Set pos1 first before using pos2");
|
||||||
}
|
}
|
||||||
BetterBlockPos playerPos = mc.getRenderViewEntity() != null ? BetterBlockPos.from(new BlockPos(mc.getRenderViewEntity())) : ctx.playerFeet();
|
BetterBlockPos playerPos = mc.getRenderViewEntity() != null ? BetterBlockPos.from(mc.getRenderViewEntity().func_233580_cy_()) : ctx.playerFeet();
|
||||||
BetterBlockPos pos = args.hasAny() ? args.getDatatypePost(RelativeBlockPos.INSTANCE, playerPos) : playerPos;
|
BetterBlockPos pos = args.hasAny() ? args.getDatatypePost(RelativeBlockPos.INSTANCE, playerPos) : playerPos;
|
||||||
args.requireMax(0);
|
args.requireMax(0);
|
||||||
if (action == Action.POS1) {
|
if (action == Action.POS1) {
|
||||||
|
@ -145,7 +144,7 @@ public class SelCommand extends Command {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
for (ISelection selection : selections) {
|
for (ISelection selection : selections) {
|
||||||
Vec3i size = selection.size();
|
Vector3i size = selection.size();
|
||||||
BetterBlockPos min = selection.min();
|
BetterBlockPos min = selection.min();
|
||||||
ISchematic schematic = new FillSchematic(size.getX(), size.getY(), size.getZ(), type);
|
ISchematic schematic = new FillSchematic(size.getX(), size.getY(), size.getZ(), type);
|
||||||
if (action == Action.WALLS) {
|
if (action == Action.WALLS) {
|
||||||
|
|
|
@ -29,6 +29,7 @@ import baritone.api.command.helpers.Paginator;
|
||||||
import baritone.api.command.helpers.TabCompleteHelper;
|
import baritone.api.command.helpers.TabCompleteHelper;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.util.text.StringTextComponent;
|
import net.minecraft.util.text.StringTextComponent;
|
||||||
|
import net.minecraft.util.text.TextComponent;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.util.text.event.ClickEvent;
|
import net.minecraft.util.text.event.ClickEvent;
|
||||||
import net.minecraft.util.text.event.HoverEvent;
|
import net.minecraft.util.text.event.HoverEvent;
|
||||||
|
@ -78,23 +79,23 @@ public class SetCommand extends Command {
|
||||||
: String.format("All %ssettings:", viewModified ? "modified " : "")
|
: String.format("All %ssettings:", viewModified ? "modified " : "")
|
||||||
),
|
),
|
||||||
setting -> {
|
setting -> {
|
||||||
ITextComponent typeComponent = new StringTextComponent(String.format(
|
TextComponent typeComponent = new StringTextComponent(String.format(
|
||||||
" (%s)",
|
" (%s)",
|
||||||
settingTypeToString(setting)
|
settingTypeToString(setting)
|
||||||
));
|
));
|
||||||
typeComponent.getStyle().setColor(TextFormatting.DARK_GRAY);
|
typeComponent.func_230530_a_(typeComponent.getStyle().func_240712_a_(TextFormatting.DARK_GRAY));
|
||||||
ITextComponent hoverComponent = new StringTextComponent("");
|
TextComponent hoverComponent = new StringTextComponent("");
|
||||||
hoverComponent.getStyle().setColor(TextFormatting.GRAY);
|
hoverComponent.func_230530_a_(hoverComponent.getStyle().func_240712_a_(TextFormatting.GRAY));
|
||||||
hoverComponent.appendText(setting.getName());
|
hoverComponent.func_240702_b_(setting.getName());
|
||||||
hoverComponent.appendText(String.format("\nType: %s", settingTypeToString(setting)));
|
hoverComponent.func_240702_b_(String.format("\nType: %s", settingTypeToString(setting)));
|
||||||
hoverComponent.appendText(String.format("\n\nValue:\n%s", settingValueToString(setting)));
|
hoverComponent.func_240702_b_(String.format("\n\nValue:\n%s", settingValueToString(setting)));
|
||||||
String commandSuggestion = Baritone.settings().prefix.value + String.format("set %s ", setting.getName());
|
String commandSuggestion = Baritone.settings().prefix.value + String.format("set %s ", setting.getName());
|
||||||
ITextComponent component = new StringTextComponent(setting.getName());
|
TextComponent component = new StringTextComponent(setting.getName());
|
||||||
component.getStyle().setColor(TextFormatting.GRAY);
|
component.func_230530_a_(component.getStyle().func_240712_a_(TextFormatting.GRAY));
|
||||||
component.appendSibling(typeComponent);
|
component.func_230529_a_(typeComponent);
|
||||||
component.getStyle()
|
component.func_230530_a_(component.getStyle()
|
||||||
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverComponent))
|
.func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, hoverComponent))
|
||||||
.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, commandSuggestion));
|
.func_240715_a_(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, commandSuggestion)));
|
||||||
return component;
|
return component;
|
||||||
},
|
},
|
||||||
FORCE_COMMAND_PREFIX + "set " + arg + " " + search
|
FORCE_COMMAND_PREFIX + "set " + arg + " " + search
|
||||||
|
@ -163,17 +164,17 @@ public class SetCommand extends Command {
|
||||||
settingValueToString(setting)
|
settingValueToString(setting)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
ITextComponent oldValueComponent = new StringTextComponent(String.format("Old value: %s", oldValue));
|
TextComponent oldValueComponent = new StringTextComponent(String.format("Old value: %s", oldValue));
|
||||||
oldValueComponent.getStyle()
|
oldValueComponent.func_230530_a_(oldValueComponent.getStyle()
|
||||||
.setColor(TextFormatting.GRAY)
|
.func_240712_a_(TextFormatting.GRAY)
|
||||||
.setHoverEvent(new HoverEvent(
|
.func_240716_a_(new HoverEvent(
|
||||||
HoverEvent.Action.SHOW_TEXT,
|
HoverEvent.Action.field_230550_a_,
|
||||||
new StringTextComponent("Click to set the setting back to this value")
|
new StringTextComponent("Click to set the setting back to this value")
|
||||||
))
|
))
|
||||||
.setClickEvent(new ClickEvent(
|
.func_240715_a_(new ClickEvent(
|
||||||
ClickEvent.Action.RUN_COMMAND,
|
ClickEvent.Action.RUN_COMMAND,
|
||||||
FORCE_COMMAND_PREFIX + String.format("set %s %s", setting.getName(), oldValue)
|
FORCE_COMMAND_PREFIX + String.format("set %s %s", setting.getName(), oldValue)
|
||||||
));
|
)));
|
||||||
logDirect(oldValueComponent);
|
logDirect(oldValueComponent);
|
||||||
if ((setting.getName().equals("chatControl") && !(Boolean) setting.value && !Baritone.settings().chatControlAnyway.value) ||
|
if ((setting.getName().equals("chatControl") && !(Boolean) setting.value && !Baritone.settings().chatControlAnyway.value) ||
|
||||||
setting.getName().equals("chatControlAnyway") && !(Boolean) setting.value && !Baritone.settings().chatControl.value) {
|
setting.getName().equals("chatControlAnyway") && !(Boolean) setting.value && !Baritone.settings().chatControl.value) {
|
||||||
|
|
|
@ -34,6 +34,7 @@ import baritone.api.command.helpers.Paginator;
|
||||||
import baritone.api.command.helpers.TabCompleteHelper;
|
import baritone.api.command.helpers.TabCompleteHelper;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.util.text.StringTextComponent;
|
import net.minecraft.util.text.StringTextComponent;
|
||||||
|
import net.minecraft.util.text.TextComponent;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.util.text.event.ClickEvent;
|
import net.minecraft.util.text.event.ClickEvent;
|
||||||
import net.minecraft.util.text.event.HoverEvent;
|
import net.minecraft.util.text.event.HoverEvent;
|
||||||
|
@ -58,23 +59,23 @@ public class WaypointsCommand extends Command {
|
||||||
throw new CommandInvalidTypeException(args.consumed(), "an action");
|
throw new CommandInvalidTypeException(args.consumed(), "an action");
|
||||||
}
|
}
|
||||||
BiFunction<IWaypoint, Action, ITextComponent> toComponent = (waypoint, _action) -> {
|
BiFunction<IWaypoint, Action, ITextComponent> toComponent = (waypoint, _action) -> {
|
||||||
ITextComponent component = new StringTextComponent("");
|
TextComponent component = new StringTextComponent("");
|
||||||
ITextComponent tagComponent = new StringTextComponent(waypoint.getTag().name() + " ");
|
TextComponent tagComponent = new StringTextComponent(waypoint.getTag().name() + " ");
|
||||||
tagComponent.getStyle().setColor(TextFormatting.GRAY);
|
tagComponent.func_230530_a_(tagComponent.getStyle().func_240712_a_(TextFormatting.GRAY));
|
||||||
String name = waypoint.getName();
|
String name = waypoint.getName();
|
||||||
ITextComponent nameComponent = new StringTextComponent(!name.isEmpty() ? name : "<empty>");
|
TextComponent nameComponent = new StringTextComponent(!name.isEmpty() ? name : "<empty>");
|
||||||
nameComponent.getStyle().setColor(!name.isEmpty() ? TextFormatting.GRAY : TextFormatting.DARK_GRAY);
|
nameComponent.func_230530_a_(nameComponent.getStyle().func_240712_a_(!name.isEmpty() ? TextFormatting.GRAY : TextFormatting.DARK_GRAY));
|
||||||
ITextComponent timestamp = new StringTextComponent(" @ " + new Date(waypoint.getCreationTimestamp()));
|
TextComponent timestamp = new StringTextComponent(" @ " + new Date(waypoint.getCreationTimestamp()));
|
||||||
timestamp.getStyle().setColor(TextFormatting.DARK_GRAY);
|
timestamp.func_230530_a_(timestamp.getStyle().func_240712_a_(TextFormatting.DARK_GRAY));
|
||||||
component.appendSibling(tagComponent);
|
component.func_230529_a_(tagComponent);
|
||||||
component.appendSibling(nameComponent);
|
component.func_230529_a_(nameComponent);
|
||||||
component.appendSibling(timestamp);
|
component.func_230529_a_(timestamp);
|
||||||
component.getStyle()
|
component.func_230530_a_(component.getStyle()
|
||||||
.setHoverEvent(new HoverEvent(
|
.func_240716_a_(new HoverEvent(
|
||||||
HoverEvent.Action.SHOW_TEXT,
|
HoverEvent.Action.field_230550_a_,
|
||||||
new StringTextComponent("Click to select")
|
new StringTextComponent("Click to select")
|
||||||
))
|
))
|
||||||
.setClickEvent(new ClickEvent(
|
.func_240715_a_(new ClickEvent(
|
||||||
ClickEvent.Action.RUN_COMMAND,
|
ClickEvent.Action.RUN_COMMAND,
|
||||||
String.format(
|
String.format(
|
||||||
"%s%s %s %s @ %d",
|
"%s%s %s %s @ %d",
|
||||||
|
@ -84,7 +85,7 @@ public class WaypointsCommand extends Command {
|
||||||
waypoint.getTag().getName(),
|
waypoint.getTag().getName(),
|
||||||
waypoint.getCreationTimestamp()
|
waypoint.getCreationTimestamp()
|
||||||
))
|
))
|
||||||
);
|
));
|
||||||
return component;
|
return component;
|
||||||
};
|
};
|
||||||
Function<IWaypoint, ITextComponent> transform = waypoint ->
|
Function<IWaypoint, ITextComponent> transform = waypoint ->
|
||||||
|
@ -136,9 +137,9 @@ public class WaypointsCommand extends Command {
|
||||||
args.requireMax(0);
|
args.requireMax(0);
|
||||||
IWaypoint waypoint = new Waypoint(name, tag, pos);
|
IWaypoint waypoint = new Waypoint(name, tag, pos);
|
||||||
ForWaypoints.waypoints(this.baritone).addWaypoint(waypoint);
|
ForWaypoints.waypoints(this.baritone).addWaypoint(waypoint);
|
||||||
ITextComponent component = new StringTextComponent("Waypoint added: ");
|
TextComponent component = new StringTextComponent("Waypoint added: ");
|
||||||
component.getStyle().setColor(TextFormatting.GRAY);
|
component.func_230530_a_(component.getStyle().func_240712_a_(TextFormatting.GRAY));
|
||||||
component.appendSibling(toComponent.apply(waypoint, Action.INFO));
|
component.func_230529_a_(toComponent.apply(waypoint, Action.INFO));
|
||||||
logDirect(component);
|
logDirect(component);
|
||||||
} else if (action == Action.CLEAR) {
|
} else if (action == Action.CLEAR) {
|
||||||
args.requireMax(1);
|
args.requireMax(1);
|
||||||
|
@ -194,8 +195,8 @@ public class WaypointsCommand extends Command {
|
||||||
if (action == Action.INFO) {
|
if (action == Action.INFO) {
|
||||||
logDirect(transform.apply(waypoint));
|
logDirect(transform.apply(waypoint));
|
||||||
logDirect(String.format("Position: %s", waypoint.getLocation()));
|
logDirect(String.format("Position: %s", waypoint.getLocation()));
|
||||||
ITextComponent deleteComponent = new StringTextComponent("Click to delete this waypoint");
|
TextComponent deleteComponent = new StringTextComponent("Click to delete this waypoint");
|
||||||
deleteComponent.getStyle().setClickEvent(new ClickEvent(
|
deleteComponent.func_230530_a_(deleteComponent.getStyle().func_240715_a_(new ClickEvent(
|
||||||
ClickEvent.Action.RUN_COMMAND,
|
ClickEvent.Action.RUN_COMMAND,
|
||||||
String.format(
|
String.format(
|
||||||
"%s%s delete %s @ %d",
|
"%s%s delete %s @ %d",
|
||||||
|
@ -204,9 +205,9 @@ public class WaypointsCommand extends Command {
|
||||||
waypoint.getTag().getName(),
|
waypoint.getTag().getName(),
|
||||||
waypoint.getCreationTimestamp()
|
waypoint.getCreationTimestamp()
|
||||||
)
|
)
|
||||||
));
|
)));
|
||||||
ITextComponent goalComponent = new StringTextComponent("Click to set goal to this waypoint");
|
TextComponent goalComponent = new StringTextComponent("Click to set goal to this waypoint");
|
||||||
goalComponent.getStyle().setClickEvent(new ClickEvent(
|
goalComponent.func_230530_a_(goalComponent.getStyle().func_240715_a_(new ClickEvent(
|
||||||
ClickEvent.Action.RUN_COMMAND,
|
ClickEvent.Action.RUN_COMMAND,
|
||||||
String.format(
|
String.format(
|
||||||
"%s%s goal %s @ %d",
|
"%s%s goal %s @ %d",
|
||||||
|
@ -215,16 +216,16 @@ public class WaypointsCommand extends Command {
|
||||||
waypoint.getTag().getName(),
|
waypoint.getTag().getName(),
|
||||||
waypoint.getCreationTimestamp()
|
waypoint.getCreationTimestamp()
|
||||||
)
|
)
|
||||||
));
|
)));
|
||||||
ITextComponent backComponent = new StringTextComponent("Click to return to the waypoints list");
|
TextComponent backComponent = new StringTextComponent("Click to return to the waypoints list");
|
||||||
backComponent.getStyle().setClickEvent(new ClickEvent(
|
backComponent.func_230530_a_(backComponent.getStyle().func_240715_a_(new ClickEvent(
|
||||||
ClickEvent.Action.RUN_COMMAND,
|
ClickEvent.Action.RUN_COMMAND,
|
||||||
String.format(
|
String.format(
|
||||||
"%s%s list",
|
"%s%s list",
|
||||||
FORCE_COMMAND_PREFIX,
|
FORCE_COMMAND_PREFIX,
|
||||||
label
|
label
|
||||||
)
|
)
|
||||||
));
|
)));
|
||||||
logDirect(deleteComponent);
|
logDirect(deleteComponent);
|
||||||
logDirect(goalComponent);
|
logDirect(goalComponent);
|
||||||
logDirect(backComponent);
|
logDirect(backComponent);
|
||||||
|
|
|
@ -115,7 +115,7 @@ public final class GameEventHandler implements IEventBus, Helper {
|
||||||
if (event.getState() == EventState.POST) {
|
if (event.getState() == EventState.POST) {
|
||||||
cache.closeWorld();
|
cache.closeWorld();
|
||||||
if (event.getWorld() != null) {
|
if (event.getWorld() != null) {
|
||||||
cache.initWorld(event.getWorld().getDimension().getType());
|
cache.initWorld(event.getWorld().func_234923_W_());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ import net.minecraft.entity.player.PlayerInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.DimensionType;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import static baritone.api.pathing.movement.ActionCosts.COST_INF;
|
import static baritone.api.pathing.movement.ActionCosts.COST_INF;
|
||||||
|
@ -85,7 +86,7 @@ public class CalculationContext {
|
||||||
this.bsi = new BlockStateInterface(world, worldData, forUseOnAnotherThread);
|
this.bsi = new BlockStateInterface(world, worldData, forUseOnAnotherThread);
|
||||||
this.toolSet = new ToolSet(player);
|
this.toolSet = new ToolSet(player);
|
||||||
this.hasThrowaway = Baritone.settings().allowPlace.value && ((Baritone) baritone).getInventoryBehavior().hasGenericThrowaway();
|
this.hasThrowaway = Baritone.settings().allowPlace.value && ((Baritone) baritone).getInventoryBehavior().hasGenericThrowaway();
|
||||||
this.hasWaterBucket = Baritone.settings().allowWaterBucketFall.value && PlayerInventory.isHotbar(player.inventory.getSlotFor(STACK_BUCKET_WATER)) && !world.getDimension().isNether();
|
this.hasWaterBucket = Baritone.settings().allowWaterBucketFall.value && PlayerInventory.isHotbar(player.inventory.getSlotFor(STACK_BUCKET_WATER)) && world.func_234922_V_() != DimensionType.field_236000_d_;
|
||||||
this.canSprint = Baritone.settings().allowSprint.value && player.getFoodStats().getFoodLevel() > 6;
|
this.canSprint = Baritone.settings().allowSprint.value && player.getFoodStats().getFoodLevel() > 6;
|
||||||
this.placeBlockCost = Baritone.settings().blockPlacementPenalty.value;
|
this.placeBlockCost = Baritone.settings().blockPlacementPenalty.value;
|
||||||
this.allowBreak = Baritone.settings().allowBreak.value;
|
this.allowBreak = Baritone.settings().allowBreak.value;
|
||||||
|
|
|
@ -36,7 +36,7 @@ import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.BlockRayTraceResult;
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
import net.minecraft.world.IBlockReader;
|
import net.minecraft.world.IBlockReader;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
@ -125,7 +125,7 @@ public interface MovementHelper extends ActionCosts, Helper {
|
||||||
if (isFlowing(x, y, z, state, bsi)) {
|
if (isFlowing(x, y, z, state, bsi)) {
|
||||||
return false; // Don't walk through flowing liquids
|
return false; // Don't walk through flowing liquids
|
||||||
}
|
}
|
||||||
IFluidState fluidState = state.getFluidState();
|
FluidState fluidState = state.getFluidState();
|
||||||
if (fluidState.getFluid() instanceof WaterFluid) {
|
if (fluidState.getFluid() instanceof WaterFluid) {
|
||||||
if (Baritone.settings().assumeWalkOnWater.value) {
|
if (Baritone.settings().assumeWalkOnWater.value) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -493,13 +493,13 @@ public interface MovementHelper extends ActionCosts, Helper {
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean possiblyFlowing(BlockState state) {
|
static boolean possiblyFlowing(BlockState state) {
|
||||||
IFluidState fluidState = state.getFluidState();
|
FluidState fluidState = state.getFluidState();
|
||||||
return fluidState.getFluid() instanceof FlowingFluid
|
return fluidState.getFluid() instanceof FlowingFluid
|
||||||
&& fluidState.getFluid().getLevel(fluidState) != 8;
|
&& fluidState.getFluid().getLevel(fluidState) != 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean isFlowing(int x, int y, int z, BlockState state, BlockStateInterface bsi) {
|
static boolean isFlowing(int x, int y, int z, BlockState state, BlockStateInterface bsi) {
|
||||||
IFluidState fluidState = state.getFluidState();
|
FluidState fluidState = state.getFluidState();
|
||||||
if (!(fluidState.getFluid() instanceof FlowingFluid)) {
|
if (!(fluidState.getFluid() instanceof FlowingFluid)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -542,7 +542,7 @@ public interface MovementHelper extends ActionCosts, Helper {
|
||||||
double faceX = (placeAt.getX() + against1.getX() + 1.0D) * 0.5D;
|
double faceX = (placeAt.getX() + against1.getX() + 1.0D) * 0.5D;
|
||||||
double faceY = (placeAt.getY() + against1.getY() + 0.5D) * 0.5D;
|
double faceY = (placeAt.getY() + against1.getY() + 0.5D) * 0.5D;
|
||||||
double faceZ = (placeAt.getZ() + against1.getZ() + 1.0D) * 0.5D;
|
double faceZ = (placeAt.getZ() + against1.getZ() + 1.0D) * 0.5D;
|
||||||
Rotation place = RotationUtils.calcRotationFromVec3d(wouldSneak ? RayTraceUtils.inferSneakingEyePosition(ctx.player()) : ctx.playerHead(), new Vec3d(faceX, faceY, faceZ), ctx.playerRotations());
|
Rotation place = RotationUtils.calcRotationFromVec3d(wouldSneak ? RayTraceUtils.inferSneakingEyePosition(ctx.player()) : ctx.playerHead(), new Vector3d(faceX, faceY, faceZ), ctx.playerRotations());
|
||||||
RayTraceResult res = RayTraceUtils.rayTraceTowards(ctx.player(), place, ctx.playerController().getBlockReachDistance(), wouldSneak);
|
RayTraceResult res = RayTraceUtils.rayTraceTowards(ctx.player(), place, ctx.playerController().getBlockReachDistance(), wouldSneak);
|
||||||
if (res != null && res.getType() == RayTraceResult.Type.BLOCK && ((BlockRayTraceResult) res).getPos().equals(against1) && ((BlockRayTraceResult) res).getPos().offset(((BlockRayTraceResult) res).getFace()).equals(placeAt)) {
|
if (res != null && res.getType() == RayTraceResult.Type.BLOCK && ((BlockRayTraceResult) res).getPos().equals(against1) && ((BlockRayTraceResult) res).getPos().offset(((BlockRayTraceResult) res).getFace()).equals(placeAt)) {
|
||||||
state.setTarget(new MovementState.MovementTarget(place, true));
|
state.setTarget(new MovementState.MovementTarget(place, true));
|
||||||
|
|
|
@ -36,7 +36,7 @@ import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.block.FallingBlock;
|
import net.minecraft.block.FallingBlock;
|
||||||
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ public class MovementDescend extends Movement {
|
||||||
ClientPlayerEntity player = ctx.player();
|
ClientPlayerEntity player = ctx.player();
|
||||||
state.setTarget(new MovementState.MovementTarget(
|
state.setTarget(new MovementState.MovementTarget(
|
||||||
new Rotation(RotationUtils.calcRotationFromVec3d(ctx.playerHead(),
|
new Rotation(RotationUtils.calcRotationFromVec3d(ctx.playerHead(),
|
||||||
new Vec3d(destX, dest.getY(), destZ),
|
new Vector3d(destX, dest.getY(), destZ),
|
||||||
new Rotation(player.rotationYaw, player.rotationPitch)).getYaw(), player.rotationPitch),
|
new Rotation(player.rotationYaw, player.rotationPitch)).getYaw(), player.rotationPitch),
|
||||||
false
|
false
|
||||||
)).setInput(Input.MOVE_FORWARD, true);
|
)).setInput(Input.MOVE_FORWARD, true);
|
||||||
|
|
|
@ -40,8 +40,9 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
import net.minecraft.util.math.Vec3i;
|
import net.minecraft.util.math.vector.Vector3i;
|
||||||
|
import net.minecraft.world.DimensionType;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
@ -96,11 +97,11 @@ public class MovementFall extends Movement {
|
||||||
Block destBlock = destState.getBlock();
|
Block destBlock = destState.getBlock();
|
||||||
boolean isWater = destState.getFluidState().getFluid() instanceof WaterFluid;
|
boolean isWater = destState.getFluidState().getFluid() instanceof WaterFluid;
|
||||||
if (!isWater && willPlaceBucket() && !playerFeet.equals(dest)) {
|
if (!isWater && willPlaceBucket() && !playerFeet.equals(dest)) {
|
||||||
if (!PlayerInventory.isHotbar(ctx.player().inventory.getSlotFor(STACK_BUCKET_WATER)) || ctx.world().getDimension().isNether()) {
|
if (!PlayerInventory.isHotbar(ctx.player().inventory.getSlotFor(STACK_BUCKET_WATER)) || ctx.world().func_234922_V_() == DimensionType.field_236000_d_) {
|
||||||
return state.setStatus(MovementStatus.UNREACHABLE);
|
return state.setStatus(MovementStatus.UNREACHABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx.player().getPositionVec().y - dest.getY() < ctx.playerController().getBlockReachDistance() && !ctx.player().onGround) {
|
if (ctx.player().getPositionVec().y - dest.getY() < ctx.playerController().getBlockReachDistance() && !ctx.player().func_233570_aj_()) {
|
||||||
ctx.player().inventory.currentItem = ctx.player().inventory.getSlotFor(STACK_BUCKET_WATER);
|
ctx.player().inventory.currentItem = ctx.player().inventory.getSlotFor(STACK_BUCKET_WATER);
|
||||||
|
|
||||||
targetRotation = new Rotation(toDest.getYaw(), 90.0F);
|
targetRotation = new Rotation(toDest.getYaw(), 90.0F);
|
||||||
|
@ -133,26 +134,26 @@ public class MovementFall extends Movement {
|
||||||
return state.setStatus(MovementStatus.SUCCESS);
|
return state.setStatus(MovementStatus.SUCCESS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Vec3d destCenter = VecUtils.getBlockPosCenter(dest); // we are moving to the 0.5 center not the edge (like if we were falling on a ladder)
|
Vector3d destCenter = VecUtils.getBlockPosCenter(dest); // we are moving to the 0.5 center not the edge (like if we were falling on a ladder)
|
||||||
if (Math.abs(ctx.player().getPositionVec().x + ctx.player().getMotion().x - destCenter.x) > 0.1 || Math.abs(ctx.player().getPositionVec().z + ctx.player().getMotion().z - destCenter.z) > 0.1) {
|
if (Math.abs(ctx.player().getPositionVec().x + ctx.player().getMotion().x - destCenter.x) > 0.1 || Math.abs(ctx.player().getPositionVec().z + ctx.player().getMotion().z - destCenter.z) > 0.1) {
|
||||||
if (!ctx.player().onGround && Math.abs(ctx.player().getMotion().y) > 0.4) {
|
if (!ctx.player().func_233570_aj_() && Math.abs(ctx.player().getMotion().y) > 0.4) {
|
||||||
state.setInput(Input.SNEAK, true);
|
state.setInput(Input.SNEAK, true);
|
||||||
}
|
}
|
||||||
state.setInput(Input.MOVE_FORWARD, true);
|
state.setInput(Input.MOVE_FORWARD, true);
|
||||||
}
|
}
|
||||||
Vec3i avoid = Optional.ofNullable(avoid()).map(Direction::getDirectionVec).orElse(null);
|
Vector3i avoid = Optional.ofNullable(avoid()).map(Direction::getDirectionVec).orElse(null);
|
||||||
if (avoid == null) {
|
if (avoid == null) {
|
||||||
avoid = src.subtract(dest);
|
avoid = src.subtract(dest);
|
||||||
} else {
|
} else {
|
||||||
double dist = Math.abs(avoid.getX() * (destCenter.x - avoid.getX() / 2.0 - ctx.player().getPositionVec().x)) + Math.abs(avoid.getZ() * (destCenter.z - avoid.getZ() / 2.0 - ctx.player().getPositionVec().z));
|
double dist = Math.abs(avoid.getX() * (destCenter.x - avoid.getX() / 2.0 - ctx.player().getPositionVec().x)) + Math.abs(avoid.getZ() * (destCenter.z - avoid.getZ() / 2.0 - ctx.player().getPositionVec().z));
|
||||||
if (dist < 0.6) {
|
if (dist < 0.6) {
|
||||||
state.setInput(Input.MOVE_FORWARD, true);
|
state.setInput(Input.MOVE_FORWARD, true);
|
||||||
} else if (!ctx.player().onGround) {
|
} else if (!ctx.player().func_233570_aj_()) {
|
||||||
state.setInput(Input.SNEAK, false);
|
state.setInput(Input.SNEAK, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (targetRotation == null) {
|
if (targetRotation == null) {
|
||||||
Vec3d destCenterOffset = new Vec3d(destCenter.x + 0.125 * avoid.getX(), destCenter.y, destCenter.z + 0.125 * avoid.getZ());
|
Vector3d destCenterOffset = new Vector3d(destCenter.x + 0.125 * avoid.getX(), destCenter.y, destCenter.z + 0.125 * avoid.getZ());
|
||||||
state.setTarget(new MovementTarget(RotationUtils.calcRotationFromVec3d(ctx.playerHead(), destCenterOffset, ctx.playerRotations()), false));
|
state.setTarget(new MovementTarget(RotationUtils.calcRotationFromVec3d(ctx.playerHead(), destCenterOffset, ctx.playerRotations()), false));
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
|
|
|
@ -251,7 +251,7 @@ public class MovementParkour extends Movement {
|
||||||
}
|
}
|
||||||
} else if (!ctx.playerFeet().equals(src)) {
|
} else if (!ctx.playerFeet().equals(src)) {
|
||||||
if (ctx.playerFeet().equals(src.offset(direction)) || ctx.player().getPositionVec().y - src.y > 0.0001) {
|
if (ctx.playerFeet().equals(src.offset(direction)) || ctx.player().getPositionVec().y - src.y > 0.0001) {
|
||||||
if (!MovementHelper.canWalkOn(ctx, dest.down()) && !ctx.player().onGround && MovementHelper.attemptToPlaceABlock(state, baritone, dest.down(), true, false) == PlaceResult.READY_TO_PLACE) {
|
if (!MovementHelper.canWalkOn(ctx, dest.down()) && !ctx.player().func_233570_aj_() && MovementHelper.attemptToPlaceABlock(state, baritone, dest.down(), true, false) == PlaceResult.READY_TO_PLACE) {
|
||||||
// go in the opposite order to check DOWN before all horizontals -- down is preferable because you don't have to look to the side while in midair, which could mess up the trajectory
|
// go in the opposite order to check DOWN before all horizontals -- down is preferable because you don't have to look to the side while in midair, which could mess up the trajectory
|
||||||
state.setInput(Input.CLICK_RIGHT, true);
|
state.setInput(Input.CLICK_RIGHT, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ import com.google.common.collect.ImmutableSet;
|
||||||
import net.minecraft.block.*;
|
import net.minecraft.block.*;
|
||||||
import net.minecraft.state.properties.SlabType;
|
import net.minecraft.state.properties.SlabType;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ public class MovementPillar extends Movement {
|
||||||
if (MovementHelper.isWater(fromDown) && MovementHelper.isWater(ctx, dest)) {
|
if (MovementHelper.isWater(fromDown) && MovementHelper.isWater(ctx, dest)) {
|
||||||
// stay centered while swimming up a water column
|
// stay centered while swimming up a water column
|
||||||
state.setTarget(new MovementState.MovementTarget(RotationUtils.calcRotationFromVec3d(ctx.playerHead(), VecUtils.getBlockPosCenter(dest), ctx.playerRotations()), false));
|
state.setTarget(new MovementState.MovementTarget(RotationUtils.calcRotationFromVec3d(ctx.playerHead(), VecUtils.getBlockPosCenter(dest), ctx.playerRotations()), false));
|
||||||
Vec3d destCenter = VecUtils.getBlockPosCenter(dest);
|
Vector3d destCenter = VecUtils.getBlockPosCenter(dest);
|
||||||
if (Math.abs(ctx.player().getPositionVec().x - destCenter.x) > 0.2 || Math.abs(ctx.player().getPositionVec().z - destCenter.z) > 0.2) {
|
if (Math.abs(ctx.player().getPositionVec().x - destCenter.x) > 0.2 || Math.abs(ctx.player().getPositionVec().z - destCenter.z) > 0.2) {
|
||||||
state.setInput(Input.MOVE_FORWARD, true);
|
state.setInput(Input.MOVE_FORWARD, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ import net.minecraft.block.*;
|
||||||
import net.minecraft.fluid.WaterFluid;
|
import net.minecraft.fluid.WaterFluid;
|
||||||
import net.minecraft.state.properties.SlabType;
|
import net.minecraft.state.properties.SlabType;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -143,7 +143,7 @@ public class MovementTraverse extends Movement {
|
||||||
if (srcDown == Blocks.SOUL_SAND || (srcDown instanceof SlabBlock && down.get(SlabBlock.TYPE) != SlabType.DOUBLE)) {
|
if (srcDown == Blocks.SOUL_SAND || (srcDown instanceof SlabBlock && down.get(SlabBlock.TYPE) != SlabType.DOUBLE)) {
|
||||||
return COST_INF; // can't sneak and backplace against soul sand or half slabs (regardless of whether it's top half or bottom half) =/
|
return COST_INF; // can't sneak and backplace against soul sand or half slabs (regardless of whether it's top half or bottom half) =/
|
||||||
}
|
}
|
||||||
if (down.getFluidState() instanceof WaterFluid) {
|
if (down.getFluidState().getFluid() instanceof WaterFluid) {
|
||||||
return COST_INF; // this is obviously impossible
|
return COST_INF; // this is obviously impossible
|
||||||
}
|
}
|
||||||
WC = WC * (SNEAK_ONE_BLOCK_COST / WALK_ONE_BLOCK_COST);//since we are sneak backplacing, we are sneaking lol
|
WC = WC * (SNEAK_ONE_BLOCK_COST / WALK_ONE_BLOCK_COST);//since we are sneak backplacing, we are sneaking lol
|
||||||
|
@ -245,7 +245,7 @@ public class MovementTraverse extends Movement {
|
||||||
}
|
}
|
||||||
Block low = BlockStateInterface.get(ctx, src).getBlock();
|
Block low = BlockStateInterface.get(ctx, src).getBlock();
|
||||||
Block high = BlockStateInterface.get(ctx, src.up()).getBlock();
|
Block high = BlockStateInterface.get(ctx, src.up()).getBlock();
|
||||||
if (ctx.player().getPositionVec().y > src.y + 0.1D && !ctx.player().onGround && (low == Blocks.VINE || low == Blocks.LADDER || high == Blocks.VINE || high == Blocks.LADDER)) {
|
if (ctx.player().getPositionVec().y > src.y + 0.1D && !ctx.player().func_233570_aj_() && (low == Blocks.VINE || low == Blocks.LADDER || high == Blocks.VINE || high == Blocks.LADDER)) {
|
||||||
// hitting W could cause us to climb the ladder instead of going forward
|
// hitting W could cause us to climb the ladder instead of going forward
|
||||||
// wait until we're on the ground
|
// wait until we're on the ground
|
||||||
return state;
|
return state;
|
||||||
|
@ -317,7 +317,7 @@ public class MovementTraverse extends Movement {
|
||||||
// faceX, faceY, faceZ is the middle of the face between from and to
|
// faceX, faceY, faceZ is the middle of the face between from and to
|
||||||
BlockPos goalLook = src.down(); // this is the block we were just standing on, and the one we want to place against
|
BlockPos goalLook = src.down(); // this is the block we were just standing on, and the one we want to place against
|
||||||
|
|
||||||
Rotation backToFace = RotationUtils.calcRotationFromVec3d(ctx.playerHead(), new Vec3d(faceX, faceY, faceZ), ctx.playerRotations());
|
Rotation backToFace = RotationUtils.calcRotationFromVec3d(ctx.playerHead(), new Vector3d(faceX, faceY, faceZ), ctx.playerRotations());
|
||||||
float pitch = backToFace.getPitch();
|
float pitch = backToFace.getPitch();
|
||||||
double dist2 = Math.max(Math.abs(ctx.player().getPositionVec().x - faceX), Math.abs(ctx.player().getPositionVec().z - faceZ));
|
double dist2 = Math.max(Math.abs(ctx.player().getPositionVec().x - faceX), Math.abs(ctx.player().getPositionVec().z - faceZ));
|
||||||
if (dist2 < 0.29) { // see issue #208
|
if (dist2 < 0.29) { // see issue #208
|
||||||
|
|
|
@ -35,8 +35,8 @@ import baritone.utils.BlockStateInterface;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.util.Tuple;
|
import net.minecraft.util.Tuple;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
import net.minecraft.util.math.Vec3i;
|
import net.minecraft.util.math.vector.Vector3i;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ public class PathExecutor implements IPathExecutor, Helper {
|
||||||
if (!current.isPresent()) {
|
if (!current.isPresent()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!ctx.player().onGround) {
|
if (!ctx.player().func_233570_aj_()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!MovementHelper.canWalkOn(ctx, ctx.playerFeet().down())) {
|
if (!MovementHelper.canWalkOn(ctx, ctx.playerFeet().down())) {
|
||||||
|
@ -323,7 +323,7 @@ public class PathExecutor implements IPathExecutor, Helper {
|
||||||
* @return Whether or not it was possible to snap to the current player feet
|
* @return Whether or not it was possible to snap to the current player feet
|
||||||
*/
|
*/
|
||||||
public boolean snipsnapifpossible() {
|
public boolean snipsnapifpossible() {
|
||||||
if (!ctx.player().onGround && ctx.world().getFluidState(ctx.playerFeet()).isEmpty()) {
|
if (!ctx.player().func_233570_aj_() && ctx.world().getFluidState(ctx.playerFeet()).isEmpty()) {
|
||||||
// if we're falling in the air, and not in water, don't splice
|
// if we're falling in the air, and not in water, don't splice
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -424,7 +424,7 @@ public class PathExecutor implements IPathExecutor, Helper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (current instanceof MovementFall) {
|
if (current instanceof MovementFall) {
|
||||||
Tuple<Vec3d, BlockPos> data = overrideFall((MovementFall) current);
|
Tuple<Vector3d, BlockPos> data = overrideFall((MovementFall) current);
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
BetterBlockPos fallDest = new BetterBlockPos(data.getB());
|
BetterBlockPos fallDest = new BetterBlockPos(data.getB());
|
||||||
if (!path.positions().contains(fallDest)) {
|
if (!path.positions().contains(fallDest)) {
|
||||||
|
@ -445,15 +445,15 @@ public class PathExecutor implements IPathExecutor, Helper {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Tuple<Vec3d, BlockPos> overrideFall(MovementFall movement) {
|
private Tuple<Vector3d, BlockPos> overrideFall(MovementFall movement) {
|
||||||
Vec3i dir = movement.getDirection();
|
Vector3i dir = movement.getDirection();
|
||||||
if (dir.getY() < -3) {
|
if (dir.getY() < -3) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (!movement.toBreakCached.isEmpty()) {
|
if (!movement.toBreakCached.isEmpty()) {
|
||||||
return null; // it's breaking
|
return null; // it's breaking
|
||||||
}
|
}
|
||||||
Vec3i flatDir = new Vec3i(dir.getX(), 0, dir.getZ());
|
Vector3i flatDir = new Vector3i(dir.getX(), 0, dir.getZ());
|
||||||
int i;
|
int i;
|
||||||
outer:
|
outer:
|
||||||
for (i = pathPosition + 1; i < path.length() - 1 && i < pathPosition + 3; i++) {
|
for (i = pathPosition + 1; i < path.length() - 1 && i < pathPosition + 3; i++) {
|
||||||
|
@ -480,7 +480,7 @@ public class PathExecutor implements IPathExecutor, Helper {
|
||||||
}
|
}
|
||||||
double len = i - pathPosition - 0.4;
|
double len = i - pathPosition - 0.4;
|
||||||
return new Tuple<>(
|
return new Tuple<>(
|
||||||
new Vec3d(flatDir.getX() * len + movement.getDest().x + 0.5, movement.getDest().y, flatDir.getZ() * len + movement.getDest().z + 0.5),
|
new Vector3d(flatDir.getX() * len + movement.getDest().x + 0.5, movement.getDest().y, flatDir.getZ() * len + movement.getDest().z + 0.5),
|
||||||
movement.getDest().add(flatDir.getX() * (i - pathPosition), 0, flatDir.getZ() * (i - pathPosition)));
|
movement.getDest().add(flatDir.getX() * (i - pathPosition), 0, flatDir.getZ() * (i - pathPosition)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,9 @@ import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.Tuple;
|
import net.minecraft.util.Tuple;
|
||||||
import net.minecraft.util.math.*;
|
import net.minecraft.util.math.*;
|
||||||
import net.minecraft.util.math.shapes.VoxelShape;
|
import net.minecraft.util.math.shapes.VoxelShape;
|
||||||
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
|
import net.minecraft.util.math.vector.Vector3f;
|
||||||
|
import net.minecraft.util.math.vector.Vector3i;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
@ -71,7 +74,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
|
||||||
private String name;
|
private String name;
|
||||||
private ISchematic realSchematic;
|
private ISchematic realSchematic;
|
||||||
private ISchematic schematic;
|
private ISchematic schematic;
|
||||||
private Vec3i origin;
|
private Vector3i origin;
|
||||||
private int ticks;
|
private int ticks;
|
||||||
private boolean paused;
|
private boolean paused;
|
||||||
private int layer;
|
private int layer;
|
||||||
|
@ -83,7 +86,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void build(String name, ISchematic schematic, Vec3i origin) {
|
public void build(String name, ISchematic schematic, Vector3i origin) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.schematic = schematic;
|
this.schematic = schematic;
|
||||||
this.realSchematic = null;
|
this.realSchematic = null;
|
||||||
|
@ -99,7 +102,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
|
||||||
if (Baritone.settings().schematicOrientationZ.value) {
|
if (Baritone.settings().schematicOrientationZ.value) {
|
||||||
z += schematic.lengthZ();
|
z += schematic.lengthZ();
|
||||||
}
|
}
|
||||||
this.origin = new Vec3i(x, y, z);
|
this.origin = new Vector3i(x, y, z);
|
||||||
this.paused = false;
|
this.paused = false;
|
||||||
this.layer = 0;
|
this.layer = 0;
|
||||||
this.numRepeats = 0;
|
this.numRepeats = 0;
|
||||||
|
@ -120,7 +123,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean build(String name, File schematic, Vec3i origin) {
|
public boolean build(String name, File schematic, Vector3i origin) {
|
||||||
Optional<ISchematicFormat> format = SchematicSystem.INSTANCE.getByFile(schematic);
|
Optional<ISchematicFormat> format = SchematicSystem.INSTANCE.getByFile(schematic);
|
||||||
if (!format.isPresent()) {
|
if (!format.isPresent()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -286,11 +289,11 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
AxisAlignedBB aabb = placeAgainstState.getShape(ctx.world(), placeAgainstPos).getBoundingBox();
|
AxisAlignedBB aabb = placeAgainstState.getShape(ctx.world(), placeAgainstPos).getBoundingBox();
|
||||||
for (Vec3d placementMultiplier : aabbSideMultipliers(against)) {
|
for (Vector3d placementMultiplier : aabbSideMultipliers(against)) {
|
||||||
double placeX = placeAgainstPos.x + aabb.minX * placementMultiplier.x + aabb.maxX * (1 - placementMultiplier.x);
|
double placeX = placeAgainstPos.x + aabb.minX * placementMultiplier.x + aabb.maxX * (1 - placementMultiplier.x);
|
||||||
double placeY = placeAgainstPos.y + aabb.minY * placementMultiplier.y + aabb.maxY * (1 - placementMultiplier.y);
|
double placeY = placeAgainstPos.y + aabb.minY * placementMultiplier.y + aabb.maxY * (1 - placementMultiplier.y);
|
||||||
double placeZ = placeAgainstPos.z + aabb.minZ * placementMultiplier.z + aabb.maxZ * (1 - placementMultiplier.z);
|
double placeZ = placeAgainstPos.z + aabb.minZ * placementMultiplier.z + aabb.maxZ * (1 - placementMultiplier.z);
|
||||||
Rotation rot = RotationUtils.calcRotationFromVec3d(RayTraceUtils.inferSneakingEyePosition(ctx.player()), new Vec3d(placeX, placeY, placeZ), ctx.playerRotations());
|
Rotation rot = RotationUtils.calcRotationFromVec3d(RayTraceUtils.inferSneakingEyePosition(ctx.player()), new Vector3d(placeX, placeY, placeZ), ctx.playerRotations());
|
||||||
RayTraceResult result = RayTraceUtils.rayTraceTowards(ctx.player(), rot, ctx.playerController().getBlockReachDistance(), true);
|
RayTraceResult result = RayTraceUtils.rayTraceTowards(ctx.player(), rot, ctx.playerController().getBlockReachDistance(), true);
|
||||||
if (result != null && result.getType() == RayTraceResult.Type.BLOCK && ((BlockRayTraceResult) result).getPos().equals(placeAgainstPos) && ((BlockRayTraceResult) result).getFace() == against.getOpposite()) {
|
if (result != null && result.getType() == RayTraceResult.Type.BLOCK && ((BlockRayTraceResult) result).getPos().equals(placeAgainstPos) && ((BlockRayTraceResult) result).getFace() == against.getOpposite()) {
|
||||||
OptionalInt hotbar = hasAnyItemThatWouldPlace(toPlace, result, rot);
|
OptionalInt hotbar = hasAnyItemThatWouldPlace(toPlace, result, rot);
|
||||||
|
@ -337,19 +340,19 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
|
||||||
return OptionalInt.empty();
|
return OptionalInt.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Vec3d[] aabbSideMultipliers(Direction side) {
|
private static Vector3d[] aabbSideMultipliers(Direction side) {
|
||||||
switch (side) {
|
switch (side) {
|
||||||
case UP:
|
case UP:
|
||||||
return new Vec3d[]{new Vec3d(0.5, 1, 0.5), new Vec3d(0.1, 1, 0.5), new Vec3d(0.9, 1, 0.5), new Vec3d(0.5, 1, 0.1), new Vec3d(0.5, 1, 0.9)};
|
return new Vector3d[]{new Vector3d(0.5, 1, 0.5), new Vector3d(0.1, 1, 0.5), new Vector3d(0.9, 1, 0.5), new Vector3d(0.5, 1, 0.1), new Vector3d(0.5, 1, 0.9)};
|
||||||
case DOWN:
|
case DOWN:
|
||||||
return new Vec3d[]{new Vec3d(0.5, 0, 0.5), new Vec3d(0.1, 0, 0.5), new Vec3d(0.9, 0, 0.5), new Vec3d(0.5, 0, 0.1), new Vec3d(0.5, 0, 0.9)};
|
return new Vector3d[]{new Vector3d(0.5, 0, 0.5), new Vector3d(0.1, 0, 0.5), new Vector3d(0.9, 0, 0.5), new Vector3d(0.5, 0, 0.1), new Vector3d(0.5, 0, 0.9)};
|
||||||
case NORTH:
|
case NORTH:
|
||||||
case SOUTH:
|
case SOUTH:
|
||||||
case EAST:
|
case EAST:
|
||||||
case WEST:
|
case WEST:
|
||||||
double x = side.getXOffset() == 0 ? 0.5 : (1 + side.getXOffset()) / 2D;
|
double x = side.getXOffset() == 0 ? 0.5 : (1 + side.getXOffset()) / 2D;
|
||||||
double z = side.getZOffset() == 0 ? 0.5 : (1 + side.getZOffset()) / 2D;
|
double z = side.getZOffset() == 0 ? 0.5 : (1 + side.getZOffset()) / 2D;
|
||||||
return new Vec3d[]{new Vec3d(x, 0.25, z), new Vec3d(x, 0.75, z)};
|
return new Vector3d[]{new Vector3d(x, 0.25, z), new Vector3d(x, 0.75, z)};
|
||||||
default: // null
|
default: // null
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
|
@ -417,10 +420,10 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
|
||||||
layer++;
|
layer++;
|
||||||
return onTick(calcFailed, isSafeToCancel);
|
return onTick(calcFailed, isSafeToCancel);
|
||||||
}
|
}
|
||||||
Vec3i repeat = Baritone.settings().buildRepeat.value;
|
Vector3i repeat = Baritone.settings().buildRepeat.value;
|
||||||
int max = Baritone.settings().buildRepeatCount.value;
|
int max = Baritone.settings().buildRepeatCount.value;
|
||||||
numRepeats++;
|
numRepeats++;
|
||||||
if (repeat.equals(new Vec3i(0, 0, 0)) || (max != -1 && numRepeats >= max)) {
|
if (repeat.equals(new Vector3i(0, 0, 0)) || (max != -1 && numRepeats >= max)) {
|
||||||
logDirect("Done building");
|
logDirect("Done building");
|
||||||
onLostControl();
|
onLostControl();
|
||||||
return null;
|
return null;
|
||||||
|
@ -436,7 +439,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<Tuple<BetterBlockPos, Rotation>> toBreak = toBreakNearPlayer(bcc);
|
Optional<Tuple<BetterBlockPos, Rotation>> toBreak = toBreakNearPlayer(bcc);
|
||||||
if (toBreak.isPresent() && isSafeToCancel && ctx.player().onGround) {
|
if (toBreak.isPresent() && isSafeToCancel && ctx.player().func_233570_aj_()) {
|
||||||
// we'd like to pause to break this block
|
// we'd like to pause to break this block
|
||||||
// only change look direction if it's safe (don't want to fuck up an in progress parkour for example
|
// only change look direction if it's safe (don't want to fuck up an in progress parkour for example
|
||||||
Rotation rot = toBreak.get().getB();
|
Rotation rot = toBreak.get().getB();
|
||||||
|
@ -456,7 +459,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
|
||||||
}
|
}
|
||||||
List<BlockState> desirableOnHotbar = new ArrayList<>();
|
List<BlockState> desirableOnHotbar = new ArrayList<>();
|
||||||
Optional<Placement> toPlace = searchForPlacables(bcc, desirableOnHotbar);
|
Optional<Placement> toPlace = searchForPlacables(bcc, desirableOnHotbar);
|
||||||
if (toPlace.isPresent() && isSafeToCancel && ctx.player().onGround && ticks <= 0) {
|
if (toPlace.isPresent() && isSafeToCancel && ctx.player().func_233570_aj_() && ticks <= 0) {
|
||||||
Rotation rot = toPlace.get().rot;
|
Rotation rot = toPlace.get().rot;
|
||||||
baritone.getLookBehavior().updateTarget(rot, true);
|
baritone.getLookBehavior().updateTarget(rot, true);
|
||||||
ctx.player().inventory.currentItem = toPlace.get().hotbarSelection;
|
ctx.player().inventory.currentItem = toPlace.get().hotbarSelection;
|
||||||
|
@ -521,7 +524,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
|
||||||
|
|
||||||
private void trim() {
|
private void trim() {
|
||||||
HashSet<BetterBlockPos> copy = new HashSet<>(incorrectPositions);
|
HashSet<BetterBlockPos> copy = new HashSet<>(incorrectPositions);
|
||||||
copy.removeIf(pos -> pos.distanceSq(new BlockPos(ctx.player())) > 200);
|
copy.removeIf(pos -> pos.distanceSq(ctx.player().func_233580_cy_()) > 200);
|
||||||
if (!copy.isEmpty()) {
|
if (!copy.isEmpty()) {
|
||||||
incorrectPositions = copy;
|
incorrectPositions = copy;
|
||||||
}
|
}
|
||||||
|
@ -779,7 +782,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// <toxic cloud>
|
// <toxic cloud>
|
||||||
result.add(((BlockItem) stack.getItem()).getBlock().getStateForPlacement(new BlockItemUseContext(new ItemUseContext(ctx.world(), ctx.player(), Hand.MAIN_HAND, stack, new BlockRayTraceResult(new Vec3d(ctx.player().getPositionVec().x, ctx.player().getPositionVec().y, ctx.player().getPositionVec().z), Direction.UP, ctx.playerFeet(), false)) {})));
|
result.add(((BlockItem) stack.getItem()).getBlock().getStateForPlacement(new BlockItemUseContext(new ItemUseContext(ctx.world(), ctx.player(), Hand.MAIN_HAND, stack, new BlockRayTraceResult(new Vector3d(ctx.player().getPositionVec().x, ctx.player().getPositionVec().y, ctx.player().getPositionVec().z), Direction.UP, ctx.playerFeet(), false)) {})));
|
||||||
// </toxic cloud>
|
// </toxic cloud>
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -41,7 +41,7 @@ import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.BlockRayTraceResult;
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -229,7 +229,7 @@ public final class FarmProcess extends BaritoneProcessHelper implements IFarmPro
|
||||||
both.addAll(openSoulsand);
|
both.addAll(openSoulsand);
|
||||||
for (BlockPos pos : both) {
|
for (BlockPos pos : both) {
|
||||||
boolean soulsand = openSoulsand.contains(pos);
|
boolean soulsand = openSoulsand.contains(pos);
|
||||||
Optional<Rotation> rot = RotationUtils.reachableOffset(ctx.player(), pos, new Vec3d(pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5), ctx.playerController().getBlockReachDistance(), false);
|
Optional<Rotation> rot = RotationUtils.reachableOffset(ctx.player(), pos, new Vector3d(pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5), ctx.playerController().getBlockReachDistance(), false);
|
||||||
if (rot.isPresent() && isSafeToCancel && baritone.getInventoryBehavior().throwaway(true, soulsand ? this::isNetherWart : this::isPlantable)) {
|
if (rot.isPresent() && isSafeToCancel && baritone.getInventoryBehavior().throwaway(true, soulsand ? this::isNetherWart : this::isPlantable)) {
|
||||||
RayTraceResult result = RayTraceUtils.rayTraceTowards(ctx.player(), rot.get(), ctx.playerController().getBlockReachDistance());
|
RayTraceResult result = RayTraceUtils.rayTraceTowards(ctx.player(), rot.get(), ctx.playerController().getBlockReachDistance());
|
||||||
if (result instanceof BlockRayTraceResult && ((BlockRayTraceResult) result).getFace() == Direction.UP) {
|
if (result instanceof BlockRayTraceResult && ((BlockRayTraceResult) result).getFace() == Direction.UP) {
|
||||||
|
@ -278,7 +278,7 @@ public final class FarmProcess extends BaritoneProcessHelper implements IFarmPro
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Entity entity : ctx.entities()) {
|
for (Entity entity : ctx.entities()) {
|
||||||
if (entity instanceof ItemEntity && entity.onGround) {
|
if (entity instanceof ItemEntity && entity.func_233570_aj_()) {
|
||||||
ItemEntity ei = (ItemEntity) entity;
|
ItemEntity ei = (ItemEntity) entity;
|
||||||
if (PICKUP_DROPPED.contains(ei.getItem().getItem())) {
|
if (PICKUP_DROPPED.contains(ei.getItem().getItem())) {
|
||||||
// +0.1 because of farmland's 0.9375 dummy height lol
|
// +0.1 because of farmland's 0.9375 dummy height lol
|
||||||
|
|
|
@ -57,9 +57,9 @@ public final class FollowProcess extends BaritoneProcessHelper implements IFollo
|
||||||
private Goal towards(Entity following) {
|
private Goal towards(Entity following) {
|
||||||
BlockPos pos;
|
BlockPos pos;
|
||||||
if (Baritone.settings().followOffsetDistance.value == 0) {
|
if (Baritone.settings().followOffsetDistance.value == 0) {
|
||||||
pos = new BlockPos(following);
|
pos = following.func_233580_cy_();
|
||||||
} else {
|
} else {
|
||||||
GoalXZ g = GoalXZ.fromDirection(following.getPositionVector(), Baritone.settings().followOffsetDirection.value, Baritone.settings().followOffsetDistance.value);
|
GoalXZ g = GoalXZ.fromDirection(following.getPositionVec(), Baritone.settings().followOffsetDirection.value, Baritone.settings().followOffsetDistance.value);
|
||||||
pos = new BlockPos(g.getX(), following.getPositionVec().y, g.getZ());
|
pos = new BlockPos(g.getX(), following.getPositionVec().y, g.getZ());
|
||||||
}
|
}
|
||||||
return new GoalNear(pos, Baritone.settings().followRadius.value);
|
return new GoalNear(pos, Baritone.settings().followRadius.value);
|
||||||
|
|
|
@ -114,7 +114,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
|
||||||
.filter(pos -> !(BlockStateInterface.get(ctx, pos).getBlock() instanceof AirBlock)) // after breaking a block, it takes mineGoalUpdateInterval ticks for it to actually update this list =(
|
.filter(pos -> !(BlockStateInterface.get(ctx, pos).getBlock() instanceof AirBlock)) // after breaking a block, it takes mineGoalUpdateInterval ticks for it to actually update this list =(
|
||||||
.min(Comparator.comparingDouble(ctx.playerFeet()::distanceSq));
|
.min(Comparator.comparingDouble(ctx.playerFeet()::distanceSq));
|
||||||
baritone.getInputOverrideHandler().clearAllKeys();
|
baritone.getInputOverrideHandler().clearAllKeys();
|
||||||
if (shaft.isPresent() && ctx.player().onGround) {
|
if (shaft.isPresent() && ctx.player().func_233570_aj_()) {
|
||||||
BlockPos pos = shaft.get();
|
BlockPos pos = shaft.get();
|
||||||
BlockState state = baritone.bsi.get0(pos);
|
BlockState state = baritone.bsi.get0(pos);
|
||||||
if (!MovementHelper.avoidBreaking(baritone.bsi, pos.getX(), pos.getY(), pos.getZ(), state)) {
|
if (!MovementHelper.avoidBreaking(baritone.bsi, pos.getX(), pos.getY(), pos.getZ(), state)) {
|
||||||
|
@ -308,7 +308,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
|
||||||
if (entity instanceof ItemEntity) {
|
if (entity instanceof ItemEntity) {
|
||||||
ItemEntity ei = (ItemEntity) entity;
|
ItemEntity ei = (ItemEntity) entity;
|
||||||
if (filter.has(ei.getItem())) {
|
if (filter.has(ei.getItem())) {
|
||||||
ret.add(new BlockPos(entity));
|
ret.add(entity.func_233580_cy_());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -399,7 +399,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
|
||||||
|
|
||||||
.filter(pos -> !blacklist.contains(pos))
|
.filter(pos -> !blacklist.contains(pos))
|
||||||
|
|
||||||
.sorted(Comparator.comparingDouble(new BlockPos(ctx.getBaritone().getPlayerContext().player())::distanceSq))
|
.sorted(Comparator.comparingDouble(ctx.getBaritone().getPlayerContext().player().func_233580_cy_()::distanceSq))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
if (locs.size() > max) {
|
if (locs.size() > max) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import baritone.api.selection.ISelection;
|
||||||
import baritone.api.utils.BetterBlockPos;
|
import baritone.api.utils.BetterBlockPos;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.Vec3i;
|
import net.minecraft.util.math.vector.Vector3i;
|
||||||
|
|
||||||
public class Selection implements ISelection {
|
public class Selection implements ISelection {
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ public class Selection implements ISelection {
|
||||||
private final BetterBlockPos pos2;
|
private final BetterBlockPos pos2;
|
||||||
private final BetterBlockPos min;
|
private final BetterBlockPos min;
|
||||||
private final BetterBlockPos max;
|
private final BetterBlockPos max;
|
||||||
private final Vec3i size;
|
private final Vector3i size;
|
||||||
private final AxisAlignedBB aabb;
|
private final AxisAlignedBB aabb;
|
||||||
|
|
||||||
public Selection(BetterBlockPos pos1, BetterBlockPos pos2) {
|
public Selection(BetterBlockPos pos1, BetterBlockPos pos2) {
|
||||||
|
@ -31,7 +31,7 @@ public class Selection implements ISelection {
|
||||||
Math.max(pos1.z, pos2.z)
|
Math.max(pos1.z, pos2.z)
|
||||||
);
|
);
|
||||||
|
|
||||||
this.size = new Vec3i(
|
this.size = new Vector3i(
|
||||||
max.x - min.x + 1,
|
max.x - min.x + 1,
|
||||||
max.y - min.y + 1,
|
max.y - min.y + 1,
|
||||||
max.z - min.z + 1
|
max.z - min.z + 1
|
||||||
|
@ -61,7 +61,7 @@ public class Selection implements ISelection {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec3i size() {
|
public Vector3i size() {
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,14 +29,16 @@ import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.screen.MainMenuScreen;
|
import net.minecraft.client.gui.screen.MainMenuScreen;
|
||||||
import net.minecraft.client.settings.AmbientOcclusionStatus;
|
import net.minecraft.client.settings.AmbientOcclusionStatus;
|
||||||
import net.minecraft.client.settings.CloudOption;
|
import net.minecraft.client.settings.CloudOption;
|
||||||
|
import net.minecraft.client.settings.GraphicsFanciness;
|
||||||
import net.minecraft.client.settings.ParticleStatus;
|
import net.minecraft.client.settings.ParticleStatus;
|
||||||
import net.minecraft.client.tutorial.TutorialSteps;
|
import net.minecraft.client.tutorial.TutorialSteps;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
import net.minecraft.server.IDynamicRegistries;
|
||||||
import net.minecraft.server.integrated.IntegratedServer;
|
import net.minecraft.server.integrated.IntegratedServer;
|
||||||
import net.minecraft.util.HTTPUtil;
|
import net.minecraft.util.HTTPUtil;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.*;
|
import net.minecraft.world.*;
|
||||||
import net.minecraft.world.dimension.DimensionType;
|
import net.minecraft.world.gen.settings.DimensionGeneratorSettings;
|
||||||
import net.minecraft.world.server.ServerWorld;
|
import net.minecraft.world.server.ServerWorld;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -82,7 +84,7 @@ public class BaritoneAutoTest implements AbstractGameEventListener, Helper {
|
||||||
s.chatScale = 0.0F;
|
s.chatScale = 0.0F;
|
||||||
s.ambientOcclusionStatus = AmbientOcclusionStatus.OFF;
|
s.ambientOcclusionStatus = AmbientOcclusionStatus.OFF;
|
||||||
s.cloudOption = CloudOption.OFF;
|
s.cloudOption = CloudOption.OFF;
|
||||||
s.fancyGraphics = false;
|
s.field_238330_f_ = GraphicsFanciness.FAST;
|
||||||
s.tutorialStep = TutorialSteps.NONE;
|
s.tutorialStep = TutorialSteps.NONE;
|
||||||
s.hideGUI = true;
|
s.hideGUI = true;
|
||||||
s.fov = 30.0F;
|
s.fov = 30.0F;
|
||||||
|
@ -90,24 +92,27 @@ public class BaritoneAutoTest implements AbstractGameEventListener, Helper {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTick(TickEvent event) {
|
public void onTick(TickEvent event) {
|
||||||
|
// I don't want to make autotest work right now :)
|
||||||
|
System.exit(0);
|
||||||
|
/*
|
||||||
IPlayerContext ctx = BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext();
|
IPlayerContext ctx = BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext();
|
||||||
// If we're on the main menu then create the test world and launch the integrated server
|
// If we're on the main menu then create the test world and launch the integrated server
|
||||||
if (mc.currentScreen instanceof MainMenuScreen) {
|
if (mc.currentScreen instanceof MainMenuScreen) {
|
||||||
System.out.println("Beginning Baritone automatic test routine");
|
System.out.println("Beginning Baritone automatic test routine");
|
||||||
mc.displayGuiScreen(null);
|
mc.displayGuiScreen(null);
|
||||||
WorldSettings worldsettings = new WorldSettings(TEST_SEED, GameType.SURVIVAL, true, false, WorldType.DEFAULT);
|
WorldSettings worldsettings = new WorldSettings(TEST_SEED, GameType.SURVIVAL, true, false, WorldType.DEFAULT);
|
||||||
mc.launchIntegratedServer("BaritoneAutoTest", "BaritoneAutoTest", worldsettings);
|
mc.func_238192_a_("BaritoneAutoTest", worldsettings, IDynamicRegistries.func_239770_b_(), DimensionGeneratorSettings.field_236202_b_);
|
||||||
}
|
}
|
||||||
|
|
||||||
IntegratedServer server = mc.getIntegratedServer();
|
IntegratedServer server = mc.getIntegratedServer();
|
||||||
|
|
||||||
// If the integrated server is launched and the world has initialized, set the spawn point
|
// If the integrated server is launched and the world has initialized, set the spawn point
|
||||||
// to our defined starting position
|
// to our defined starting position
|
||||||
if (server != null && server.getWorld(DimensionType.OVERWORLD) != null) {
|
if (server != null && server.getWorld(World.field_234918_g_) != null) {
|
||||||
server.setDifficultyForAllWorlds(Difficulty.PEACEFUL, true);
|
server.setDifficultyForAllWorlds(Difficulty.PEACEFUL, true);
|
||||||
if (mc.player == null) {
|
if (mc.player == null) {
|
||||||
server.execute(() -> {
|
server.execute(() -> {
|
||||||
server.getWorld(DimensionType.OVERWORLD).setSpawnPoint(STARTING_POSITION);
|
server.getWorld(World.field_234918_g_).func_241124_a__(STARTING_POSITION);
|
||||||
server.getCommandManager().handleCommand(server.getCommandSource(), "/difficulty peaceful");
|
server.getCommandManager().handleCommand(server.getCommandSource(), "/difficulty peaceful");
|
||||||
int result = server.getCommandManager().handleCommand(server.getCommandSource(), "/gamerule spawnRadius 0");
|
int result = server.getCommandManager().handleCommand(server.getCommandSource(), "/gamerule spawnRadius 0");
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
|
@ -117,12 +122,8 @@ public class BaritoneAutoTest implements AbstractGameEventListener, Helper {
|
||||||
for (final ServerWorld world : mc.getIntegratedServer().getWorlds()) {
|
for (final ServerWorld world : mc.getIntegratedServer().getWorlds()) {
|
||||||
// If the world has initialized, set the spawn point to our defined starting position
|
// If the world has initialized, set the spawn point to our defined starting position
|
||||||
if (world != null) {
|
if (world != null) {
|
||||||
// I would rather do this than try to mess with poz
|
world.getGameRules().get(GameRules.SPAWN_RADIUS).func_234909_b_("0");
|
||||||
CompoundNBT nbt = world.getGameRules().write();
|
world.func_241124_a__(STARTING_POSITION);
|
||||||
nbt.putString("spawnRadius", "0");
|
|
||||||
world.getGameRules().read(nbt);
|
|
||||||
|
|
||||||
world.setSpawnPoint(STARTING_POSITION);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -173,6 +174,7 @@ public class BaritoneAutoTest implements AbstractGameEventListener, Helper {
|
||||||
throw new IllegalStateException("took too long");
|
throw new IllegalStateException("took too long");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private BaritoneAutoTest() {
|
private BaritoneAutoTest() {
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
package baritone.utils;
|
package baritone.utils;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.fluid.IFluidState;
|
import net.minecraft.fluid.FluidState;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockReader;
|
import net.minecraft.world.IBlockReader;
|
||||||
|
@ -51,7 +51,7 @@ public final class BlockStateInterfaceAccessWrapper implements IBlockReader {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFluidState getFluidState(BlockPos blockPos) {
|
public FluidState getFluidState(BlockPos blockPos) {
|
||||||
return getBlockState(blockPos).getFluidState();
|
return getBlockState(blockPos).getFluidState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,12 +27,13 @@ import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
import net.minecraft.client.renderer.Matrix4f;
|
|
||||||
import net.minecraft.client.renderer.Vector4f;
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.util.math.*;
|
import net.minecraft.util.math.*;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.math.vector.Matrix4f;
|
||||||
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
|
import net.minecraft.util.math.vector.Vector4f;
|
||||||
import net.minecraft.util.text.StringTextComponent;
|
import net.minecraft.util.text.StringTextComponent;
|
||||||
|
import net.minecraft.util.text.TextComponent;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.util.text.event.ClickEvent;
|
import net.minecraft.util.text.event.ClickEvent;
|
||||||
|
|
||||||
|
@ -54,23 +55,24 @@ public class GuiClick extends Screen implements Helper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPauseScreen() {
|
public boolean func_231177_au__() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
public void func_230430_a_(MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
|
||||||
double mx = mc.mouseHelper.getMouseX();
|
double mx = mc.mouseHelper.getMouseX();
|
||||||
double my = mc.mouseHelper.getMouseY();
|
double my = mc.mouseHelper.getMouseY();
|
||||||
|
|
||||||
my = mc.getMainWindow().getHeight() - my;
|
my = mc.getMainWindow().getHeight() - my;
|
||||||
my *= mc.getMainWindow().getFramebufferHeight() / (double) mc.getMainWindow().getHeight();
|
my *= mc.getMainWindow().getFramebufferHeight() / (double) mc.getMainWindow().getHeight();
|
||||||
mx *= mc.getMainWindow().getFramebufferWidth() / (double) mc.getMainWindow().getWidth();
|
mx *= mc.getMainWindow().getFramebufferWidth() / (double) mc.getMainWindow().getWidth();
|
||||||
Vec3d near = toWorld(mx, my, 0);
|
Vector3d near = toWorld(mx, my, 0);
|
||||||
Vec3d far = toWorld(mx, my, 1); // "Use 0.945 that's what stack overflow says" - leijurv
|
Vector3d far = toWorld(mx, my, 1); // "Use 0.945 that's what stack overflow says" - leijurv
|
||||||
|
|
||||||
if (near != null && far != null) {
|
if (near != null && far != null) {
|
||||||
///
|
///
|
||||||
Vec3d viewerPos = new Vec3d(PathRenderer.posX(), PathRenderer.posY(), PathRenderer.posZ());
|
Vector3d viewerPos = new Vector3d(PathRenderer.posX(), PathRenderer.posY(), PathRenderer.posZ());
|
||||||
ClientPlayerEntity player = BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext().player();
|
ClientPlayerEntity player = BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext().player();
|
||||||
RayTraceResult result = player.world.rayTraceBlocks(new RayTraceContext(near.add(viewerPos), far.add(viewerPos), RayTraceContext.BlockMode.OUTLINE, RayTraceContext.FluidMode.NONE, player));
|
RayTraceResult result = player.world.rayTraceBlocks(new RayTraceContext(near.add(viewerPos), far.add(viewerPos), RayTraceContext.BlockMode.OUTLINE, RayTraceContext.FluidMode.NONE, player));
|
||||||
if (result != null && result.getType() == RayTraceResult.Type.BLOCK) {
|
if (result != null && result.getType() == RayTraceResult.Type.BLOCK) {
|
||||||
|
@ -80,18 +82,18 @@ public class GuiClick extends Screen implements Helper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mouseReleased(double mouseX, double mouseY, int mouseButton) {
|
public boolean func_231048_c_(double mouseX, double mouseY, int mouseButton) {
|
||||||
if (mouseButton == 0) {
|
if (mouseButton == 0) {
|
||||||
if (clickStart != null && !clickStart.equals(currentMouseOver)) {
|
if (clickStart != null && !clickStart.equals(currentMouseOver)) {
|
||||||
BaritoneAPI.getProvider().getPrimaryBaritone().getSelectionManager().removeAllSelections();
|
BaritoneAPI.getProvider().getPrimaryBaritone().getSelectionManager().removeAllSelections();
|
||||||
BaritoneAPI.getProvider().getPrimaryBaritone().getSelectionManager().addSelection(BetterBlockPos.from(clickStart), BetterBlockPos.from(currentMouseOver));
|
BaritoneAPI.getProvider().getPrimaryBaritone().getSelectionManager().addSelection(BetterBlockPos.from(clickStart), BetterBlockPos.from(currentMouseOver));
|
||||||
ITextComponent component = new StringTextComponent("Selection made! For usage: " + Baritone.settings().prefix.value + "help sel");
|
TextComponent component = new StringTextComponent("Selection made! For usage: " + Baritone.settings().prefix.value + "help sel");
|
||||||
component.getStyle()
|
component.func_230530_a_(component.getStyle()
|
||||||
.setColor(TextFormatting.WHITE)
|
.func_240712_a_(TextFormatting.WHITE)
|
||||||
.setClickEvent(new ClickEvent(
|
.func_240715_a_(new ClickEvent(
|
||||||
ClickEvent.Action.RUN_COMMAND,
|
ClickEvent.Action.RUN_COMMAND,
|
||||||
FORCE_COMMAND_PREFIX + "help sel"
|
FORCE_COMMAND_PREFIX + "help sel"
|
||||||
));
|
)));
|
||||||
Helper.HELPER.logDirect(component);
|
Helper.HELPER.logDirect(component);
|
||||||
clickStart = null;
|
clickStart = null;
|
||||||
} else {
|
} else {
|
||||||
|
@ -101,13 +103,13 @@ public class GuiClick extends Screen implements Helper {
|
||||||
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalBlock(currentMouseOver.up()));
|
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalBlock(currentMouseOver.up()));
|
||||||
}
|
}
|
||||||
clickStart = null;
|
clickStart = null;
|
||||||
return super.mouseReleased(mouseX, mouseY, mouseButton);
|
return super.func_231048_c_(mouseX, mouseY, mouseButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) {
|
public boolean func_231044_a_(double mouseX, double mouseY, int mouseButton) {
|
||||||
clickStart = currentMouseOver;
|
clickStart = currentMouseOver;
|
||||||
return super.mouseClicked(mouseX, mouseY, mouseButton);
|
return super.func_231044_a_(mouseX, mouseY, mouseButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onRender(MatrixStack modelViewStack, Matrix4f projectionMatrix) {
|
public void onRender(MatrixStack modelViewStack, Matrix4f projectionMatrix) {
|
||||||
|
@ -139,7 +141,7 @@ public class GuiClick extends Screen implements Helper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vec3d toWorld(double x, double y, double z) {
|
private Vector3d toWorld(double x, double y, double z) {
|
||||||
if (this.projectionViewMatrix == null) {
|
if (this.projectionViewMatrix == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -156,6 +158,6 @@ public class GuiClick extends Screen implements Helper {
|
||||||
}
|
}
|
||||||
|
|
||||||
pos.perspectiveDivide();
|
pos.perspectiveDivide();
|
||||||
return new Vec3d(pos.getX(), pos.getY(), pos.getZ());
|
return new Vector3d(pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,10 +24,10 @@ import baritone.utils.accessor.IEntityRenderManager;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import net.minecraft.client.renderer.BufferBuilder;
|
import net.minecraft.client.renderer.BufferBuilder;
|
||||||
import net.minecraft.client.renderer.Matrix4f;
|
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.math.vector.Matrix4f;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@ import baritone.pathing.path.PathExecutor;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.client.renderer.Matrix4f;
|
|
||||||
import net.minecraft.client.renderer.tileentity.BeaconTileEntityRenderer;
|
import net.minecraft.client.renderer.tileentity.BeaconTileEntityRenderer;
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
@ -39,6 +38,8 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.math.shapes.VoxelShape;
|
import net.minecraft.util.math.shapes.VoxelShape;
|
||||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||||
|
import net.minecraft.util.math.vector.Matrix4f;
|
||||||
|
import net.minecraft.world.DimensionType;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
@ -77,8 +78,8 @@ public final class PathRenderer implements IRenderer, Helper {
|
||||||
((GuiClick) Helper.mc.currentScreen).onRender(event.getModelViewStack(), event.getProjectionMatrix());
|
((GuiClick) Helper.mc.currentScreen).onRender(event.getModelViewStack(), event.getProjectionMatrix());
|
||||||
}
|
}
|
||||||
|
|
||||||
int thisPlayerDimension = behavior.baritone.getPlayerContext().world().getDimension().getType().getId();
|
DimensionType thisPlayerDimension = behavior.baritone.getPlayerContext().world().func_230315_m_();
|
||||||
int currentRenderViewDimension = BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext().world().getDimension().getType().getId();
|
DimensionType currentRenderViewDimension = BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext().world().func_230315_m_();
|
||||||
|
|
||||||
if (thisPlayerDimension != currentRenderViewDimension) {
|
if (thisPlayerDimension != currentRenderViewDimension) {
|
||||||
// this is a path for a bot in a different dimension, don't render it
|
// this is a path for a bot in a different dimension, don't render it
|
||||||
|
|
|
@ -161,7 +161,7 @@ public class ToolSet {
|
||||||
}
|
}
|
||||||
|
|
||||||
speed /= hardness;
|
speed /= hardness;
|
||||||
if (state.getMaterial().isToolNotRequired() || (!item.isEmpty() && item.canHarvestBlock(state))) {
|
if (!state.func_235783_q_() || (!item.isEmpty() && item.canHarvestBlock(state))) {
|
||||||
return speed / 30;
|
return speed / 30;
|
||||||
} else {
|
} else {
|
||||||
return speed / 100;
|
return speed / 100;
|
||||||
|
|
|
@ -24,7 +24,7 @@ import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap;
|
||||||
import net.minecraft.entity.MobEntity;
|
import net.minecraft.entity.MobEntity;
|
||||||
import net.minecraft.entity.monster.EndermanEntity;
|
import net.minecraft.entity.monster.EndermanEntity;
|
||||||
import net.minecraft.entity.monster.SpiderEntity;
|
import net.minecraft.entity.monster.SpiderEntity;
|
||||||
import net.minecraft.entity.monster.ZombiePigmanEntity;
|
import net.minecraft.entity.monster.ZombifiedPiglinEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -75,9 +75,9 @@ public class Avoidance {
|
||||||
ctx.entitiesStream()
|
ctx.entitiesStream()
|
||||||
.filter(entity -> entity instanceof MobEntity)
|
.filter(entity -> entity instanceof MobEntity)
|
||||||
.filter(entity -> (!(entity instanceof SpiderEntity)) || ctx.player().getBrightness() < 0.5)
|
.filter(entity -> (!(entity instanceof SpiderEntity)) || ctx.player().getBrightness() < 0.5)
|
||||||
.filter(entity -> !(entity instanceof ZombiePigmanEntity) || ((ZombiePigmanEntity) entity).getRevengeTarget() != null)
|
.filter(entity -> !(entity instanceof ZombifiedPiglinEntity) || ((ZombifiedPiglinEntity) entity).getRevengeTarget() != null)
|
||||||
.filter(entity -> !(entity instanceof EndermanEntity) || ((EndermanEntity) entity).isScreaming())
|
.filter(entity -> !(entity instanceof EndermanEntity) || ((EndermanEntity) entity).isScreaming())
|
||||||
.forEach(entity -> res.add(new Avoidance(new BlockPos(entity), mobCoeff, Baritone.settings().mobAvoidanceRadius.value)));
|
.forEach(entity -> res.add(new Avoidance(entity.func_233580_cy_(), mobCoeff, Baritone.settings().mobAvoidanceRadius.value)));
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.state.IProperty;
|
import net.minecraft.state.Property;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ public final class SpongeSchematic extends StaticSchematic {
|
||||||
this.blockState = block.getDefaultState();
|
this.blockState = block.getDefaultState();
|
||||||
|
|
||||||
this.properties.keySet().stream().sorted(String::compareTo).forEachOrdered(key -> {
|
this.properties.keySet().stream().sorted(String::compareTo).forEachOrdered(key -> {
|
||||||
IProperty<?> property = block.getStateContainer().getProperty(key);
|
Property<?> property = block.getStateContainer().getProperty(key);
|
||||||
if (property != null) {
|
if (property != null) {
|
||||||
this.blockState = setPropertyValue(this.blockState, property, this.properties.get(key));
|
this.blockState = setPropertyValue(this.blockState, property, this.properties.get(key));
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ public final class SpongeSchematic extends StaticSchematic {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <T extends Comparable<T>> BlockState setPropertyValue(BlockState state, IProperty<T> property, String value) {
|
private static <T extends Comparable<T>> BlockState setPropertyValue(BlockState state, Property<T> property, String value) {
|
||||||
Optional<T> parsed = property.parseValue(value);
|
Optional<T> parsed = property.parseValue(value);
|
||||||
if (parsed.isPresent()) {
|
if (parsed.isPresent()) {
|
||||||
return state.with(property, parsed.get());
|
return state.with(property, parsed.get());
|
||||||
|
|
Loading…
Reference in New Issue