elytra warning

This commit is contained in:
Leijurv 2023-07-31 01:36:01 -07:00
parent 541b710ea7
commit 64a881f990
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 42 additions and 2 deletions

View File

@ -1431,6 +1431,11 @@ public final class Settings {
*/
public final Setting<Boolean> elytraAllowLandOnNetherFortress = new Setting<>(false);
/**
* Has the user read and understood the elytra terms and conditions
*/
public final Setting<Boolean> elytraTermsAccepted = new Setting<>(false);
/**
* A map of lowercase setting field names to their respective setting
*/

View File

@ -17,6 +17,7 @@
package baritone.command.defaults;
import baritone.Baritone;
import baritone.api.IBaritone;
import baritone.api.command.Command;
import baritone.api.command.argument.IArgConsumer;
@ -26,6 +27,9 @@ import baritone.api.command.helpers.TabCompleteHelper;
import baritone.api.pathing.goals.Goal;
import baritone.api.process.ICustomGoalProcess;
import baritone.api.process.IElytraProcess;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.event.HoverEvent;
import java.util.Arrays;
import java.util.List;
@ -50,6 +54,11 @@ public class ElytraCommand extends Command {
}
if (!args.hasAny()) {
if (!Baritone.settings().elytraTermsAccepted.value && !ctx.player().isElytraFlying()) {
// only gatekeep if they are standing on the ground, don't mess them up in midair lol
gatekeep();
return;
}
Goal iGoal = customGoalProcess.mostRecentGoal();
if (iGoal == null) {
throw new CommandInvalidStateException("No goal has been set");
@ -83,6 +92,32 @@ public class ElytraCommand extends Command {
}
}
private void gatekeep() {
TextComponentString gatekeep = new TextComponentString("");
gatekeep.appendText("Once you've read the below, and entered the seed, run ");
TextComponentString cmd = new TextComponentString(Baritone.settings().prefix.value + "set elytraTermsAccepted true");
cmd.getStyle().setColor(TextFormatting.GRAY);
gatekeep.appendSibling(cmd);
gatekeep.appendText(" and then try again.\n");
gatekeep.appendText("Baritone Elytra is an experimental feature. It is only intended for long distance travel in the Nether using fireworks for vanilla boost. It will not work with any other mods (\"hacks\") for non-vanilla boost. ");
TextComponentString gatekeep2 = new TextComponentString("If you want Baritone to attempt to take off from the ground for you, you can enable the elytraAutoJump setting. This may not be advisable on laggy servers. ");
gatekeep2.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentString(Baritone.settings().prefix.value + "set elytraAutoJump true")));
gatekeep.appendSibling(gatekeep2);
TextComponentString gatekeep3 = new TextComponentString("If you want Baritone to go slower and use less fireworks, enable the elytraConserveFireworks setting and/or decrease the elytraFireworkSpeed setting. ");
gatekeep3.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentString(Baritone.settings().prefix.value + "set elytraConserveFireworks true\n" + Baritone.settings().prefix.value + "set elytraFireworkSpeed 0.6\n(the 0.6 number is just an example, tweak to your liking)")));
gatekeep.appendSibling(gatekeep3);
TextComponentString gatekeep4 = new TextComponentString("Baritone Elytra ");
TextComponentString red = new TextComponentString("needs to know the seed");
red.getStyle().setColor(TextFormatting.RED).setUnderlined(true).setBold(true);
gatekeep4.appendSibling(red);
gatekeep4.appendText(" of the world you are in. If it doesn't have the correct seed, it will constantly frustratingly recalculate and backtrack. It uses the seed to generate terrain far beyond what you can see, since terrain obstacles in the Nether can be much larger than your render distance. ");
gatekeep.appendSibling(gatekeep4);
TextComponentString gatekeep5 = new TextComponentString("If you're on 2b2t, no need to change anything, since its seed is the default. Otherwise, set it with: " + Baritone.settings().prefix.value + "set elytraNetherSeed seedgoeshere");
gatekeep5.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentString("2b2t's nether seed is 146008555100680, so for example you would run\n" + Baritone.settings().prefix.value + "set elytraNetherSeed 146008555100680\n\nAlso, if you're on 2b2t, note that the Nether near spawn is old terrain gen, so you'll see recalculating and backtracking there.\nIt'll only work well further away from spawn/highways.")));
gatekeep.appendSibling(gatekeep5);
logDirect(gatekeep);
}
@Override
public Stream<String> tabComplete(String label, IArgConsumer args) throws CommandException {
TabCompleteHelper helper = new TabCompleteHelper();
@ -114,8 +149,8 @@ public class ElytraCommand extends Command {
final String osArch = System.getProperty("os.arch");
final String osName = System.getProperty("os.name");
return String.format(
"Legacy architectures are not supported. your CPU is %s and your operating system is %s. " +
"Supported architectures are 64 bit x86, and 64 bit arm, supported operating systems are Windows, " +
"Legacy architectures are not supported. Your CPU is %s and your operating system is %s. " +
"Supported architectures are 64 bit x86, and 64 bit ARM. Supported operating systems are Windows, " +
"Linux, and Mac",
osArch, osName
);