[Change] Updated Mappings + Simplified Port

This commit is contained in:
CDAGaming 2020-07-19 16:47:30 -05:00
parent 819178b280
commit 807b1b5eb0
No known key found for this signature in database
GPG Key ID: 0304C9C2F35557FB
16 changed files with 57 additions and 62 deletions

View File

@ -85,7 +85,7 @@ task sourceJar(type: Jar, dependsOn: classes) {
}
minecraft {
mappings channel: 'snapshot', version: '20200514-1.16'
mappings channel: 'snapshot', version: '20200707-1.16.1'
if (getProject().hasProperty("baritone.forge_build")) {
reobfMappings 'searge'

View File

@ -78,33 +78,33 @@ public class Paginator<E> implements Helper {
TextComponent prevPageComponent = new StringTextComponent("<<");
if (hasPrevPage) {
prevPageComponent.func_230530_a_(prevPageComponent.getStyle()
.func_240715_a_(new ClickEvent(
.setClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
String.format("%s %d", commandPrefix, page - 1)
))
.func_240716_a_(new HoverEvent(
HoverEvent.Action.field_230550_a_,
.setHoverEvent(new HoverEvent(
HoverEvent.Action.SHOW_TEXT,
new StringTextComponent("Click to view previous page")
)));
} else {
prevPageComponent.func_230530_a_(prevPageComponent.getStyle().func_240712_a_(TextFormatting.DARK_GRAY));
prevPageComponent.func_230530_a_(prevPageComponent.getStyle().setFormatting(TextFormatting.DARK_GRAY));
}
TextComponent nextPageComponent = new StringTextComponent(">>");
if (hasNextPage) {
nextPageComponent.func_230530_a_(nextPageComponent.getStyle()
.func_240715_a_(new ClickEvent(
.setClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
String.format("%s %d", commandPrefix, page + 1)
))
.func_240716_a_(new HoverEvent(
HoverEvent.Action.field_230550_a_,
.setHoverEvent(new HoverEvent(
HoverEvent.Action.SHOW_TEXT,
new StringTextComponent("Click to view next page")
)));
} else {
nextPageComponent.func_230530_a_(nextPageComponent.getStyle().func_240712_a_(TextFormatting.DARK_GRAY));
nextPageComponent.func_230530_a_(nextPageComponent.getStyle().setFormatting(TextFormatting.DARK_GRAY));
}
TextComponent pagerComponent = new StringTextComponent("");
pagerComponent.func_230530_a_(pagerComponent.getStyle().func_240712_a_(TextFormatting.GRAY));
pagerComponent.func_230530_a_(pagerComponent.getStyle().setFormatting(TextFormatting.GRAY));
pagerComponent.func_230529_a_(prevPageComponent); // appendSibling
pagerComponent.func_240702_b_(" | "); // appendText
pagerComponent.func_230529_a_(nextPageComponent);

View File

@ -52,11 +52,11 @@ public interface Helper {
final Calendar now = Calendar.getInstance();
final boolean xd = now.get(Calendar.MONTH) == Calendar.APRIL && now.get(Calendar.DAY_OF_MONTH) <= 3;
TextComponent baritone = new StringTextComponent(xd ? "Baritoe" : BaritoneAPI.getSettings().shortBaritonePrefix.value ? "B" : "Baritone");
baritone.func_230530_a_(baritone.getStyle().func_240712_a_(TextFormatting.LIGHT_PURPLE));
baritone.func_230530_a_(baritone.getStyle().setFormatting(TextFormatting.LIGHT_PURPLE));
// Outer brackets
TextComponent prefix = new StringTextComponent("");
prefix.func_230530_a_(baritone.getStyle().func_240712_a_(TextFormatting.DARK_PURPLE));
prefix.func_230530_a_(baritone.getStyle().setFormatting(TextFormatting.DARK_PURPLE));
prefix.func_240702_b_("[");
prefix.func_230529_a_(baritone);
prefix.func_240702_b_("]");
@ -101,7 +101,7 @@ public interface Helper {
default void logDirect(String message, TextFormatting color) {
Stream.of(message.split("\n")).forEach(line -> {
TextComponent component = new StringTextComponent(line.replace("\t", " "));
component.func_230530_a_(component.getStyle().func_240712_a_(color));
component.func_230530_a_(component.getStyle().setFormatting(color));
logDirect(component);
});
}

View File

@ -24,7 +24,6 @@ import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.Entity;
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 java.util.Optional;

View File

@ -133,12 +133,12 @@ public class MixinMinecraft {
at = @At(
value = "FIELD",
opcode = Opcodes.GETFIELD,
target = "net/minecraft/client/gui/screen/Screen.field_230711_n_:Z"
target = "net/minecraft/client/gui/screen/Screen.passEvents:Z"
)
)
private boolean passEvents(Screen screen) {
// allow user input is only the primary baritone
return (BaritoneAPI.getProvider().getPrimaryBaritone().getPathingBehavior().isPathing() && player != null) || screen.field_230711_n_;
return (BaritoneAPI.getProvider().getPrimaryBaritone().getPathingBehavior().isPathing() && player != null) || screen.passEvents;
}
// TODO

View File

@ -28,6 +28,6 @@ import java.net.URI;
public abstract class MixinScreen implements IGuiScreen {
@Override
@Invoker("func_231156_a_")
@Invoker("openLink")
public abstract void openLinkInvoker(URI url);
}

View File

@ -53,6 +53,8 @@ public class WorldProvider implements IWorldProvider, Helper {
/**
* Called when a new world is initialized to discover the
*
* @param world The world's Registry Data
*/
public final void initWorld(RegistryKey<World> world) {
File directory;

View File

@ -35,7 +35,6 @@ import baritone.api.command.manager.ICommandManager;
import baritone.command.argument.CommandArguments;
import baritone.command.manager.CommandManager;
import net.minecraft.util.Tuple;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextComponent;
import net.minecraft.util.text.TextFormatting;
@ -82,12 +81,12 @@ public class BaritoneChatControl implements Helper, AbstractGameEventListener {
String toDisplay = settings.censorRanCommands.value ? command + " ..." : msg;
TextComponent component = new StringTextComponent(String.format("> %s", toDisplay));
component.func_230530_a_(component.getStyle()
.func_240712_a_(TextFormatting.WHITE)
.func_240716_a_(new HoverEvent(
HoverEvent.Action.field_230550_a_,
.setFormatting(TextFormatting.WHITE)
.setHoverEvent(new HoverEvent(
HoverEvent.Action.SHOW_TEXT,
new StringTextComponent("Click to rerun command")
))
.func_240715_a_(new ClickEvent(
.setClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
FORCE_COMMAND_PREFIX + msg
)));

View File

@ -27,8 +27,6 @@ import baritone.api.command.argument.IArgConsumer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.IFormattableTextComponent;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponent;
import java.util.Arrays;
import java.util.List;

View File

@ -24,7 +24,6 @@ import baritone.api.command.exception.CommandException;
import baritone.api.command.exception.CommandInvalidStateException;
import baritone.api.command.argument.IArgConsumer;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.BlockPos;
import java.util.Arrays;
import java.util.List;

View File

@ -59,21 +59,21 @@ public class HelpCommand extends Command {
String names = String.join("/", command.getNames());
String name = command.getNames().get(0);
TextComponent shortDescComponent = new StringTextComponent(" - " + command.getShortDesc());
shortDescComponent.func_230530_a_(shortDescComponent.getStyle().func_240712_a_(TextFormatting.DARK_GRAY));
shortDescComponent.func_230530_a_(shortDescComponent.getStyle().setFormatting(TextFormatting.DARK_GRAY));
TextComponent namesComponent = new StringTextComponent(names);
namesComponent.func_230530_a_(namesComponent.getStyle().func_240712_a_(TextFormatting.WHITE));
namesComponent.func_230530_a_(namesComponent.getStyle().setFormatting(TextFormatting.WHITE));
TextComponent hoverComponent = new StringTextComponent("");
hoverComponent.func_230530_a_(hoverComponent.getStyle().func_240712_a_(TextFormatting.GRAY));
hoverComponent.func_230530_a_(hoverComponent.getStyle().setFormatting(TextFormatting.GRAY));
hoverComponent.func_230529_a_(namesComponent);
hoverComponent.func_240702_b_("\n" + command.getShortDesc());
hoverComponent.func_240702_b_("\n\nClick to view full help");
String clickCommand = FORCE_COMMAND_PREFIX + String.format("%s %s", label, command.getNames().get(0));
TextComponent component = new StringTextComponent(name);
component.func_230530_a_(component.getStyle().func_240712_a_(TextFormatting.GRAY));
component.func_230530_a_(component.getStyle().setFormatting(TextFormatting.GRAY));
component.func_230529_a_(shortDescComponent);
component.func_230530_a_(component.getStyle()
.func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, hoverComponent))
.func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, clickCommand)));
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverComponent))
.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, clickCommand)));
return component;
},
FORCE_COMMAND_PREFIX + label
@ -89,7 +89,7 @@ public class HelpCommand extends Command {
command.getLongDesc().forEach(this::logDirect);
logDirect("");
TextComponent returnComponent = new StringTextComponent("Click to return to the help menu");
returnComponent.func_230530_a_(returnComponent.getStyle().func_240715_a_(new ClickEvent(
returnComponent.func_230530_a_(returnComponent.getStyle().setClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
FORCE_COMMAND_PREFIX + label
)));

View File

@ -27,7 +27,6 @@ import baritone.api.command.exception.CommandInvalidTypeException;
import baritone.api.command.argument.IArgConsumer;
import baritone.api.command.helpers.Paginator;
import baritone.api.command.helpers.TabCompleteHelper;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextComponent;
import net.minecraft.util.text.TextFormatting;
@ -83,19 +82,19 @@ public class SetCommand extends Command {
" (%s)",
settingTypeToString(setting)
));
typeComponent.func_230530_a_(typeComponent.getStyle().func_240712_a_(TextFormatting.DARK_GRAY));
typeComponent.func_230530_a_(typeComponent.getStyle().setFormatting(TextFormatting.DARK_GRAY));
TextComponent hoverComponent = new StringTextComponent("");
hoverComponent.func_230530_a_(hoverComponent.getStyle().func_240712_a_(TextFormatting.GRAY));
hoverComponent.func_230530_a_(hoverComponent.getStyle().setFormatting(TextFormatting.GRAY));
hoverComponent.func_240702_b_(setting.getName());
hoverComponent.func_240702_b_(String.format("\nType: %s", settingTypeToString(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());
TextComponent component = new StringTextComponent(setting.getName());
component.func_230530_a_(component.getStyle().func_240712_a_(TextFormatting.GRAY));
component.func_230530_a_(component.getStyle().setFormatting(TextFormatting.GRAY));
component.func_230529_a_(typeComponent);
component.func_230530_a_(component.getStyle()
.func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, hoverComponent))
.func_240715_a_(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, commandSuggestion)));
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverComponent))
.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, commandSuggestion)));
return component;
},
FORCE_COMMAND_PREFIX + "set " + arg + " " + search
@ -166,12 +165,12 @@ public class SetCommand extends Command {
}
TextComponent oldValueComponent = new StringTextComponent(String.format("Old value: %s", oldValue));
oldValueComponent.func_230530_a_(oldValueComponent.getStyle()
.func_240712_a_(TextFormatting.GRAY)
.func_240716_a_(new HoverEvent(
HoverEvent.Action.field_230550_a_,
.setFormatting(TextFormatting.GRAY)
.setHoverEvent(new HoverEvent(
HoverEvent.Action.SHOW_TEXT,
new StringTextComponent("Click to set the setting back to this value")
))
.func_240715_a_(new ClickEvent(
.setClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
FORCE_COMMAND_PREFIX + String.format("set %s %s", setting.getName(), oldValue)
)));

View File

@ -61,21 +61,21 @@ public class WaypointsCommand extends Command {
BiFunction<IWaypoint, Action, ITextComponent> toComponent = (waypoint, _action) -> {
TextComponent component = new StringTextComponent("");
TextComponent tagComponent = new StringTextComponent(waypoint.getTag().name() + " ");
tagComponent.func_230530_a_(tagComponent.getStyle().func_240712_a_(TextFormatting.GRAY));
tagComponent.func_230530_a_(tagComponent.getStyle().setFormatting(TextFormatting.GRAY));
String name = waypoint.getName();
TextComponent nameComponent = new StringTextComponent(!name.isEmpty() ? name : "<empty>");
nameComponent.func_230530_a_(nameComponent.getStyle().func_240712_a_(!name.isEmpty() ? TextFormatting.GRAY : TextFormatting.DARK_GRAY));
nameComponent.func_230530_a_(nameComponent.getStyle().setFormatting(!name.isEmpty() ? TextFormatting.GRAY : TextFormatting.DARK_GRAY));
TextComponent timestamp = new StringTextComponent(" @ " + new Date(waypoint.getCreationTimestamp()));
timestamp.func_230530_a_(timestamp.getStyle().func_240712_a_(TextFormatting.DARK_GRAY));
timestamp.func_230530_a_(timestamp.getStyle().setFormatting(TextFormatting.DARK_GRAY));
component.func_230529_a_(tagComponent);
component.func_230529_a_(nameComponent);
component.func_230529_a_(timestamp);
component.func_230530_a_(component.getStyle()
.func_240716_a_(new HoverEvent(
HoverEvent.Action.field_230550_a_,
.setHoverEvent(new HoverEvent(
HoverEvent.Action.SHOW_TEXT,
new StringTextComponent("Click to select")
))
.func_240715_a_(new ClickEvent(
.setClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
String.format(
"%s%s %s %s @ %d",
@ -138,7 +138,7 @@ public class WaypointsCommand extends Command {
IWaypoint waypoint = new Waypoint(name, tag, pos);
ForWaypoints.waypoints(this.baritone).addWaypoint(waypoint);
TextComponent component = new StringTextComponent("Waypoint added: ");
component.func_230530_a_(component.getStyle().func_240712_a_(TextFormatting.GRAY));
component.func_230530_a_(component.getStyle().setFormatting(TextFormatting.GRAY));
component.func_230529_a_(toComponent.apply(waypoint, Action.INFO));
logDirect(component);
} else if (action == Action.CLEAR) {
@ -196,7 +196,7 @@ public class WaypointsCommand extends Command {
logDirect(transform.apply(waypoint));
logDirect(String.format("Position: %s", waypoint.getLocation()));
TextComponent deleteComponent = new StringTextComponent("Click to delete this waypoint");
deleteComponent.func_230530_a_(deleteComponent.getStyle().func_240715_a_(new ClickEvent(
deleteComponent.func_230530_a_(deleteComponent.getStyle().setClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
String.format(
"%s%s delete %s @ %d",
@ -207,7 +207,7 @@ public class WaypointsCommand extends Command {
)
)));
TextComponent goalComponent = new StringTextComponent("Click to set goal to this waypoint");
goalComponent.func_230530_a_(goalComponent.getStyle().func_240715_a_(new ClickEvent(
goalComponent.func_230530_a_(goalComponent.getStyle().setClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
String.format(
"%s%s goal %s @ %d",
@ -218,7 +218,7 @@ public class WaypointsCommand extends Command {
)
)));
TextComponent backComponent = new StringTextComponent("Click to return to the waypoints list");
backComponent.func_230530_a_(backComponent.getStyle().func_240715_a_(new ClickEvent(
backComponent.func_230530_a_(backComponent.getStyle().setClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
String.format(
"%s%s list",

View File

@ -58,7 +58,6 @@ import net.minecraft.util.Tuple;
import net.minecraft.util.math.*;
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;

View File

@ -55,12 +55,12 @@ public class GuiClick extends Screen implements Helper {
}
@Override
public boolean func_231177_au__() {
public boolean isPauseScreen() {
return false;
}
@Override
public void func_230430_a_(MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
public void render(MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
double mx = mc.mouseHelper.getMouseX();
double my = mc.mouseHelper.getMouseY();
@ -82,15 +82,15 @@ public class GuiClick extends Screen implements Helper {
}
@Override
public boolean func_231048_c_(double mouseX, double mouseY, int mouseButton) {
public boolean mouseReleased(double mouseX, double mouseY, int mouseButton) {
if (mouseButton == 0) {
if (clickStart != null && !clickStart.equals(currentMouseOver)) {
BaritoneAPI.getProvider().getPrimaryBaritone().getSelectionManager().removeAllSelections();
BaritoneAPI.getProvider().getPrimaryBaritone().getSelectionManager().addSelection(BetterBlockPos.from(clickStart), BetterBlockPos.from(currentMouseOver));
TextComponent component = new StringTextComponent("Selection made! For usage: " + Baritone.settings().prefix.value + "help sel");
component.func_230530_a_(component.getStyle()
.func_240712_a_(TextFormatting.WHITE)
.func_240715_a_(new ClickEvent(
.setFormatting(TextFormatting.WHITE)
.setClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
FORCE_COMMAND_PREFIX + "help sel"
)));
@ -103,13 +103,13 @@ public class GuiClick extends Screen implements Helper {
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalBlock(currentMouseOver.up()));
}
clickStart = null;
return super.func_231048_c_(mouseX, mouseY, mouseButton);
return super.mouseReleased(mouseX, mouseY, mouseButton);
}
@Override
public boolean func_231044_a_(double mouseX, double mouseY, int mouseButton) {
public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) {
clickStart = currentMouseOver;
return super.func_231044_a_(mouseX, mouseY, mouseButton);
return super.mouseClicked(mouseX, mouseY, mouseButton);
}
public void onRender(MatrixStack modelViewStack, Matrix4f projectionMatrix) {

View File

@ -161,7 +161,7 @@ public class ToolSet {
}
speed /= hardness;
if (!state.func_235783_q_() || (!item.isEmpty() && item.canHarvestBlock(state))) {
if (!state.getRequiresTool() || (!item.isEmpty() && item.canHarvestBlock(state))) {
return speed / 30;
} else {
return speed / 100;