Fabric EntitySleepEvents issues
LambdAurora opened this issue ยท 0 comments
Had the very bad surprise of those events breaking my sleeping bags in Aurora's Decorations.
The reason being that Vanilla detects the sleeping direction with the code Direction direction = this.world.getBlockState(pos).get(HorizontalFacingBlock.FACING);
But FAPI hardcodes the check to BedBlock: Direction initial = state.getBlock() instanceof BedBlock ? (Direction) state.get(property) : null;
FAPI should check if the state contains HorizontalFacingBlock.FACING
and use it if available instead.
Another nitpick is the injection of ALLOW_BED
, it injects at RETURN in:
private boolean isSleepingInBed() {
return this.getSleepingPosition().map(pos -> this.world.getBlockState(pos).getBlock() instanceof BedBlock).orElse(false);
}
and calls back getSleepingPosition
, which is not the greatest thing imo, the injection could be in the lambda instead, still at return. The lambda intermediary is method_18405
.