forked from GeyserMC/Geyser
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
This commit is contained in:
parent
d717085c6b
commit
6f161a380f
1 changed files with 4 additions and 1 deletions
|
@ -301,10 +301,13 @@ public class GeyserSession implements CommandSender {
|
||||||
attributesPacket.setAttributes(attributes);
|
attributesPacket.setAttributes(attributes);
|
||||||
upstream.sendPacket(attributesPacket);
|
upstream.sendPacket(attributesPacket);
|
||||||
|
|
||||||
|
GameRulesChangedPacket gamerulePacket = new GameRulesChangedPacket();
|
||||||
// Only allow the server to send health information
|
// 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
|
// 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));
|
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);
|
upstream.sendPacket(gamerulePacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue