Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-26 16:12:46 +01:00
Fix regressions in player movement handling
Dieser Commit ist enthalten in:
Ursprung
c3f146370e
Commit
9084c59003
@ -91,7 +91,7 @@ public record EntityDefinition<T extends Entity>(EntityFactory<T> factory, Entit
|
|||||||
private String identifier;
|
private String identifier;
|
||||||
private float width;
|
private float width;
|
||||||
private float height;
|
private float height;
|
||||||
private float offset;
|
private float offset = 0.00001f;
|
||||||
private final List<EntityMetadataTranslator<? super T, ?, ?>> translators;
|
private final List<EntityMetadataTranslator<? super T, ?, ?>> translators;
|
||||||
|
|
||||||
private Builder(EntityFactory<T> factory) {
|
private Builder(EntityFactory<T> factory) {
|
||||||
@ -118,6 +118,11 @@ public record EntityDefinition<T extends Entity>(EntityFactory<T> factory, Entit
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder<T> offset(float offset) {
|
||||||
|
this.offset = offset + 0.00001f;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets the identifier as well
|
* Resets the identifier as well
|
||||||
*/
|
*/
|
||||||
|
@ -83,9 +83,9 @@ public class Entity {
|
|||||||
|
|
||||||
/* Metadata about this specific entity */
|
/* Metadata about this specific entity */
|
||||||
@Setter(AccessLevel.NONE)
|
@Setter(AccessLevel.NONE)
|
||||||
protected float boundingBoxHeight;
|
private float boundingBoxHeight;
|
||||||
@Setter(AccessLevel.NONE)
|
@Setter(AccessLevel.NONE)
|
||||||
protected float boundingBoxWidth;
|
private float boundingBoxWidth;
|
||||||
@Setter(AccessLevel.NONE)
|
@Setter(AccessLevel.NONE)
|
||||||
protected String nametag = "";
|
protected String nametag = "";
|
||||||
/* Metadata end */
|
/* Metadata end */
|
||||||
|
@ -45,9 +45,8 @@ public class AgeableEntity extends CreatureEntity {
|
|||||||
dirtyMetadata.put(EntityData.SCALE, isBaby ? getBabySize() : getAdultSize());
|
dirtyMetadata.put(EntityData.SCALE, isBaby ? getBabySize() : getAdultSize());
|
||||||
setFlag(EntityFlag.BABY, isBaby);
|
setFlag(EntityFlag.BABY, isBaby);
|
||||||
|
|
||||||
// TODO save this?
|
setBoundingBoxHeight(definition.height() * (isBaby ? getBabySize() : getAdultSize()));
|
||||||
dirtyMetadata.put(EntityData.BOUNDING_BOX_HEIGHT, definition.height() * (isBaby ? getBabySize() : getAdultSize()));
|
setBoundingBoxWidth(definition.width() * (isBaby ? getBabySize() : getAdultSize()));
|
||||||
dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, definition.width() * (isBaby ? getBabySize() : getAdultSize()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,8 +44,8 @@ public class PhantomEntity extends FlyingEntity {
|
|||||||
float modelScale = 1f + 0.15f * size;
|
float modelScale = 1f + 0.15f * size;
|
||||||
float boundsScale = (1f + (0.2f * size) / definition.width()) / modelScale;
|
float boundsScale = (1f + (0.2f * size) / definition.width()) / modelScale;
|
||||||
|
|
||||||
dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, boundsScale * definition.width());
|
setBoundingBoxWidth(boundsScale * definition.width());
|
||||||
dirtyMetadata.put(EntityData.BOUNDING_BOX_HEIGHT, boundsScale * definition.height());
|
setBoundingBoxHeight(boundsScale * definition.height());
|
||||||
dirtyMetadata.put(EntityData.SCALE, modelScale);
|
dirtyMetadata.put(EntityData.SCALE, modelScale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,6 @@ import com.nukkitx.protocol.bedrock.BedrockPacket;
|
|||||||
import com.nukkitx.protocol.bedrock.BedrockServerSession;
|
import com.nukkitx.protocol.bedrock.BedrockServerSession;
|
||||||
import com.nukkitx.protocol.bedrock.data.*;
|
import com.nukkitx.protocol.bedrock.data.*;
|
||||||
import com.nukkitx.protocol.bedrock.data.command.CommandPermission;
|
import com.nukkitx.protocol.bedrock.data.command.CommandPermission;
|
||||||
import com.nukkitx.protocol.bedrock.data.entity.EntityData;
|
|
||||||
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
|
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
|
||||||
import com.nukkitx.protocol.bedrock.packet.*;
|
import com.nukkitx.protocol.bedrock.packet.*;
|
||||||
import com.nukkitx.protocol.bedrock.v471.Bedrock_v471;
|
import com.nukkitx.protocol.bedrock.v471.Bedrock_v471;
|
||||||
@ -1057,7 +1056,7 @@ public class GeyserSession implements GeyserConnection, CommandSender {
|
|||||||
|
|
||||||
private void setSneakingPose(boolean sneaking) {
|
private void setSneakingPose(boolean sneaking) {
|
||||||
this.pose = sneaking ? Pose.SNEAKING : Pose.STANDING;
|
this.pose = sneaking ? Pose.SNEAKING : Pose.STANDING;
|
||||||
playerEntity.getDirtyMetadata().put(EntityData.BOUNDING_BOX_HEIGHT, sneaking ? 1.5f : playerEntity.getDefinition().height());
|
playerEntity.setBoundingBoxHeight(sneaking ? 1.5f : playerEntity.getDefinition().height());
|
||||||
playerEntity.setFlag(EntityFlag.SNEAKING, sneaking);
|
playerEntity.setFlag(EntityFlag.SNEAKING, sneaking);
|
||||||
|
|
||||||
collisionManager.updatePlayerBoundingBox();
|
collisionManager.updatePlayerBoundingBox();
|
||||||
@ -1065,7 +1064,7 @@ public class GeyserSession implements GeyserConnection, CommandSender {
|
|||||||
|
|
||||||
public void setSwimming(boolean swimming) {
|
public void setSwimming(boolean swimming) {
|
||||||
this.pose = swimming ? Pose.SWIMMING : Pose.STANDING;
|
this.pose = swimming ? Pose.SWIMMING : Pose.STANDING;
|
||||||
playerEntity.getDirtyMetadata().put(EntityData.BOUNDING_BOX_HEIGHT, swimming ? 0.6f : playerEntity.getDefinition().height());
|
playerEntity.setBoundingBoxHeight(swimming ? 0.6f : playerEntity.getDefinition().height());
|
||||||
playerEntity.setFlag(EntityFlag.SWIMMING, swimming);
|
playerEntity.setFlag(EntityFlag.SWIMMING, swimming);
|
||||||
playerEntity.updateBedrockMetadata();
|
playerEntity.updateBedrockMetadata();
|
||||||
}
|
}
|
||||||
|
@ -33,10 +33,10 @@ import com.nukkitx.math.vector.Vector3d;
|
|||||||
import com.nukkitx.math.vector.Vector3f;
|
import com.nukkitx.math.vector.Vector3f;
|
||||||
import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket;
|
import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket;
|
||||||
import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket;
|
import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket;
|
||||||
import org.geysermc.geyser.text.ChatColor;
|
|
||||||
import org.geysermc.geyser.entity.EntityDefinitions;
|
import org.geysermc.geyser.entity.EntityDefinitions;
|
||||||
import org.geysermc.geyser.entity.type.player.SessionPlayerEntity;
|
import org.geysermc.geyser.entity.type.player.SessionPlayerEntity;
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
|
import org.geysermc.geyser.text.ChatColor;
|
||||||
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
||||||
import org.geysermc.geyser.translator.protocol.Translator;
|
import org.geysermc.geyser.translator.protocol.Translator;
|
||||||
|
|
||||||
@ -71,8 +71,6 @@ public class BedrockMovePlayerTranslator extends PacketTranslator<MovePlayerPack
|
|||||||
session.confirmTeleport(packet.getPosition().toDouble().sub(0, EntityDefinitions.PLAYER.offset(), 0));
|
session.confirmTeleport(packet.getPosition().toDouble().sub(0, EntityDefinitions.PLAYER.offset(), 0));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// head yaw, pitch, head yaw
|
|
||||||
Vector3f rotation = Vector3f.from(packet.getRotation().getY(), packet.getRotation().getX(), packet.getRotation().getY());
|
|
||||||
float yaw = packet.getRotation().getY();
|
float yaw = packet.getRotation().getY();
|
||||||
float pitch = packet.getRotation().getX();
|
float pitch = packet.getRotation().getX();
|
||||||
float headYaw = packet.getRotation().getY();
|
float headYaw = packet.getRotation().getY();
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren