3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-19 22:40:18 +01:00

Code optimization

Dieser Commit ist enthalten in:
strom 2024-06-17 18:20:08 +02:00
Ursprung 5fcfd5a9f0
Commit 2fc44da237

Datei anzeigen

@ -154,9 +154,6 @@ public final class EntityUtils {
* Adjust an entity's height if they have mounted/dismounted an entity. * Adjust an entity's height if they have mounted/dismounted an entity.
*/ */
public static void updateMountOffset(Entity passenger, Entity mount, boolean rider, boolean riding, boolean moreThanOneEntity) { public static void updateMountOffset(Entity passenger, Entity mount, boolean rider, boolean riding, boolean moreThanOneEntity) {
if (passenger instanceof TextDisplayEntity textDisplay
&& !textDisplay.hasTranslation()) return;
passenger.setFlag(EntityFlag.RIDING, riding); passenger.setFlag(EntityFlag.RIDING, riding);
if (riding) { if (riding) {
// Without the Y offset, Bedrock players will find themselves in the floor when mounting // Without the Y offset, Bedrock players will find themselves in the floor when mounting
@ -201,6 +198,8 @@ public final class EntityUtils {
TextDisplayEntity textDisplay; TextDisplayEntity textDisplay;
if (passenger instanceof TextDisplayEntity) { if (passenger instanceof TextDisplayEntity) {
textDisplay = (TextDisplayEntity) passenger; textDisplay = (TextDisplayEntity) passenger;
if (!textDisplay.hasTranslation()) return;
xOffset = textDisplay.getTranslation().getX(); xOffset = textDisplay.getTranslation().getX();
yOffset = textDisplay.getTranslation().getY() + 0.2f; yOffset = textDisplay.getTranslation().getY() + 0.2f;
zOffset = textDisplay.getTranslation().getZ(); zOffset = textDisplay.getTranslation().getZ();