Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-25 15:50:14 +01:00
Small fixes; start on new rotation packet
why is bedrock weird with player rotation
Dieser Commit ist enthalten in:
Ursprung
4d15c7fbcc
Commit
3298cdbc3c
@ -34,12 +34,13 @@ import org.cloudburstmc.math.vector.Vector3f;
|
||||
import org.cloudburstmc.protocol.bedrock.data.AttributeData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
|
||||
import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.MoveEntityAbsolutePacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.MovePlayerPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.UpdateAttributesPacket;
|
||||
import org.geysermc.geyser.entity.attribute.GeyserAttributeType;
|
||||
import org.geysermc.geyser.item.Items;
|
||||
import org.geysermc.geyser.network.GameProtocol;
|
||||
import org.geysermc.geyser.level.BedrockDimension;
|
||||
import org.geysermc.geyser.network.GameProtocol;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.util.AttributeUtils;
|
||||
import org.geysermc.geyser.util.DimensionUtils;
|
||||
@ -338,6 +339,17 @@ public class SessionPlayerEntity extends PlayerEntity {
|
||||
this.vehicleJumpStrength = MathUtils.constrain(vehicleJumpStrength, 0, 100);
|
||||
}
|
||||
|
||||
public void forceRotationUpdate() {
|
||||
MoveEntityAbsolutePacket absolutePacket = new MoveEntityAbsolutePacket();
|
||||
absolutePacket.setPosition(this.getPosition());
|
||||
absolutePacket.setRotation(this.getBedrockRotation());
|
||||
absolutePacket.setRuntimeEntityId(this.getGeyserId());
|
||||
absolutePacket.setForceMove(true);
|
||||
absolutePacket.setOnGround(this.isOnGround());
|
||||
|
||||
session.sendUpstreamPacket(absolutePacket);
|
||||
}
|
||||
|
||||
private boolean isBelowVoidFloor() {
|
||||
return position.getY() < voidFloorPosition();
|
||||
}
|
||||
|
@ -70,7 +70,9 @@ public class JavaFinishConfigurationTranslator extends PacketTranslator<Clientbo
|
||||
craftingDataPacket.setCleanRecipes(true);
|
||||
craftingDataPacket.getCraftingData().addAll(CARTOGRAPHY_RECIPES);
|
||||
craftingDataPacket.getPotionMixData().addAll(Registries.POTION_MIXES.forVersion(session.getUpstream().getProtocolVersion()));
|
||||
if (session.isSentSpawnPacket()) {
|
||||
// TODO proper fix to check if we've been online - in online mode (with auth screen),
|
||||
// recipes are not yet known
|
||||
if (session.isSentSpawnPacket() && session.getStonecutterRecipes() != null) {
|
||||
session.getUpstream().sendPacket(craftingDataPacket);
|
||||
session.getCraftingRecipes().clear();
|
||||
session.getJavaToBedrockRecipeIds().clear();
|
||||
|
@ -38,7 +38,7 @@ public class JavaCookieRequestTranslator extends PacketTranslator<ClientboundCoo
|
||||
public void translate(GeyserSession session, ClientboundCookieRequestPacket packet) {
|
||||
ServerboundCookieResponsePacket responsePacket = new ServerboundCookieResponsePacket(
|
||||
packet.getKey(),
|
||||
session.getCookies().get(packet.getKey())
|
||||
session.getCookies().get(packet.getKey().asString())
|
||||
);
|
||||
session.sendDownstreamPacket(responsePacket);
|
||||
}
|
||||
|
@ -26,10 +26,6 @@
|
||||
package org.geysermc.geyser.translator.protocol.java.entity.player;
|
||||
|
||||
import org.cloudburstmc.math.vector.Vector3d;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.player.PositionElement;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerPositionPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.level.ServerboundAcceptTeleportationPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosRotPacket;
|
||||
import org.cloudburstmc.math.vector.Vector3f;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.ChunkRadiusUpdatedPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.MovePlayerPacket;
|
||||
@ -41,6 +37,10 @@ import org.geysermc.geyser.session.cache.TeleportCache;
|
||||
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
||||
import org.geysermc.geyser.translator.protocol.Translator;
|
||||
import org.geysermc.geyser.util.ChunkUtils;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.player.PositionElement;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerPositionPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.level.ServerboundAcceptTeleportationPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosRotPacket;
|
||||
|
||||
@Translator(packet = ClientboundPlayerPositionPacket.class)
|
||||
public class JavaPlayerPositionTranslator extends PacketTranslator<ClientboundPlayerPositionPacket> {
|
||||
@ -76,6 +76,12 @@ public class JavaPlayerPositionTranslator extends PacketTranslator<ClientboundPl
|
||||
movePlayerPacket.setMode(MovePlayerPacket.Mode.RESPAWN);
|
||||
|
||||
session.sendUpstreamPacket(movePlayerPacket);
|
||||
|
||||
// Fixes incorrect rotation upon login
|
||||
// Yes, even that's not respected by Bedrock. Try it out in singleplayer!
|
||||
// Log out and back in - and you're looking elsewhere :)
|
||||
entity.forceRotationUpdate();
|
||||
|
||||
session.setSpawned(true);
|
||||
// Make sure the player moves away from (0, 32767, 0) before accepting movement packets
|
||||
session.setUnconfirmedTeleport(new TeleportCache(packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ(), packet.getXRot(), packet.getYRot(), packet.getId())); // TODO
|
||||
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2024 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author GeyserMC
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.geyser.translator.protocol.java.entity.player;
|
||||
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
||||
import org.geysermc.geyser.translator.protocol.Translator;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerRotationPacket;
|
||||
|
||||
@Translator(packet = ClientboundPlayerRotationPacket.class)
|
||||
public class JavaPlayerRotationTranslator extends PacketTranslator<ClientboundPlayerRotationPacket> {
|
||||
|
||||
@Override
|
||||
public void translate(GeyserSession session, ClientboundPlayerRotationPacket packet) {
|
||||
GeyserImpl.getInstance().getLogger().info(packet.toString());
|
||||
// TODO
|
||||
}
|
||||
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren