mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Fix inventory bug when respawning
This commit is contained in:
parent
ca620d6dd8
commit
5d4b368e51
1 changed files with 5 additions and 1 deletions
|
@ -35,6 +35,7 @@ import org.geysermc.connector.entity.attribute.AttributeType;
|
|||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
import org.geysermc.connector.network.translators.PacketTranslator;
|
||||
import org.geysermc.connector.network.translators.Translator;
|
||||
import org.geysermc.connector.network.translators.inventory.InventoryTranslator;
|
||||
import org.geysermc.connector.utils.DimensionUtils;
|
||||
|
||||
@Translator(packet = ServerRespawnPacket.class)
|
||||
|
@ -48,7 +49,10 @@ public class JavaRespawnTranslator extends PacketTranslator<ServerRespawnPacket>
|
|||
// Max health must be divisible by two in bedrock
|
||||
entity.getAttributes().put(AttributeType.HEALTH, AttributeType.HEALTH.getAttribute(maxHealth, (maxHealth % 2 == 1 ? maxHealth + 1 : maxHealth)));
|
||||
|
||||
session.setOpenInventory(null);
|
||||
session.addInventoryTask(() -> {
|
||||
session.setInventoryTranslator(InventoryTranslator.PLAYER_INVENTORY_TRANSLATOR);
|
||||
session.setOpenInventory(null);
|
||||
});
|
||||
|
||||
SetPlayerGameTypePacket playerGameTypePacket = new SetPlayerGameTypePacket();
|
||||
playerGameTypePacket.setGamemode(packet.getGamemode().ordinal());
|
||||
|
|
Loading…
Reference in a new issue