mirror of https://github.com/cabaletta/baritone
1.19
This commit is contained in:
parent
db9ee98762
commit
9e021d2875
|
@ -16,12 +16,8 @@
|
|||
*/
|
||||
|
||||
plugins {
|
||||
id "architectury-plugin" version "3.4.131"
|
||||
id 'dev.architectury.loom' version '0.11.0.254' apply false
|
||||
}
|
||||
|
||||
architectury {
|
||||
minecraft = rootProject.minecraft_version
|
||||
id "architectury-plugin" version "3.4-SNAPSHOT"
|
||||
id 'dev.architectury.loom' version '0.12.0-SNAPSHOT' apply false
|
||||
}
|
||||
|
||||
subprojects {
|
||||
|
|
|
@ -3,7 +3,7 @@ import baritone.gradle.task.ProguardTask
|
|||
|
||||
architectury {
|
||||
injectInjectables = false
|
||||
common()
|
||||
common("fabric")
|
||||
}
|
||||
|
||||
//loom {
|
||||
|
|
|
@ -26,6 +26,6 @@
|
|||
|
||||
"depends": {
|
||||
"fabricloader": ">=0.11.0",
|
||||
"minecraft": "1.18.x"
|
||||
"minecraft": "1.19-beta.4"
|
||||
}
|
||||
}
|
|
@ -1,12 +1,12 @@
|
|||
org.gradle.jvmargs=-Xmx2048M
|
||||
|
||||
mod_version=1.8.3
|
||||
mod_version=1.9.0
|
||||
maven_group=baritone
|
||||
archives_base_name=baritone
|
||||
|
||||
minecraft_version=1.18.2
|
||||
minecraft_version=1.19-pre4
|
||||
forge_version=1.18.2-40.0.0
|
||||
fabric_version=0.13.1
|
||||
fabric_version=0.13.3
|
||||
|
||||
# # un comment for forge debugging default (as opposed to fabric)
|
||||
# baritone.forge_build=true
|
||||
|
|
|
@ -43,6 +43,6 @@ pluginManagement {
|
|||
rootProject.name = 'baritone'
|
||||
|
||||
include("fabric")
|
||||
include("forge")
|
||||
//include("forge")
|
||||
include("common")
|
||||
include("tweaker")
|
||||
|
|
|
@ -23,9 +23,7 @@ import baritone.api.utils.TypeUtils;
|
|||
import baritone.api.utils.gui.BaritoneToast;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.core.Vec3i;
|
||||
import net.minecraft.network.chat.BaseComponent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
|
|
@ -21,15 +21,16 @@ import baritone.api.command.argument.IArgConsumer;
|
|||
import baritone.api.command.exception.CommandException;
|
||||
import baritone.api.command.exception.CommandInvalidTypeException;
|
||||
import baritone.api.utils.Helper;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.network.chat.BaseComponent;
|
||||
import net.minecraft.network.chat.ClickEvent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.HoverEvent;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
|
||||
public class Paginator<E> implements Helper {
|
||||
|
||||
|
@ -74,7 +75,7 @@ public class Paginator<E> implements Helper {
|
|||
}
|
||||
boolean hasPrevPage = commandPrefix != null && validPage(page - 1);
|
||||
boolean hasNextPage = commandPrefix != null && validPage(page + 1);
|
||||
BaseComponent prevPageComponent = new TextComponent("<<");
|
||||
MutableComponent prevPageComponent = Component.literal("<<");
|
||||
if (hasPrevPage) {
|
||||
prevPageComponent.setStyle(prevPageComponent.getStyle()
|
||||
.withClickEvent(new ClickEvent(
|
||||
|
@ -83,12 +84,12 @@ public class Paginator<E> implements Helper {
|
|||
))
|
||||
.withHoverEvent(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
new TextComponent("Click to view previous page")
|
||||
Component.literal("Click to view previous page")
|
||||
)));
|
||||
} else {
|
||||
prevPageComponent.setStyle(prevPageComponent.getStyle().withColor(ChatFormatting.DARK_GRAY));
|
||||
}
|
||||
BaseComponent nextPageComponent = new TextComponent(">>");
|
||||
MutableComponent nextPageComponent = Component.literal(">>");
|
||||
if (hasNextPage) {
|
||||
nextPageComponent.setStyle(nextPageComponent.getStyle()
|
||||
.withClickEvent(new ClickEvent(
|
||||
|
@ -97,12 +98,12 @@ public class Paginator<E> implements Helper {
|
|||
))
|
||||
.withHoverEvent(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
new TextComponent("Click to view next page")
|
||||
Component.literal("Click to view next page")
|
||||
)));
|
||||
} else {
|
||||
nextPageComponent.setStyle(nextPageComponent.getStyle().withColor(ChatFormatting.DARK_GRAY));
|
||||
}
|
||||
BaseComponent pagerComponent = new TextComponent("");
|
||||
MutableComponent pagerComponent = Component.literal("");
|
||||
pagerComponent.setStyle(pagerComponent.getStyle().withColor(ChatFormatting.GRAY));
|
||||
pagerComponent.append(prevPageComponent);
|
||||
pagerComponent.append(" | ");
|
||||
|
|
|
@ -29,6 +29,7 @@ import net.minecraft.server.packs.repository.Pack;
|
|||
import net.minecraft.server.packs.repository.PackRepository;
|
||||
import net.minecraft.server.packs.repository.ServerPacksSource;
|
||||
import net.minecraft.server.packs.resources.ReloadableResourceManager;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.util.Unit;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
@ -173,7 +174,7 @@ public final class BlockOptionalMeta {
|
|||
// the other overload for generate doesnt work in forge because forge adds code that requires a non null world
|
||||
getManager().get(lootTableLocation).getRandomItems(
|
||||
new LootContext.Builder((ServerLevel) null)
|
||||
.withRandom(new Random())
|
||||
.withRandom(RandomSource.create())
|
||||
.withParameter(LootContextParams.ORIGIN, Vec3.atLowerCornerOf(BlockPos.ZERO))
|
||||
.withParameter(LootContextParams.TOOL, ItemStack.EMPTY)
|
||||
.withOptionalParameter(LootContextParams.BLOCK_ENTITY, null)
|
||||
|
|
|
@ -21,9 +21,10 @@ import baritone.api.BaritoneAPI;
|
|||
import baritone.api.utils.gui.BaritoneToast;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.network.chat.BaseComponent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.stream.Stream;
|
||||
|
@ -51,11 +52,11 @@ public interface Helper {
|
|||
// Inner text component
|
||||
final Calendar now = Calendar.getInstance();
|
||||
final boolean xd = now.get(Calendar.MONTH) == Calendar.APRIL && now.get(Calendar.DAY_OF_MONTH) <= 3;
|
||||
BaseComponent baritone = new TextComponent(xd ? "Baritoe" : BaritoneAPI.getSettings().shortBaritonePrefix.value ? "B" : "Baritone");
|
||||
MutableComponent baritone = Component.literal(xd ? "Baritoe" : BaritoneAPI.getSettings().shortBaritonePrefix.value ? "B" : "Baritone");
|
||||
baritone.setStyle(baritone.getStyle().withColor(ChatFormatting.LIGHT_PURPLE));
|
||||
|
||||
// Outer brackets
|
||||
BaseComponent prefix = new TextComponent("");
|
||||
MutableComponent prefix = Component.literal("");
|
||||
prefix.setStyle(baritone.getStyle().withColor(ChatFormatting.DARK_PURPLE));
|
||||
prefix.append("[");
|
||||
prefix.append(baritone);
|
||||
|
@ -81,7 +82,7 @@ public interface Helper {
|
|||
* @param message The message to display in the popup
|
||||
*/
|
||||
default void logToast(String title, String message) {
|
||||
logToast(new TextComponent(title), new TextComponent(message));
|
||||
logToast(Component.literal(title), Component.literal(message));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -90,7 +91,7 @@ public interface Helper {
|
|||
* @param message The message to display in the popup
|
||||
*/
|
||||
default void logToast(String message) {
|
||||
logToast(Helper.getPrefix(), new TextComponent(message));
|
||||
logToast(Helper.getPrefix(), Component.literal(message));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -158,9 +159,9 @@ public interface Helper {
|
|||
* @param components The components to send
|
||||
*/
|
||||
default void logDirect(boolean logAsToast, Component... components) {
|
||||
BaseComponent component = new TextComponent("");
|
||||
MutableComponent component = Component.literal("");
|
||||
component.append(getPrefix());
|
||||
component.append(new TextComponent(" "));
|
||||
component.append(Component.literal(" "));
|
||||
Arrays.asList(components).forEach(component::append);
|
||||
if (logAsToast) {
|
||||
logToast(getPrefix(), component);
|
||||
|
@ -188,7 +189,7 @@ public interface Helper {
|
|||
*/
|
||||
default void logDirect(String message, ChatFormatting color, boolean logAsToast) {
|
||||
Stream.of(message.split("\n")).forEach(line -> {
|
||||
BaseComponent component = new TextComponent(line.replace("\t", " "));
|
||||
MutableComponent component = Component.literal(line.replace("\t", " "));
|
||||
component.setStyle(component.getStyle().withColor(color));
|
||||
logDirect(logAsToast, component);
|
||||
});
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
package baritone.launch.mixins;
|
||||
|
||||
import baritone.utils.accessor.IChunkArray;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
|
@ -27,24 +28,28 @@ import net.minecraft.world.level.chunk.LevelChunk;
|
|||
|
||||
@Mixin(targets = "net.minecraft.client.multiplayer.ClientChunkCache$Storage")
|
||||
public abstract class MixinChunkArray implements IChunkArray {
|
||||
@Final
|
||||
@Shadow
|
||||
private AtomicReferenceArray<LevelChunk> chunks;
|
||||
AtomicReferenceArray<LevelChunk> chunks;
|
||||
@Final
|
||||
@Shadow
|
||||
private int chunkRadius;
|
||||
int chunkRadius;
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
private int viewRange;
|
||||
@Shadow
|
||||
private int viewCenterX;
|
||||
int viewCenterX;
|
||||
@Shadow
|
||||
private int viewCenterZ;
|
||||
int viewCenterZ;
|
||||
@Shadow
|
||||
private int chunkCount;
|
||||
int chunkCount;
|
||||
|
||||
@Shadow
|
||||
protected abstract boolean inRange(int x, int z);
|
||||
abstract boolean inRange(int x, int z);
|
||||
|
||||
@Shadow
|
||||
protected abstract int getIndex(int x, int z);
|
||||
abstract int getIndex(int x, int z);
|
||||
|
||||
@Shadow
|
||||
protected abstract void replace(int index, LevelChunk chunk);
|
||||
|
|
|
@ -26,6 +26,7 @@ import baritone.api.event.events.type.EventState;
|
|||
import baritone.behavior.LookBehavior;
|
||||
import net.minecraft.client.KeyMapping;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.entity.player.Abilities;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
@ -41,12 +42,12 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||
public class MixinClientPlayerEntity {
|
||||
|
||||
@Inject(
|
||||
method = "chat",
|
||||
method = "chat(Ljava/lang/String;Lnet/minecraft/network/chat/Component;)V",
|
||||
at = @At("HEAD"),
|
||||
cancellable = true
|
||||
)
|
||||
private void sendChatMessage(String msg, CallbackInfo ci) {
|
||||
ChatEvent event = new ChatEvent(msg);
|
||||
private void sendChatMessage(String string, Component component, CallbackInfo ci) {
|
||||
ChatEvent event = new ChatEvent(string);
|
||||
IBaritone baritone = BaritoneAPI.getProvider().getBaritoneForPlayer((LocalPlayer) (Object) this);
|
||||
if (baritone == null) {
|
||||
return;
|
||||
|
|
|
@ -39,7 +39,7 @@ public abstract class MixinItemStack implements IItemStack {
|
|||
private int baritoneHash;
|
||||
|
||||
@Shadow
|
||||
protected abstract int getDamageValue();
|
||||
public abstract int getDamageValue();
|
||||
|
||||
private void recalculateHash() {
|
||||
baritoneHash = item == null ? -1 : item.hashCode() + getDamageValue();
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
"required": true,
|
||||
"package": "baritone.launch.mixins",
|
||||
"refmap": "baritone-common-refmap.json",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"verbose": false,
|
||||
"injectors": {
|
||||
"maxShiftBy": 2
|
||||
"maxShiftBy": 2,
|
||||
"defaultRequire": 1
|
||||
},
|
||||
"client": [
|
||||
"MixinChunkArray",
|
||||
|
|
|
@ -237,11 +237,11 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
|
|||
if (current != null) {
|
||||
switch (event.getState()) {
|
||||
case PRE:
|
||||
lastAutoJump = mc.options.autoJump;
|
||||
mc.options.autoJump = false;
|
||||
lastAutoJump = mc.options.autoJump().get();
|
||||
mc.options.autoJump().set(false);
|
||||
break;
|
||||
case POST:
|
||||
mc.options.autoJump = lastAutoJump;
|
||||
mc.options.autoJump().set(lastAutoJump);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -31,6 +31,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.world.level.chunk.LevelChunk;
|
||||
import net.minecraft.world.level.chunk.LevelChunkSection;
|
||||
import net.minecraft.world.level.chunk.PalettedContainer;
|
||||
import net.minecraft.world.level.dimension.BuiltinDimensionTypes;
|
||||
import net.minecraft.world.level.dimension.DimensionType;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import java.util.*;
|
||||
|
@ -171,7 +172,7 @@ public final class ChunkPacker {
|
|||
if (dimension.ultraWarm()) {
|
||||
return Blocks.NETHERRACK.defaultBlockState();
|
||||
}
|
||||
if (dimension.createDragonFight()) {
|
||||
if (dimension.effectsLocation().equals(BuiltinDimensionTypes.END_EFFECTS)) {
|
||||
return Blocks.END_STONE.defaultBlockState();
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -35,10 +35,8 @@ import baritone.command.argument.CommandArguments;
|
|||
import baritone.command.manager.CommandManager;
|
||||
import baritone.utils.accessor.IGuiScreen;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.network.chat.BaseComponent;
|
||||
import net.minecraft.network.chat.ClickEvent;
|
||||
import net.minecraft.network.chat.HoverEvent;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.*;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.util.Tuple;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
|
@ -78,12 +76,12 @@ public class ExampleBaritoneControl implements Helper, AbstractGameEventListener
|
|||
if (settings.echoCommands.value) {
|
||||
String msg = command + rest;
|
||||
String toDisplay = settings.censorRanCommands.value ? command + " ..." : msg;
|
||||
BaseComponent component = new TextComponent(String.format("> %s", toDisplay));
|
||||
MutableComponent component = Component.literal(String.format("> %s", toDisplay));
|
||||
component.setStyle(component.getStyle()
|
||||
.withColor(ChatFormatting.WHITE)
|
||||
.withHoverEvent(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
new TextComponent("Click to rerun command")
|
||||
Component.literal("Click to rerun command")
|
||||
))
|
||||
.withClickEvent(new ClickEvent(
|
||||
ClickEvent.Action.RUN_COMMAND,
|
||||
|
|
|
@ -25,16 +25,18 @@ import baritone.api.command.exception.CommandException;
|
|||
import baritone.api.command.exception.CommandNotFoundException;
|
||||
import baritone.api.command.helpers.Paginator;
|
||||
import baritone.api.command.helpers.TabCompleteHelper;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.network.chat.BaseComponent;
|
||||
import net.minecraft.network.chat.ClickEvent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.HoverEvent;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
|
||||
import static baritone.api.command.IBaritoneChatControl.FORCE_COMMAND_PREFIX;
|
||||
|
||||
|
@ -58,17 +60,17 @@ public class HelpCommand extends Command {
|
|||
command -> {
|
||||
String names = String.join("/", command.getNames());
|
||||
String name = command.getNames().get(0);
|
||||
TextComponent shortDescComponent = new TextComponent(" - " + command.getShortDesc());
|
||||
MutableComponent shortDescComponent = Component.literal(" - " + command.getShortDesc());
|
||||
shortDescComponent.setStyle(shortDescComponent.getStyle().withColor(ChatFormatting.DARK_GRAY));
|
||||
TextComponent namesComponent = new TextComponent(names);
|
||||
MutableComponent namesComponent = Component.literal(names);
|
||||
namesComponent.setStyle(namesComponent.getStyle().withColor(ChatFormatting.WHITE));
|
||||
TextComponent hoverComponent = new TextComponent("");
|
||||
MutableComponent hoverComponent = Component.literal("");
|
||||
hoverComponent.setStyle(hoverComponent.getStyle().withColor(ChatFormatting.GRAY));
|
||||
hoverComponent.append(namesComponent);
|
||||
hoverComponent.append("\n" + command.getShortDesc());
|
||||
hoverComponent.append("\n\nClick to view full help");
|
||||
String clickCommand = FORCE_COMMAND_PREFIX + String.format("%s %s", label, command.getNames().get(0));
|
||||
TextComponent component = new TextComponent(name);
|
||||
MutableComponent component = Component.literal(name);
|
||||
component.setStyle(component.getStyle().withColor(ChatFormatting.GRAY));
|
||||
component.append(shortDescComponent);
|
||||
component.setStyle(component.getStyle()
|
||||
|
@ -88,7 +90,7 @@ public class HelpCommand extends Command {
|
|||
logDirect("");
|
||||
command.getLongDesc().forEach(this::logDirect);
|
||||
logDirect("");
|
||||
BaseComponent returnComponent = new TextComponent("Click to return to the help menu");
|
||||
MutableComponent returnComponent = Component.literal("Click to return to the help menu");
|
||||
returnComponent.setStyle(returnComponent.getStyle().withClickEvent(new ClickEvent(
|
||||
ClickEvent.Action.RUN_COMMAND,
|
||||
FORCE_COMMAND_PREFIX + label
|
||||
|
|
|
@ -37,7 +37,7 @@ public class RenderCommand extends Command {
|
|||
public void execute(String label, IArgConsumer args) throws CommandException {
|
||||
args.requireMax(0);
|
||||
BetterBlockPos origin = ctx.playerFeet();
|
||||
int renderDistance = (mc.options.renderDistance + 1) * 16;
|
||||
int renderDistance = (mc.options.renderDistance().get() + 1) * 16;
|
||||
mc.levelRenderer.setBlocksDirty(
|
||||
origin.x - renderDistance,
|
||||
0,
|
||||
|
|
|
@ -34,10 +34,8 @@ import java.util.Locale;
|
|||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.network.chat.BaseComponent;
|
||||
import net.minecraft.network.chat.ClickEvent;
|
||||
import net.minecraft.network.chat.HoverEvent;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.*;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
|
||||
import static baritone.api.command.IBaritoneChatControl.FORCE_COMMAND_PREFIX;
|
||||
import static baritone.api.utils.SettingsUtil.*;
|
||||
|
@ -77,19 +75,19 @@ public class SetCommand extends Command {
|
|||
: String.format("All %ssettings:", viewModified ? "modified " : "")
|
||||
),
|
||||
setting -> {
|
||||
TextComponent typeComponent = new TextComponent(String.format(
|
||||
MutableComponent typeComponent = Component.literal(String.format(
|
||||
" (%s)",
|
||||
settingTypeToString(setting)
|
||||
));
|
||||
typeComponent.getStyle().withColor(ChatFormatting.DARK_GRAY);
|
||||
TextComponent hoverComponent = new TextComponent("");
|
||||
MutableComponent hoverComponent = Component.literal("");
|
||||
hoverComponent.getStyle().withColor(ChatFormatting.GRAY);
|
||||
hoverComponent.append(setting.getName());
|
||||
hoverComponent.append(String.format("\nType: %s", settingTypeToString(setting)));
|
||||
hoverComponent.append(String.format("\n\nValue:\n%s", settingValueToString(setting)));
|
||||
hoverComponent.append(String.format("\n\nDefault Value:\n%s", settingDefaultToString(setting)));
|
||||
String commandSuggestion = Baritone.settings().prefix.value + String.format("set %s ", setting.getName());
|
||||
TextComponent component = new TextComponent(setting.getName());
|
||||
MutableComponent component = Component.literal(setting.getName());
|
||||
component.setStyle(component.getStyle().withColor(ChatFormatting.GRAY));
|
||||
component.append(typeComponent);
|
||||
component.setStyle(component.getStyle()
|
||||
|
@ -169,12 +167,12 @@ public class SetCommand extends Command {
|
|||
settingValueToString(setting)
|
||||
));
|
||||
}
|
||||
BaseComponent oldValueComponent = new TextComponent(String.format("Old value: %s", oldValue));
|
||||
MutableComponent oldValueComponent = Component.literal(String.format("Old value: %s", oldValue));
|
||||
oldValueComponent.setStyle(oldValueComponent.getStyle()
|
||||
.withColor(ChatFormatting.GRAY)
|
||||
.withHoverEvent(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
new TextComponent("Click to set the setting back to this value")
|
||||
Component.literal("Click to set the setting back to this value")
|
||||
))
|
||||
.withClickEvent(new ClickEvent(
|
||||
ClickEvent.Action.RUN_COMMAND,
|
||||
|
|
|
@ -40,11 +40,11 @@ import java.util.function.Function;
|
|||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.network.chat.BaseComponent;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.ClickEvent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.HoverEvent;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
|
||||
import static baritone.api.command.IBaritoneChatControl.FORCE_COMMAND_PREFIX;
|
||||
|
||||
|
@ -63,13 +63,13 @@ public class WaypointsCommand extends Command {
|
|||
throw new CommandInvalidTypeException(args.consumed(), "an action");
|
||||
}
|
||||
BiFunction<IWaypoint, Action, Component> toComponent = (waypoint, _action) -> {
|
||||
BaseComponent component = new TextComponent("");
|
||||
BaseComponent tagComponent = new TextComponent(waypoint.getTag().name() + " ");
|
||||
MutableComponent component = Component.literal("");
|
||||
MutableComponent tagComponent = Component.literal(waypoint.getTag().name() + " ");
|
||||
tagComponent.setStyle(tagComponent.getStyle().withColor(ChatFormatting.GRAY));
|
||||
String name = waypoint.getName();
|
||||
BaseComponent nameComponent = new TextComponent(!name.isEmpty() ? name : "<empty>");
|
||||
MutableComponent nameComponent = Component.literal(!name.isEmpty() ? name : "<empty>");
|
||||
nameComponent.setStyle(nameComponent.getStyle().withColor(!name.isEmpty() ? ChatFormatting.GRAY : ChatFormatting.DARK_GRAY));
|
||||
BaseComponent timestamp = new TextComponent(" @ " + new Date(waypoint.getCreationTimestamp()));
|
||||
MutableComponent timestamp = Component.literal(" @ " + new Date(waypoint.getCreationTimestamp()));
|
||||
timestamp.setStyle(timestamp.getStyle().withColor(ChatFormatting.DARK_GRAY));
|
||||
component.append(tagComponent);
|
||||
component.append(nameComponent);
|
||||
|
@ -77,7 +77,7 @@ public class WaypointsCommand extends Command {
|
|||
component.setStyle(component.getStyle()
|
||||
.withHoverEvent(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
new TextComponent("Click to select")
|
||||
Component.literal("Click to select")
|
||||
))
|
||||
.withClickEvent(new ClickEvent(
|
||||
ClickEvent.Action.RUN_COMMAND,
|
||||
|
@ -143,7 +143,7 @@ public class WaypointsCommand extends Command {
|
|||
args.requireMax(0);
|
||||
IWaypoint waypoint = new Waypoint(name, tag, pos);
|
||||
ForWaypoints.waypoints(this.baritone).addWaypoint(waypoint);
|
||||
BaseComponent component = new TextComponent("Waypoint added: ");
|
||||
MutableComponent component = Component.literal("Waypoint added: ");
|
||||
component.setStyle(component.getStyle().withColor(ChatFormatting.GRAY));
|
||||
component.append(toComponent.apply(waypoint, Action.INFO));
|
||||
logDirect(component);
|
||||
|
@ -155,8 +155,8 @@ public class WaypointsCommand extends Command {
|
|||
ForWaypoints.waypoints(this.baritone).removeWaypoint(waypoint);
|
||||
}
|
||||
deletedWaypoints.computeIfAbsent(baritone.getWorldProvider().getCurrentWorld(), k -> new ArrayList<>()).addAll(Arrays.<IWaypoint>asList(waypoints));
|
||||
TextComponent textComponent = new TextComponent(String.format("Cleared %d waypoints, click to restore them", waypoints.length));
|
||||
textComponent.getStyle().withClickEvent(new ClickEvent(
|
||||
MutableComponent MutableComponent = Component.literal(String.format("Cleared %d waypoints, click to restore them", waypoints.length));
|
||||
MutableComponent.getStyle().withClickEvent(new ClickEvent(
|
||||
ClickEvent.Action.RUN_COMMAND,
|
||||
String.format(
|
||||
"%s%s restore @ %s",
|
||||
|
@ -165,7 +165,7 @@ public class WaypointsCommand extends Command {
|
|||
Stream.of(waypoints).map(wp -> Long.toString(wp.getCreationTimestamp())).collect(Collectors.joining(" "))
|
||||
)
|
||||
));
|
||||
logDirect(textComponent);
|
||||
logDirect(MutableComponent);
|
||||
} else if (action == Action.RESTORE) {
|
||||
List<IWaypoint> waypoints = new ArrayList<>();
|
||||
List<IWaypoint> deletedWaypoints = this.deletedWaypoints.getOrDefault(baritone.getWorldProvider().getCurrentWorld(), Collections.emptyList());
|
||||
|
@ -236,7 +236,7 @@ public class WaypointsCommand extends Command {
|
|||
if (action == Action.INFO) {
|
||||
logDirect(transform.apply(waypoint));
|
||||
logDirect(String.format("Position: %s", waypoint.getLocation()));
|
||||
BaseComponent deleteComponent = new TextComponent("Click to delete this waypoint");
|
||||
MutableComponent deleteComponent = Component.literal("Click to delete this waypoint");
|
||||
deleteComponent.setStyle(deleteComponent.getStyle().withClickEvent(new ClickEvent(
|
||||
ClickEvent.Action.RUN_COMMAND,
|
||||
String.format(
|
||||
|
@ -247,7 +247,7 @@ public class WaypointsCommand extends Command {
|
|||
waypoint.getCreationTimestamp()
|
||||
)
|
||||
)));
|
||||
BaseComponent goalComponent = new TextComponent("Click to set goal to this waypoint");
|
||||
MutableComponent goalComponent = Component.literal("Click to set goal to this waypoint");
|
||||
goalComponent.setStyle(goalComponent.getStyle().withClickEvent(new ClickEvent(
|
||||
ClickEvent.Action.RUN_COMMAND,
|
||||
String.format(
|
||||
|
@ -258,7 +258,7 @@ public class WaypointsCommand extends Command {
|
|||
waypoint.getCreationTimestamp()
|
||||
)
|
||||
)));
|
||||
BaseComponent recreateComponent = new TextComponent("Click to show a command to recreate this waypoint");
|
||||
MutableComponent recreateComponent = Component.literal("Click to show a command to recreate this waypoint");
|
||||
recreateComponent.getStyle().withClickEvent(new ClickEvent(
|
||||
ClickEvent.Action.SUGGEST_COMMAND,
|
||||
String.format(
|
||||
|
@ -272,7 +272,7 @@ public class WaypointsCommand extends Command {
|
|||
waypoint.getLocation().z
|
||||
)
|
||||
));
|
||||
BaseComponent backComponent = new TextComponent("Click to return to the waypoints list");
|
||||
MutableComponent backComponent = Component.literal("Click to return to the waypoints list");
|
||||
backComponent.getStyle().withClickEvent(new ClickEvent(
|
||||
ClickEvent.Action.RUN_COMMAND,
|
||||
String.format(
|
||||
|
@ -288,8 +288,8 @@ public class WaypointsCommand extends Command {
|
|||
} else if (action == Action.DELETE) {
|
||||
ForWaypoints.waypoints(this.baritone).removeWaypoint(waypoint);
|
||||
deletedWaypoints.computeIfAbsent(baritone.getWorldProvider().getCurrentWorld(), k -> new ArrayList<>()).add(waypoint);
|
||||
TextComponent textComponent = new TextComponent("That waypoint has successfully been deleted, click to restore it");
|
||||
textComponent.getStyle().withClickEvent(new ClickEvent(
|
||||
MutableComponent MutableComponent = Component.literal("That waypoint has successfully been deleted, click to restore it");
|
||||
MutableComponent.getStyle().withClickEvent(new ClickEvent(
|
||||
ClickEvent.Action.RUN_COMMAND,
|
||||
String.format(
|
||||
"%s%s restore @ %s",
|
||||
|
@ -298,7 +298,7 @@ public class WaypointsCommand extends Command {
|
|||
waypoint.getCreationTimestamp()
|
||||
)
|
||||
));
|
||||
logDirect(textComponent);
|
||||
logDirect(MutableComponent);
|
||||
} else if (action == Action.GOAL) {
|
||||
Goal goal = new GoalBlock(waypoint.getLocation());
|
||||
baritone.getCustomGoalProcess().setGoal(goal);
|
||||
|
|
|
@ -30,15 +30,16 @@ import net.minecraft.ChatFormatting;
|
|||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.network.chat.BaseComponent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.ClickEvent;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.ClipContext;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Collections;
|
||||
|
||||
|
@ -53,7 +54,7 @@ public class GuiClick extends Screen implements Helper {
|
|||
private BlockPos currentMouseOver;
|
||||
|
||||
public GuiClick() {
|
||||
super(new TextComponent("CLICK"));
|
||||
super(Component.literal("CLICK"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -90,7 +91,7 @@ public class GuiClick extends Screen implements Helper {
|
|||
if (clickStart != null && !clickStart.equals(currentMouseOver)) {
|
||||
BaritoneAPI.getProvider().getPrimaryBaritone().getSelectionManager().removeAllSelections();
|
||||
BaritoneAPI.getProvider().getPrimaryBaritone().getSelectionManager().addSelection(BetterBlockPos.from(clickStart), BetterBlockPos.from(currentMouseOver));
|
||||
BaseComponent component = new TextComponent("Selection made! For usage: " + Baritone.settings().prefix.value + "help sel");
|
||||
MutableComponent component = Component.literal("Selection made! For usage: " + Baritone.settings().prefix.value + "help sel");
|
||||
component.getStyle()
|
||||
.withColor(ChatFormatting.WHITE)
|
||||
.withClickEvent(new ClickEvent(
|
||||
|
|
|
@ -28,7 +28,7 @@ public class PlayerMovementInput extends net.minecraft.client.player.Input {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void tick(boolean p_225607_1_) {
|
||||
public void tick(boolean p_225607_1_, float f) {
|
||||
this.leftImpulse = 0.0F;
|
||||
this.forwardImpulse = 0.0F;
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ public class Avoidance {
|
|||
if (mobCoeff != 1.0D) {
|
||||
ctx.entitiesStream()
|
||||
.filter(entity -> entity instanceof Mob)
|
||||
.filter(entity -> (!(entity instanceof Spider)) || ctx.player().getBrightness() < 0.5)
|
||||
.filter(entity -> (!(entity instanceof Spider)) || ctx.player().getLightLevelDependentMagicValue() < 0.5)
|
||||
.filter(entity -> !(entity instanceof ZombifiedPiglin) || ((ZombifiedPiglin) entity).getLastHurtByMob() != null)
|
||||
.filter(entity -> !(entity instanceof EnderMan) || ((EnderMan) entity).isCreepy())
|
||||
.forEach(entity -> res.add(new Avoidance(entity.blockPosition(), mobCoeff, Baritone.settings().mobAvoidanceRadius.value)));
|
||||
|
|
|
@ -76,12 +76,12 @@ public enum PrimaryPlayerController implements IPlayerController, Helper {
|
|||
@Override
|
||||
public InteractionResult processRightClickBlock(LocalPlayer player, Level world, InteractionHand hand, BlockHitResult result) {
|
||||
// primaryplayercontroller is always in a ClientWorld so this is ok
|
||||
return mc.gameMode.useItemOn(player, (ClientLevel) world, hand, result);
|
||||
return mc.gameMode.useItemOn(player, hand, result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InteractionResult processRightClick(LocalPlayer player, Level world, InteractionHand hand) {
|
||||
return mc.gameMode.useItem(player, world, hand);
|
||||
return mc.gameMode.useItem(player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,11 +5,11 @@ architectury {
|
|||
injectInjectables = false
|
||||
}
|
||||
|
||||
loom {
|
||||
mixin {
|
||||
legacyRemapToNamespace = "official"
|
||||
}
|
||||
}
|
||||
//loom {
|
||||
// mixin {
|
||||
// legacyRemapToNamespace = "official"
|
||||
// }
|
||||
//}
|
||||
|
||||
// ignore this jank, it's so I don't have to move the src folder, as that creates unnecessary git conflicts
|
||||
sourceSets {
|
||||
|
|
Loading…
Reference in New Issue