Merge pull request #6592 from Layers-of-Railways/mc1.18/stabilized_contraption_fixes

Fix Stabilized contraption offset and incorrect rotation
This commit is contained in:
simibubi 2024-07-15 17:01:45 +02:00 committed by GitHub
commit 3c9c668b56
Failed to generate hash of commit
3 changed files with 14 additions and 6 deletions

View file

@ -212,8 +212,12 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
Vec3 transformedVector = getPassengerPosition(passenger, 1);
if (transformedVector == null)
return;
float offset = -1 / 8f;
if (passenger instanceof AbstractContraptionEntity)
offset = 0.0f;
callback.accept(passenger, transformedVector.x,
transformedVector.y + SeatEntity.getCustomEntitySeatOffset(passenger) - 1 / 8f, transformedVector.z);
transformedVector.y + SeatEntity.getCustomEntitySeatOffset(passenger) + offset, transformedVector.z);
}
public Vec3 getPassengerPosition(Entity passenger, float partialTicks) {

View file

@ -1,6 +1,7 @@
package com.simibubi.create.content.contraptions;
import static com.simibubi.create.foundation.utility.AngleHelper.angleLerp;
import static com.simibubi.create.foundation.utility.AngleHelper.wrapAngle180;
import java.util.Optional;
import java.util.UUID;
@ -353,7 +354,7 @@ public class OrientedContraptionEntity extends AbstractContraptionEntity {
return false;
OrientedContraptionEntity parent = (OrientedContraptionEntity) riding;
prevYaw = yaw;
yaw = -parent.getViewYRot(1);
yaw = wrapAngle180(getInitialYaw() - parent.getInitialYaw()) - parent.getViewYRot(1);
return false;
}

View file

@ -49,4 +49,7 @@ public class AngleHelper {
return diff;
}
public static float wrapAngle180(float angle) {
return (angle + 180) % 360 - 180;
}
}