Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-25 15:50:14 +01:00
Should resolve https://github.com/GeyserMC/Geyser/issues/4121 (#4481)
Dieser Commit ist enthalten in:
Ursprung
1af24e5547
Commit
32f66371d9
@ -44,6 +44,8 @@ import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action
|
|||||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.SwapAction;
|
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.SwapAction;
|
||||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.TransferItemStackRequestAction;
|
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.TransferItemStackRequestAction;
|
||||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.response.ItemStackResponse;
|
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.response.ItemStackResponse;
|
||||||
|
import org.cloudburstmc.protocol.bedrock.packet.ContainerClosePacket;
|
||||||
|
import org.cloudburstmc.protocol.bedrock.packet.ContainerOpenPacket;
|
||||||
import org.cloudburstmc.protocol.bedrock.packet.InventoryContentPacket;
|
import org.cloudburstmc.protocol.bedrock.packet.InventoryContentPacket;
|
||||||
import org.cloudburstmc.protocol.bedrock.packet.InventorySlotPacket;
|
import org.cloudburstmc.protocol.bedrock.packet.InventorySlotPacket;
|
||||||
import org.geysermc.geyser.inventory.*;
|
import org.geysermc.geyser.inventory.*;
|
||||||
@ -534,10 +536,20 @@ public class PlayerInventoryTranslator extends InventoryTranslator {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void openInventory(GeyserSession session, Inventory inventory) {
|
public void openInventory(GeyserSession session, Inventory inventory) {
|
||||||
|
ContainerOpenPacket containerOpenPacket = new ContainerOpenPacket();
|
||||||
|
containerOpenPacket.setId((byte) 0);
|
||||||
|
containerOpenPacket.setType(org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType.INVENTORY);
|
||||||
|
containerOpenPacket.setUniqueEntityId(-1);
|
||||||
|
containerOpenPacket.setBlockPosition(session.getPlayerEntity().getPosition().toInt());
|
||||||
|
session.sendUpstreamPacket(containerOpenPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void closeInventory(GeyserSession session, Inventory inventory) {
|
public void closeInventory(GeyserSession session, Inventory inventory) {
|
||||||
|
ContainerClosePacket packet = new ContainerClosePacket();
|
||||||
|
packet.setServerInitiated(true);
|
||||||
|
packet.setId((byte) ContainerId.INVENTORY);
|
||||||
|
session.sendUpstreamPacket(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -33,8 +33,6 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.Server
|
|||||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerCommandPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerCommandPacket;
|
||||||
import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
|
import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
|
||||||
import org.cloudburstmc.protocol.bedrock.data.entity.EntityLinkData;
|
import org.cloudburstmc.protocol.bedrock.data.entity.EntityLinkData;
|
||||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType;
|
|
||||||
import org.cloudburstmc.protocol.bedrock.packet.ContainerOpenPacket;
|
|
||||||
import org.cloudburstmc.protocol.bedrock.packet.InteractPacket;
|
import org.cloudburstmc.protocol.bedrock.packet.InteractPacket;
|
||||||
import org.cloudburstmc.protocol.bedrock.packet.SetEntityLinkPacket;
|
import org.cloudburstmc.protocol.bedrock.packet.SetEntityLinkPacket;
|
||||||
import org.geysermc.geyser.entity.type.Entity;
|
import org.geysermc.geyser.entity.type.Entity;
|
||||||
@ -126,14 +124,7 @@ public class BedrockInteractTranslator extends PacketTranslator<InteractPacket>
|
|||||||
ServerboundPlayerCommandPacket openVehicleWindowPacket = new ServerboundPlayerCommandPacket(session.getPlayerEntity().getEntityId(), PlayerState.OPEN_VEHICLE_INVENTORY);
|
ServerboundPlayerCommandPacket openVehicleWindowPacket = new ServerboundPlayerCommandPacket(session.getPlayerEntity().getEntityId(), PlayerState.OPEN_VEHICLE_INVENTORY);
|
||||||
session.sendDownstreamGamePacket(openVehicleWindowPacket);
|
session.sendDownstreamGamePacket(openVehicleWindowPacket);
|
||||||
} else {
|
} else {
|
||||||
session.setOpenInventory(session.getPlayerInventory());
|
InventoryUtils.openInventory(session, session.getPlayerInventory());
|
||||||
|
|
||||||
ContainerOpenPacket containerOpenPacket = new ContainerOpenPacket();
|
|
||||||
containerOpenPacket.setId((byte) 0);
|
|
||||||
containerOpenPacket.setType(ContainerType.INVENTORY);
|
|
||||||
containerOpenPacket.setUniqueEntityId(-1);
|
|
||||||
containerOpenPacket.setBlockPosition(entity.getPosition().toInt());
|
|
||||||
session.sendUpstreamPacket(containerOpenPacket);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Case: Player opens a player inventory, while we think it shouldn't have!
|
// Case: Player opens a player inventory, while we think it shouldn't have!
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren