3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-09-08 20:43:04 +02:00

Fix Bedrock ItemEntity Y position bug (#1636)

Setting motion while on the ground causes visual issues. Additionally, there is an offset difference in the movement of an item entity.
Dieser Commit ist enthalten in:
rosiecube 2020-12-10 05:09:14 +09:00 committet von GitHub
Ursprung 8e274daa75
Commit 2a44874458
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 16 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -36,7 +36,20 @@ import org.geysermc.connector.network.translators.item.ItemTranslator;
public class ItemEntity extends Entity {
public ItemEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) {
super(entityId, geyserId, entityType, position, motion, rotation);
super(entityId, geyserId, entityType, position.add(0d, entityType.getOffset(), 0d), motion, rotation);
}
@Override
public void setMotion(Vector3f motion) {
if (isOnGround())
motion = Vector3f.from(motion.getX(), 0, motion.getZ());
super.setMotion(motion);
}
@Override
public void moveAbsolute(GeyserSession session, Vector3f position, Vector3f rotation, boolean isOnGround, boolean teleported) {
super.moveAbsolute(session, position.add(0d, this.entityType.getOffset(), 0d), rotation, isOnGround, teleported);
}
@Override
@ -44,7 +57,7 @@ public class ItemEntity extends Entity {
if (entityMetadata.getId() == 7) {
AddItemEntityPacket itemPacket = new AddItemEntityPacket();
itemPacket.setRuntimeEntityId(geyserId);
itemPacket.setPosition(position);
itemPacket.setPosition(position.add(0d, this.entityType.getOffset(), 0d));
itemPacket.setMotion(motion);
itemPacket.setUniqueEntityId(geyserId);
itemPacket.setFromFishing(false);

Datei anzeigen

@ -100,7 +100,7 @@ public enum EntityType {
ARMOR_STAND(ArmorStandEntity.class, 61, 1.975f, 0.5f),
TRIPOD_CAMERA(Entity.class, 62, 0f),
PLAYER(PlayerEntity.class, 63, 1.8f, 0.6f, 0.6f, 1.62f),
ITEM(ItemEntity.class, 64, 0.25f, 0.25f),
ITEM(ItemEntity.class, 64, 0.25f, 0.25f, 0.25f, 0.125f),
PRIMED_TNT(TNTEntity.class, 65, 0.98f, 0.98f, 0.98f, 0f, "minecraft:tnt"),
FALLING_BLOCK(FallingBlockEntity.class, 66, 0.98f, 0.98f),
MOVING_BLOCK(Entity.class, 67, 0f),