diff --git a/src/main/java/com/g2806/soulsteal/service/RewardService.java b/src/main/java/com/g2806/soulsteal/service/RewardService.java index 5516c4b..23fef91 100644 --- a/src/main/java/com/g2806/soulsteal/service/RewardService.java +++ b/src/main/java/com/g2806/soulsteal/service/RewardService.java @@ -25,6 +25,7 @@ import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.text.Text; import net.minecraft.util.Formatting; import net.minecraft.util.Identifier; +import net.minecraft.world.World; /** Executes validated shop rewards for the player who bought an entry. */ public final class RewardService { @@ -151,10 +152,19 @@ public final class RewardService { } private void giveItems(PlayerEntity player, Item item, int amount) { + World world = player.getEntityWorld(); int remaining = amount; while (remaining > 0) { int stackSize = Math.min(item.getMaxCount(), remaining); - player.giveItemStack(new ItemStack(item, stackSize)); + ItemStack stack = new ItemStack(item, stackSize); + + boolean added = player.giveItemStack(stack); + + if (!added || !stack.isEmpty()) { + // Inventory full or partially full: drop the remaining stack in the world + player.dropItem(stack, false); + } + remaining -= stackSize; } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index f726e0b..f635b30 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -5,7 +5,8 @@ "name": "Soul Steal", "description": "A server-side soul economy mod with bounties, tracking, and a configurable reward shop.", "authors": [ - "Gabrieli2806" + "Gabrieli2806", + "darwincereska" ], "contact": { "homepage": "https://www.fiverr.com/gabriel2806/"