Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-27 00:23:03 +01:00
Fix entities stacking on top of each other when mounted (#660)
The offset was being called but not properly saved to a variable. The check will also not apply if there is only one mounted entity.
Dieser Commit ist enthalten in:
Ursprung
a929c411d2
Commit
14fcd77925
@ -82,7 +82,7 @@ public class JavaEntitySetPassengersTranslator extends PacketTranslator<ServerEn
|
|||||||
}
|
}
|
||||||
|
|
||||||
passenger.updateBedrockMetadata(session);
|
passenger.updateBedrockMetadata(session);
|
||||||
this.updateOffset(passenger, entity.getEntityType(), session, rider, true);
|
this.updateOffset(passenger, entity.getEntityType(), session, rider, true, (passengers.size() > 1));
|
||||||
rider = false;
|
rider = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ public class JavaEntitySetPassengersTranslator extends PacketTranslator<ServerEn
|
|||||||
session.sendUpstreamPacket(linkPacket);
|
session.sendUpstreamPacket(linkPacket);
|
||||||
passengers.remove(passenger.getEntityId());
|
passengers.remove(passenger.getEntityId());
|
||||||
|
|
||||||
this.updateOffset(passenger, entity.getEntityType(), session, false, false);
|
this.updateOffset(passenger, entity.getEntityType(), session, false, false, (passengers.size() > 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,8 +111,8 @@ public class JavaEntitySetPassengersTranslator extends PacketTranslator<ServerEn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateOffset(Entity passenger, EntityType mountType, GeyserSession session, boolean rider, boolean riding) {
|
private void updateOffset(Entity passenger, EntityType mountType, GeyserSession session, boolean rider, boolean riding, boolean moreThanOneEntity) {
|
||||||
// Without these, Bedrock players will find themselves in the floor when mounting
|
// Without the Y offset, Bedrock players will find themselves in the floor when mounting
|
||||||
float yOffset = 0;
|
float yOffset = 0;
|
||||||
switch (mountType) {
|
switch (mountType) {
|
||||||
case BOAT:
|
case BOAT:
|
||||||
@ -142,10 +142,11 @@ public class JavaEntitySetPassengersTranslator extends PacketTranslator<ServerEn
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Vector3f offset = Vector3f.from(0f, yOffset, 0f);
|
Vector3f offset = Vector3f.from(0f, yOffset, 0f);
|
||||||
if (rider) {
|
// Without the X offset, more than one entity on a boat is stacked on top of each other
|
||||||
offset.add(Vector3f.from(0.2, 0, 0));
|
if (rider && moreThanOneEntity) {
|
||||||
} else {
|
offset = offset.add(Vector3f.from(0.2, 0, 0));
|
||||||
offset.add(Vector3f.from(-0.6, 0, 0));
|
} else if (moreThanOneEntity) {
|
||||||
|
offset = offset.add(Vector3f.from(-0.6, 0, 0));
|
||||||
}
|
}
|
||||||
passenger.getMetadata().getFlags().setFlag(EntityFlag.RIDING, riding);
|
passenger.getMetadata().getFlags().setFlag(EntityFlag.RIDING, riding);
|
||||||
if (riding) {
|
if (riding) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren