mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Code cleanup
This commit is contained in:
parent
c9b27c3987
commit
c8e0cdde68
2 changed files with 12 additions and 19 deletions
|
|
@ -26,6 +26,7 @@
|
|||
package org.geysermc.geyser.entity.type;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.cloudburstmc.math.vector.Vector3f;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
|
|
@ -38,18 +39,12 @@ import java.util.UUID;
|
|||
|
||||
public class DisplayBaseEntity extends Entity {
|
||||
|
||||
private Vector3f baseTranslation;
|
||||
private boolean noBaseTranslation;
|
||||
private @Nullable Vector3f baseTranslation;
|
||||
|
||||
public DisplayBaseEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initializeMetadata() {
|
||||
super.initializeMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDisplayNameVisible(BooleanEntityMetadata entityMetadata) {
|
||||
// Don't allow the display name to be hidden - messes with our armor stand.
|
||||
|
|
@ -65,7 +60,6 @@ public class DisplayBaseEntity extends Entity {
|
|||
public void setTranslation(EntityMetadata<Vector3f, ?> translationMeta){
|
||||
this.baseTranslation = translationMeta.getValue();
|
||||
if (this.baseTranslation == null) {
|
||||
this.noBaseTranslation = true;
|
||||
return;
|
||||
}
|
||||
if (this.vehicle == null) {
|
||||
|
|
@ -73,15 +67,11 @@ public class DisplayBaseEntity extends Entity {
|
|||
this.moveRelative(0, this.baseTranslation.getY(), 0, yaw, pitch, headYaw, false);
|
||||
} else {
|
||||
EntityUtils.updateMountOffset(this, this.vehicle, true, true, false);
|
||||
this.updateBedrockMetadata();
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3f getTranslation() {
|
||||
return baseTranslation;
|
||||
}
|
||||
|
||||
public boolean hasTranslation(){
|
||||
return !this.noBaseTranslation;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -202,11 +202,14 @@ public final class EntityUtils {
|
|||
case TRADER_LLAMA, LLAMA -> zOffset = -0.3f;
|
||||
case TEXT_DISPLAY -> {
|
||||
if (passenger instanceof TextDisplayEntity textDisplay) {
|
||||
if (!textDisplay.hasTranslation()) return;
|
||||
Vector3f displayTranslation = textDisplay.getTranslation();
|
||||
if (displayTranslation == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
xOffset = textDisplay.getTranslation().getX();
|
||||
yOffset = textDisplay.getTranslation().getY() + 0.2f;
|
||||
zOffset = textDisplay.getTranslation().getZ();
|
||||
xOffset = displayTranslation.getX();
|
||||
yOffset = displayTranslation.getY() + 0.2f;
|
||||
zOffset = displayTranslation.getZ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue