Skip to content

Commit 9223275

Browse files
committed
Add a safety net for mounting with sittable
1 parent e2ce39c commit 9223275

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

  • common/src/main/java/generations/gg/generations/core/generationscore/common/world/entity/block

common/src/main/java/generations/gg/generations/core/generationscore/common/world/entity/block/SittableEntity.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,16 @@ public static InteractionResult mount(Level level, BlockPos pos, double yOffset,
9696
List<SittableEntity> seats = level.getEntitiesOfClass(SittableEntity.class, new AABB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1.0, pos.getY() + 1.0, pos.getZ() + 1.0));
9797
if(seats.isEmpty()) {
9898
SittableEntity seat = new SittableEntity(level, pos, yOffset, direction);
99-
level.addFreshEntity(seat);
100-
player.startRiding(seat);
99+
if(level.addFreshEntity(seat)) {
100+
player.startRiding(seat);
101+
return InteractionResult.SUCCESS;
102+
} else {
103+
return InteractionResult.FAIL;
104+
}
101105
}
102106
}
103-
return InteractionResult.SUCCESS;
107+
108+
return InteractionResult.PASS;
104109
}
105110

106111

0 commit comments

Comments
 (0)