Skip to content

Commit

Permalink
Fixed lerping again, also fixed contraptions being dragged hopefully
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePlasticPotato committed Dec 28, 2024
1 parent 77bee91 commit d8e609b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class MixinServerEntity {
)
private void wrapBroadcastAccept(Consumer instance, Object t, Operation<Void> original) {
if (t instanceof ClientboundSetEntityMotionPacket || t instanceof ClientboundTeleportEntityPacket || t instanceof ClientboundMoveEntityPacket || t instanceof ClientboundRotateHeadPacket) {
if (entity instanceof IEntityDraggingInformationProvider draggedEntity) {
if (entity instanceof IEntityDraggingInformationProvider draggedEntity && draggedEntity.vs$shouldDrag()) {
EntityDraggingInformation dragInfo = draggedEntity.getDraggingInformation();

if (dragInfo != null && dragInfo.isEntityBeingDraggedByAShip() && dragInfo.getLastShipStoodOn() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class EntityDraggingInformation {
var lastShipStoodOn: ShipId? = null
set(value) {
ticksSinceStoodOnShip = 0
changedShipLastTick = field != value && field != null
changedShipLastTick = field != value && field != null && value != null
field = value
}
var ticksSinceStoodOnShip: Int = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,17 @@ object EntityLerper {
val ship = refship as ClientShip
if (dragInfo.lerpSteps > 0) {
if (dragInfo.changedShipLastTick) {
dragInfo.lerpSteps = 1
dragInfo.lerpSteps = 0
dragInfo.changedShipLastTick = false
val transformed = if (dragInfo.lerpPositionOnShip != null) {
ship.transform.shipToWorld.transformPosition(dragInfo.lerpPositionOnShip, Vector3d())
} else entity.position().toJOML()
val transformedYaw = if (dragInfo.lerpYawOnShip != null) {
yawToWorld(ship, dragInfo.lerpYawOnShip!!)
} else entity.yRot.toDouble()
entity.setPos(transformed.x, transformed.y, transformed.z)
entity.yRot = transformedYaw.toFloat()
return
}
val currentX: Double = dragInfo.relativePositionOnShip?.x() ?: return
val currentY: Double = dragInfo.relativePositionOnShip!!.y()
Expand Down

0 comments on commit d8e609b

Please sign in to comment.