Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,7 @@ public void detachModel(GenericModel model) {
public void setGlobalRotation(double yaw, double pitch) {
if (this.stand != null) {
var correctYaw = (180 + yaw + 360) % 360;
var correctPitch = (pitch + 360) % 360;
this.stand.setView((float) correctYaw, (float) correctPitch);
this.stand.setView((float) correctYaw, (float) pitch);
}
}

Expand All @@ -191,14 +190,14 @@ public void destroy() {

@Override
public Pos calculatePosition() {
return new Pos(model.getPosition()).withView(0, 0);
return model.getPosition().withView(0, 0);
}

private Pos calculatePositionInternal() {
if (this.offset == null) return Pos.ZERO;
Point p = this.offset;
p = applyTransform(p);
return new Pos(p).div(4).mul(scale).withView(0, 0);
return p.asPos().div(4).mul(scale).withView(0, 0);
}

@Override
Expand All @@ -217,7 +216,7 @@ public void teleport(Point position) {
// Model roots move every tick. A teleport emits an absolute position sync, which makes
// passenger displays visibly snap between server ticks. Let Minestom choose relative
// movement packets instead so the vanilla client's entity interpolation can do its job.
if (this.baseStand != null) this.baseStand.refreshPosition(new Pos(position), true);
if (this.baseStand != null) this.baseStand.refreshPosition(position.asPos(), true);
}

public void draw() {
Expand Down Expand Up @@ -261,7 +260,7 @@ public void draw() {
@Override
public CompletableFuture<Void> spawn(Instance instance, Pos position) {
var correctLocation = (180 + this.model.getGlobalRotation() + 360) % 360;
return super.spawn(instance, new Pos(position).withYaw((float) correctLocation)).whenCompleteAsync((_, e) -> {
return super.spawn(instance, position.withYaw((float) correctLocation)).whenCompleteAsync((_, e) -> {
if (e != null) {
e.printStackTrace();
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public Pos calculatePosition() {
p = applyTransform(p);
p = calculateGlobalRotation(p);

return Pos.fromPoint(p).div(4).mul(scale);
return p.asPos().div(4).mul(scale);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public Pos calculatePosition() {
p = applyTransform(p);
p = calculateGlobalRotation(p);

return new Pos(p)
return p.asPos()
.div(4, 4, 4).mul(scale)
.add(model.getPosition())
.add(model.getGlobalOffset());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public Pos calculatePosition() {

var p = applyTransform(this.offset);
p = calculateGlobalRotation(p);
Pos endPos = new Pos(p);
Pos endPos = p.asPos();

return endPos
.div(4, 4, 4).mul(scale)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public Pos calculatePosition() {
p = applyTransform(p);
p = calculateGlobalRotation(p);

Pos endPos = Pos.fromPoint(p);
Pos endPos = p.asPos();

return endPos
.div(4, 4, 4).mul(scale)
Expand Down