mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-28 19:39:11 +00:00
修复座椅行为玩家朝向不正常
This commit is contained in:
@@ -59,11 +59,23 @@ public class SeatBlockEntity extends BlockEntity implements SeatOwner {
|
||||
}
|
||||
for (Seat<SeatBlockEntity> seat : this.seats) {
|
||||
if (!seat.isOccupied()) {
|
||||
if (seat.spawnSeat(player, new WorldPosition(super.world.world(), super.pos.x() + 0.5, super.pos.y(), super.pos.z() + 0.5, 0, 180 - yRot))) {
|
||||
if (seat.spawnSeat(player, new WorldPosition(super.world.world(), super.pos.x() + 0.5, super.pos.y(), super.pos.z() + 0.5, 180 - yRot, getYRot()))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private float getYRot() {
|
||||
Property<?> facing = super.blockState.owner().value().getProperty("facing");
|
||||
if (facing == null || facing.valueClass() != HorizontalDirection.class) return 0;
|
||||
HorizontalDirection direction = (HorizontalDirection) super.blockState.get(facing);
|
||||
return switch (direction) {
|
||||
case NORTH -> 0;
|
||||
case SOUTH -> 180;
|
||||
case WEST -> 270;
|
||||
case EAST -> 90;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class BukkitSeatManager implements SeatManager {
|
||||
public class BukkitSeatManager implements SeatManager, Listener {
|
||||
private static BukkitSeatManager instance;
|
||||
public static final NamespacedKey SEAT_KEY = KeyUtils.toNamespacedKey(SeatManager.SEAT_KEY);
|
||||
public static final NamespacedKey SEAT_EXTRA_DATA_KEY = KeyUtils.toNamespacedKey(SeatManager.SEAT_EXTRA_DATA_KEY);
|
||||
|
||||
Reference in New Issue
Block a user