Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-26 00:00:41 +01:00
Some final touches
Dieser Commit ist enthalten in:
Ursprung
706b18d933
Commit
f5d9db4ff6
@ -168,7 +168,7 @@ public class SessionPlayerEntity extends PlayerEntity {
|
||||
|
||||
/**
|
||||
* Set the player's position without applying an offset or moving the bounding box
|
||||
* This is used in BedrockMovePlayerTranslator which receives the player's position
|
||||
* This is used in BedrockMovePlayer which receives the player's position
|
||||
* with the offset pre-applied
|
||||
*
|
||||
* @param position the new position of the Bedrock player
|
||||
|
@ -26,6 +26,7 @@
|
||||
package org.geysermc.geyser.network;
|
||||
|
||||
import io.netty.buffer.Unpooled;
|
||||
import org.cloudburstmc.math.vector.Vector2f;
|
||||
import org.cloudburstmc.protocol.bedrock.BedrockDisconnectReasons;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.BedrockCodec;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.compat.BedrockCompat;
|
||||
@ -38,9 +39,9 @@ import org.cloudburstmc.protocol.bedrock.netty.codec.compression.ZlibCompression
|
||||
import org.cloudburstmc.protocol.bedrock.packet.BedrockPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.LoginPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.ModalFormResponsePacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.MovePlayerPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.NetworkSettingsPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.PlayStatusPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.PlayerAuthInputPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.RequestNetworkSettingsPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.ResourcePackChunkDataPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.ResourcePackChunkRequestPacket;
|
||||
@ -290,8 +291,9 @@ public class UpstreamPacketHandler extends LoggingPacketHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketSignal handle(MovePlayerPacket packet) { // TODO
|
||||
if (session.isLoggingIn()) {
|
||||
public PacketSignal handle(PlayerAuthInputPacket packet) {
|
||||
// This doesn't catch rotation, but for a niche case I don't exactly want to cache rotation...
|
||||
if (session.isLoggingIn() && !packet.getMotion().equals(Vector2f.ZERO)) {
|
||||
SetTitlePacket titlePacket = new SetTitlePacket();
|
||||
titlePacket.setType(SetTitlePacket.Type.ACTIONBAR);
|
||||
titlePacket.setText(GeyserLocale.getPlayerLocaleString("geyser.auth.login.wait", session.locale()));
|
||||
|
@ -31,7 +31,6 @@ import com.google.gson.reflect.TypeToken;
|
||||
import it.unimi.dsi.fastutil.Hash;
|
||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectIntPair;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v671.Bedrock_v671;
|
||||
@ -90,7 +89,7 @@ public final class TagRegistryPopulator {
|
||||
throw new AssertionError("Unable to load Bedrock runtime item IDs", e);
|
||||
}
|
||||
|
||||
Object2ObjectMap<int[], String> javaItemsToBedrockTag = new Object2ObjectOpenCustomHashMap<>(hashStrategy);
|
||||
var javaItemsToBedrockTag = new Object2ObjectOpenCustomHashMap<int[], String>(hashStrategy);
|
||||
|
||||
for (var entry : bedrockTags.entrySet()) {
|
||||
List<String> value = entry.getValue();
|
||||
@ -129,6 +128,7 @@ public final class TagRegistryPopulator {
|
||||
javaItemsToBedrockTag.put(javaNetworkIdArray, entry.getKey());
|
||||
}
|
||||
|
||||
javaItemsToBedrockTag.trim();
|
||||
Registries.TAGS.register(palette.rightInt(), javaItemsToBedrockTag);
|
||||
}
|
||||
}
|
||||
|
@ -1077,6 +1077,11 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
||||
|
||||
// Download and load the language for the player
|
||||
MinecraftLocale.downloadAndLoadLocale(locale);
|
||||
|
||||
// if (sentSpawnPacket && !GameProtocol.isPre1_21_2(GeyserSession.this)) {
|
||||
// // Possible form to close.
|
||||
// upstream.sendPacket(new ClientboundCloseFormPacket());
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-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
|
||||
@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.geyser.translator.protocol.bedrock.entity.player;
|
||||
package org.geysermc.geyser.translator.protocol.bedrock.entity.player.input;
|
||||
|
||||
import org.cloudburstmc.math.vector.Vector3f;
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-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
|
||||
@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.geyser.translator.protocol.bedrock.entity.player;
|
||||
package org.geysermc.geyser.translator.protocol.bedrock.entity.player.input;
|
||||
|
||||
import org.cloudburstmc.math.vector.Vector3d;
|
||||
import org.cloudburstmc.math.vector.Vector3f;
|
||||
@ -40,8 +40,10 @@ import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.player.Serv
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerRotPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerStatusOnlyPacket;
|
||||
|
||||
|
||||
public final class BedrockMovePlayerTranslator {
|
||||
/**
|
||||
* Holds processing input coming in from the {@link PlayerAuthInputPacket} packet.
|
||||
*/
|
||||
final class BedrockMovePlayer {
|
||||
|
||||
static void translate(GeyserSession session, PlayerAuthInputPacket packet) {
|
||||
SessionPlayerEntity entity = session.getPlayerEntity();
|
@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.geyser.translator.protocol.bedrock.entity.player;
|
||||
package org.geysermc.geyser.translator.protocol.bedrock.entity.player.input;
|
||||
|
||||
import org.cloudburstmc.math.GenericMath;
|
||||
import org.cloudburstmc.math.vector.Vector2f;
|
||||
@ -74,7 +74,7 @@ public final class BedrockPlayerAuthInputTranslator extends PacketTranslator<Pla
|
||||
boolean wasJumping = session.getInputCache().wasJumping();
|
||||
session.getInputCache().processInputs(packet);
|
||||
|
||||
BedrockMovePlayerTranslator.translate(session, packet);
|
||||
BedrockMovePlayer.translate(session, packet);
|
||||
|
||||
processVehicleInput(session, packet, wasJumping);
|
||||
|
||||
@ -220,6 +220,9 @@ public final class BedrockPlayerAuthInputTranslator extends PacketTranslator<Pla
|
||||
session.sendDownstreamGamePacket(breakPacket);
|
||||
} else {
|
||||
session.getGeyser().getLogger().error("Unhandled item use transaction type!");
|
||||
if (session.getGeyser().getLogger().isDebug()) {
|
||||
session.getGeyser().getLogger().debug(transaction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -70,14 +70,16 @@ 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()) {
|
||||
session.getUpstream().sendPacket(craftingDataPacket);
|
||||
// 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);
|
||||
if (session.getStonecutterRecipes() != null) {
|
||||
session.getCraftingRecipes().clear();
|
||||
session.getJavaToBedrockRecipeIds().clear();
|
||||
session.getSmithingRecipes().clear();
|
||||
session.getStonecutterRecipes().clear();
|
||||
}
|
||||
} else {
|
||||
session.getUpstream().queuePostStartGamePacket(craftingDataPacket);
|
||||
}
|
||||
|
@ -515,7 +515,11 @@ public class InventoryUtils {
|
||||
List<SlotDisplay> mirroredIngredients = new ArrayList<>(ingredients.size());
|
||||
for (int row = 0; row < height; row++) {
|
||||
for (int col = 0; col < width; col++) {
|
||||
mirroredIngredients.add(ingredients.get((width - 1 - col) + (row * width)));
|
||||
int index = col + (row * width);
|
||||
while (mirroredIngredients.size() <= index) {
|
||||
mirroredIngredients.add(null);
|
||||
}
|
||||
mirroredIngredients.set(index, ingredients.get((width - 1 - col) + (row * width)));
|
||||
}
|
||||
}
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren