Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-26 00:00:41 +01:00
Re-implement steering indicators
Dieser Commit ist enthalten in:
Ursprung
774d3670c5
Commit
9d2d12b87b
@ -39,6 +39,7 @@ import org.geysermc.geyser.util.InteractionResult;
|
||||
import org.geysermc.geyser.util.InteractiveTag;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.BooleanEntityMetadata;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.player.Hand;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.level.ServerboundPaddleBoatPacket;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@ -182,6 +183,12 @@ public class BoatEntity extends Entity implements Leashable, Tickable {
|
||||
@Override
|
||||
public void tick() {
|
||||
// Java sends simply "true" and "false" (is_paddling_left), Bedrock keeps sending packets as you're rowing
|
||||
if (session.getPlayerEntity().getVehicle() == this) {
|
||||
// For packet timing accuracy, we'll send the packets here, as that's what Java Edition 1.21.3 does.
|
||||
ServerboundPaddleBoatPacket steerPacket = new ServerboundPaddleBoatPacket(session.isSteeringLeft(), session.isSteeringRight());
|
||||
session.sendDownstreamGamePacket(steerPacket);
|
||||
return;
|
||||
}
|
||||
doTick = !doTick; // Run every 100 ms
|
||||
if (!doTick || passengers.isEmpty()) {
|
||||
return;
|
||||
|
@ -25,13 +25,12 @@
|
||||
|
||||
package org.geysermc.geyser.translator.protocol.bedrock;
|
||||
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.player.Hand;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.level.ServerboundPaddleBoatPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.player.ServerboundSwingPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.AnimatePacket;
|
||||
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.data.game.entity.player.Hand;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.player.ServerboundSwingPacket;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@ -45,8 +44,8 @@ public class BedrockAnimateTranslator extends PacketTranslator<AnimatePacket> {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (packet.getAction()) {
|
||||
case SWING_ARM -> {
|
||||
System.out.println("wewewewewewewewewewewe");
|
||||
if (packet.getAction() == AnimatePacket.Action.SWING_ARM) {
|
||||
session.armSwingPending();
|
||||
// Delay so entity damage can be processed first
|
||||
session.scheduleInEventLoop(() -> {
|
||||
@ -72,18 +71,5 @@ public class BedrockAnimateTranslator extends PacketTranslator<AnimatePacket> {
|
||||
TimeUnit.MILLISECONDS
|
||||
);
|
||||
}
|
||||
// These two might need to be flipped, but my recommendation is getting moving working first
|
||||
case ROW_LEFT -> {
|
||||
// Packet value is a float of how long one has been rowing, so we convert that into a boolean
|
||||
session.setSteeringLeft(packet.getRowingTime() > 0.0);
|
||||
ServerboundPaddleBoatPacket steerLeftPacket = new ServerboundPaddleBoatPacket(session.isSteeringLeft(), session.isSteeringRight());
|
||||
session.sendDownstreamGamePacket(steerLeftPacket);
|
||||
}
|
||||
case ROW_RIGHT -> {
|
||||
session.setSteeringRight(packet.getRowingTime() > 0.0);
|
||||
ServerboundPaddleBoatPacket steerRightPacket = new ServerboundPaddleBoatPacket(session.isSteeringLeft(), session.isSteeringRight());
|
||||
session.sendDownstreamGamePacket(steerRightPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +78,6 @@ public final class BedrockPlayerAuthInputTranslator extends PacketTranslator<Pla
|
||||
BedrockMovePlayerTranslator.translate(session, packet);
|
||||
|
||||
Set<PlayerAuthInputData> inputData = packet.getInputData();
|
||||
if (!inputData.isEmpty()) {
|
||||
for (PlayerAuthInputData input : inputData) {
|
||||
switch (input) {
|
||||
case PERFORM_ITEM_INTERACTION -> processItemUseTransaction(session, packet.getItemUseTransaction());
|
||||
@ -154,7 +153,11 @@ public final class BedrockPlayerAuthInputTranslator extends PacketTranslator<Pla
|
||||
case STOP_GLIDING -> sendPlayerGlideToggle(session, entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
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?
|
||||
session.setSteeringLeft(up || inputData.contains(PlayerAuthInputData.PADDLE_RIGHT));
|
||||
session.setSteeringRight(up || inputData.contains(PlayerAuthInputData.PADDLE_LEFT));
|
||||
}
|
||||
|
||||
private static void sendPlayerGlideToggle(GeyserSession session, Entity entity) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren