notify users that their death position has been saved.
Signed-off-by: scorbett123 <sam@corbettchocolates.com>
This commit is contained in:
parent
320a5d64a3
commit
60f81fb89d
@ -25,6 +25,7 @@ import baritone.api.event.events.PlayerUpdateEvent;
|
|||||||
import baritone.api.event.events.TickEvent;
|
import baritone.api.event.events.TickEvent;
|
||||||
import baritone.api.event.events.type.EventState;
|
import baritone.api.event.events.type.EventState;
|
||||||
import baritone.api.utils.BetterBlockPos;
|
import baritone.api.utils.BetterBlockPos;
|
||||||
|
import baritone.api.utils.Helper;
|
||||||
import baritone.cache.ContainerMemory;
|
import baritone.cache.ContainerMemory;
|
||||||
import baritone.utils.BlockStateInterface;
|
import baritone.utils.BlockStateInterface;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@ -40,13 +41,20 @@ import net.minecraft.tileentity.TileEntity;
|
|||||||
import net.minecraft.tileentity.TileEntityLockable;
|
import net.minecraft.tileentity.TileEntityLockable;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
import net.minecraft.util.text.TextComponentString;
|
||||||
import net.minecraft.util.text.TextComponentTranslation;
|
import net.minecraft.util.text.TextComponentTranslation;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
import net.minecraft.util.text.event.ClickEvent;
|
||||||
|
import net.minecraft.util.text.event.HoverEvent;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static baritone.api.command.IBaritoneChatControl.FORCE_COMMAND_PREFIX;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* doesn't work for horse inventories :^)
|
* doesn't work for horse inventories :^)
|
||||||
*
|
*
|
||||||
@ -166,7 +174,26 @@ public final class MemoryBehavior extends Behavior {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlayerDeath() {
|
public void onPlayerDeath() {
|
||||||
|
Waypoint deathWaypoint = new Waypoint("death", Waypoint.Tag.DEATH, ctx.playerFeet());
|
||||||
baritone.getWorldProvider().getCurrentWorld().getWaypoints().addWaypoint(new Waypoint("death", Waypoint.Tag.DEATH, ctx.playerFeet()));
|
baritone.getWorldProvider().getCurrentWorld().getWaypoints().addWaypoint(new Waypoint("death", Waypoint.Tag.DEATH, ctx.playerFeet()));
|
||||||
|
ITextComponent component = new TextComponentString("Death position saved.");
|
||||||
|
component.getStyle()
|
||||||
|
.setColor(TextFormatting.WHITE)
|
||||||
|
.setHoverEvent(new HoverEvent(
|
||||||
|
HoverEvent.Action.SHOW_TEXT,
|
||||||
|
new TextComponentString("Click to goto death")
|
||||||
|
))
|
||||||
|
.setClickEvent(new ClickEvent(
|
||||||
|
ClickEvent.Action.RUN_COMMAND,
|
||||||
|
String.format(
|
||||||
|
"%s%s goto %s @ %d",
|
||||||
|
FORCE_COMMAND_PREFIX,
|
||||||
|
"wp",
|
||||||
|
deathWaypoint.getTag().getName(),
|
||||||
|
deathWaypoint.getCreationTimestamp()
|
||||||
|
)
|
||||||
|
));
|
||||||
|
Helper.HELPER.logDirect(component);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user