Skip to content

Commit

Permalink
Merge branch 'master' into misc-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
letsgoawaydev authored Mar 3, 2025
2 parents c20e8af + ce15359 commit becce3e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
import org.geysermc.geyser.entity.EntityDefinitions;
import org.geysermc.geyser.entity.GeyserEntityData;
import org.geysermc.geyser.entity.attribute.GeyserAttributeType;
import org.geysermc.geyser.entity.type.BoatEntity;
import org.geysermc.geyser.entity.type.Entity;
import org.geysermc.geyser.entity.type.ItemFrameEntity;
import org.geysermc.geyser.entity.type.Tickable;
Expand Down Expand Up @@ -1370,7 +1371,7 @@ public void activateArmAnimationTicking() {
* You can't break blocks, attack entities, or use items while driving in a boat
*/
public boolean isHandsBusy() {
return steeringRight || steeringLeft;
return playerEntity.getVehicle() instanceof BoatEntity && (steeringRight || steeringLeft);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ public void translate(GeyserSession session, InteractPacket packet) {
ServerboundPlayerCommandPacket sneakPacket = new ServerboundPlayerCommandPacket(entity.getEntityId(), PlayerState.START_SNEAKING);
session.sendDownstreamGamePacket(sneakPacket);

// Reset steering to avoid these accidentally triggering session#isHandsBusy
session.setSteeringLeft(false);
session.setSteeringRight(false);

Entity currentVehicle = session.getPlayerEntity().getVehicle();
if (currentVehicle != null) {
session.setMountVehicleScheduledFuture(session.scheduleInEventLoop(() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import org.cloudburstmc.protocol.bedrock.packet.LevelEventPacket;
import org.cloudburstmc.protocol.bedrock.packet.PlayerActionPacket;
import org.cloudburstmc.protocol.bedrock.packet.PlayerAuthInputPacket;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.entity.EntityDefinitions;
import org.geysermc.geyser.entity.type.BoatEntity;
import org.geysermc.geyser.entity.type.Entity;
Expand Down Expand Up @@ -168,7 +167,9 @@ public void translate(GeyserSession session, PlayerAuthInputPacket packet) {
}
}
}
if (entity.getVehicle() instanceof BoatEntity) {

// Only set steering values when the vehicle is a boat and when the client is actually in it
if (entity.getVehicle() instanceof BoatEntity && inputData.contains(PlayerAuthInputData.IN_CLIENT_PREDICTED_IN_VEHICLE)) {
boolean up = inputData.contains(PlayerAuthInputData.UP);
// Yes. These are flipped. It's always been an issue with Geyser. That's what it's like working with this codebase.
// Hi random stranger. I am six days into updating for 1.21.3. How's it going?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ public void translate(GeyserSession session, ClientboundSetPassengersPacket pack
session.getMountVehicleScheduledFuture().cancel(false);
}

// Reset steering to avoid session#isHandsBusy from triggering
session.setSteeringLeft(false);
session.setSteeringRight(false);

if (entity instanceof ClientVehicle clientVehicle) {
clientVehicle.getVehicleComponent().onDismount();
}
Expand Down

0 comments on commit becce3e

Please sign in to comment.