Skip to content

Commit

Permalink
Merge pull request #321 from ferriarnus/keepinv-fix
Browse files Browse the repository at this point in the history
Fix keep inventory behavior
  • Loading branch information
Rover656 authored Jul 20, 2023
2 parents 1b6e17a + 2916322 commit dbeca20
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ public static void deathHandler(LivingDropsEvent event) {
public static void reviveHandler(PlayerEvent.Clone event) {
if (!event.getOriginal().isDeadOrDying()) {
return;
}//TODO More detailed and better item recovery.
}
if (event.getEntity().level().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY)) {
return;
}
//TODO More detailed and better item recovery.
event.getOriginal().getInventory().items.forEach(item -> event.getEntity().addItem(item));
event.getOriginal().getInventory().armor.forEach(armor -> event.getEntity().addItem(armor));
event.getOriginal().getInventory().offhand.forEach(offhand -> event.getEntity().addItem(offhand));
Expand Down

0 comments on commit dbeca20

Please sign in to comment.