mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-25 14:36:29 +01:00
Implement #5666 on main branch
This commit is contained in:
parent
2cf7d171df
commit
bc340c7d3e
2 changed files with 7 additions and 0 deletions
|
@ -217,6 +217,9 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
}
|
||||
|
||||
public Vec3 getPassengerPosition(Entity passenger, float partialTicks) {
|
||||
if (contraption == null)
|
||||
return null;
|
||||
|
||||
UUID id = passenger.getUUID();
|
||||
if (passenger instanceof OrientedContraptionEntity) {
|
||||
BlockPos localPos = contraption.getBearingPosOf(id);
|
||||
|
@ -231,6 +234,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
BlockPos seat = contraption.getSeatOf(id);
|
||||
if (seat == null)
|
||||
return null;
|
||||
|
||||
Vec3 transformedVector = toGlobalVector(Vec3.atLowerCornerOf(seat)
|
||||
.add(.5, passenger.getMyRidingOffset() + ySize - .15f, .5), partialTicks)
|
||||
.add(VecHelper.getCenterOf(BlockPos.ZERO))
|
||||
|
|
|
@ -569,6 +569,9 @@ public class OrientedContraptionEntity extends AbstractContraptionEntity {
|
|||
private Vec3 getContraptionOffset(float partialTicks, Entity ridingEntity) {
|
||||
AbstractContraptionEntity parent = (AbstractContraptionEntity) ridingEntity;
|
||||
Vec3 passengerPosition = parent.getPassengerPosition(this, partialTicks);
|
||||
if (passengerPosition == null)
|
||||
return Vec3.ZERO;
|
||||
|
||||
double x = passengerPosition.x - Mth.lerp(partialTicks, this.xOld, this.getX());
|
||||
double y = passengerPosition.y - Mth.lerp(partialTicks, this.yOld, this.getY());
|
||||
double z = passengerPosition.z - Mth.lerp(partialTicks, this.zOld, this.getZ());
|
||||
|
|
Loading…
Reference in a new issue