mirror of
https://github.com/Oth3r/Sit.git
synced 2025-09-19 16:03:22 +02:00
sit command try to sit at look target, before falling back to below
This commit is contained in:
parent
f4e7c55bca
commit
3a56b1980d
1 changed files with 14 additions and 10 deletions
|
@ -56,19 +56,23 @@ public class SitCommand {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// player
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("sit")) {
|
if (args[0].equalsIgnoreCase("sit")) {
|
||||||
// todo make the command target the block that the player is looking at, if not looking at a block default to below
|
// if the player can't sit where they're looking, try to sit below
|
||||||
BlockPos pos = player.getBlockPos();
|
if (!Logic.sitLooking(player)) {
|
||||||
|
BlockPos pos = player.getBlockPos();
|
||||||
|
|
||||||
if (!(player.getY() -((int) player.getY()) > 0.00)) {
|
if (!(player.getY() - ((int) player.getY()) > 0.00)) {
|
||||||
pos = pos.add(0,-1,0);
|
pos = pos.add(0, -1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if already sitting, ignore
|
||||||
|
if (FileData.getSitEntity(player) != null) return 1;
|
||||||
|
|
||||||
|
// try to make the player sit
|
||||||
|
Logic.sit(player, pos, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if already sitting, ignore
|
|
||||||
if (FileData.getSitEntity(player) != null) return 1;
|
|
||||||
|
|
||||||
// try to make the player sit
|
|
||||||
Logic.sit(player,pos,null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("reload")) {
|
if (args[0].equalsIgnoreCase("reload")) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue