3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 16:12:46 +01:00

GeyserSession: Always set Keep Inventory to true (#1213)

* GeyserSession: Always set Keep Inventory to true

This prevents the client from removing items on death in creative mode if Keep Inventory is true, but doesn't break existing behavior. Essentially, this assures full server-side behavior of the inventory during death.

* Small comment update

* OK, it was fine before the last commit, but make it better
Dieser Commit ist enthalten in:
Camotoy 2020-09-02 00:37:24 -04:00 committet von GitHub
Ursprung d717085c6b
Commit 6f161a380f
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -301,10 +301,13 @@ public class GeyserSession implements CommandSender {
attributesPacket.setAttributes(attributes);
upstream.sendPacket(attributesPacket);
GameRulesChangedPacket gamerulePacket = new GameRulesChangedPacket();
// Only allow the server to send health information
// Setting this to false allows natural regeneration to work false but doesn't break it being true
GameRulesChangedPacket gamerulePacket = new GameRulesChangedPacket();
gamerulePacket.getGameRules().add(new GameRuleData<>("naturalregeneration", false));
// Don't let the client modify the inventory on death
// Setting this to true allows keep inventory to work if enabled but doesn't break functionality being false
gamerulePacket.getGameRules().add(new GameRuleData<>("keepinventory", true));
upstream.sendPacket(gamerulePacket);
}