Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-03 14:50:19 +01: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:
Ursprung
8e274daa75
Commit
2a44874458
@ -36,7 +36,20 @@ import org.geysermc.connector.network.translators.item.ItemTranslator;
|
|||||||
public class ItemEntity extends Entity {
|
public class ItemEntity extends Entity {
|
||||||
|
|
||||||
public ItemEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) {
|
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
|
@Override
|
||||||
@ -44,7 +57,7 @@ public class ItemEntity extends Entity {
|
|||||||
if (entityMetadata.getId() == 7) {
|
if (entityMetadata.getId() == 7) {
|
||||||
AddItemEntityPacket itemPacket = new AddItemEntityPacket();
|
AddItemEntityPacket itemPacket = new AddItemEntityPacket();
|
||||||
itemPacket.setRuntimeEntityId(geyserId);
|
itemPacket.setRuntimeEntityId(geyserId);
|
||||||
itemPacket.setPosition(position);
|
itemPacket.setPosition(position.add(0d, this.entityType.getOffset(), 0d));
|
||||||
itemPacket.setMotion(motion);
|
itemPacket.setMotion(motion);
|
||||||
itemPacket.setUniqueEntityId(geyserId);
|
itemPacket.setUniqueEntityId(geyserId);
|
||||||
itemPacket.setFromFishing(false);
|
itemPacket.setFromFishing(false);
|
||||||
|
@ -100,7 +100,7 @@ public enum EntityType {
|
|||||||
ARMOR_STAND(ArmorStandEntity.class, 61, 1.975f, 0.5f),
|
ARMOR_STAND(ArmorStandEntity.class, 61, 1.975f, 0.5f),
|
||||||
TRIPOD_CAMERA(Entity.class, 62, 0f),
|
TRIPOD_CAMERA(Entity.class, 62, 0f),
|
||||||
PLAYER(PlayerEntity.class, 63, 1.8f, 0.6f, 0.6f, 1.62f),
|
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"),
|
PRIMED_TNT(TNTEntity.class, 65, 0.98f, 0.98f, 0.98f, 0f, "minecraft:tnt"),
|
||||||
FALLING_BLOCK(FallingBlockEntity.class, 66, 0.98f, 0.98f),
|
FALLING_BLOCK(FallingBlockEntity.class, 66, 0.98f, 0.98f),
|
||||||
MOVING_BLOCK(Entity.class, 67, 0f),
|
MOVING_BLOCK(Entity.class, 67, 0f),
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren