Skip to content

Commit

Permalink
fix: (not tested) placing a block on a bed without shift does not rem…
Browse files Browse the repository at this point in the history
…ove the item from the inventory if the amount is one

port of 0.2.32 commit c43bbcc
  • Loading branch information
Misat11 committed May 4, 2024
1 parent 43b37ee commit a2b3efe
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
import org.screamingsandals.lib.event.OnEvent;
import org.screamingsandals.lib.event.entity.*;
import org.screamingsandals.lib.event.player.*;
import org.screamingsandals.lib.item.builder.ItemStackFactory;
import org.screamingsandals.lib.lang.Message;
import org.screamingsandals.lib.placeholders.PlaceholderManager;
import org.screamingsandals.lib.player.Player;
Expand Down Expand Up @@ -1005,7 +1006,15 @@ public void onPlayerInteract(PlayerInteractEvent event) {
originalState.updateBlock(true, false);
} else {
if (!player.getGameMode().is("creative")) {
stack.changeAmount(stack.getAmount() - 1);
if (stack.getAmount() > 1) {
stack.changeAmount(stack.getAmount() - 1);
} else {
if (player.getPlayerInventory().getItemInOffHand().equals(stack)) {
player.getPlayerInventory().setItemInOffHand(ItemStackFactory.getAir());
} else {
player.getPlayerInventory().setItemInMainHand(ItemStackFactory.getAir());
}
}
}
if (!player.isSneaking()) {
// TODO get right block place sound
Expand Down

0 comments on commit a2b3efe

Please sign in to comment.