From 1c85aa91bbb8ced10c113294099e2184d1aeae5f Mon Sep 17 00:00:00 2001 From: FuBangkun <109213800+FuBangkun@users.noreply.github.com> Date: Sun, 30 Jun 2024 16:55:24 +0800 Subject: [PATCH] Improve the mechanism of canned food Optimized the mechanism for players to obtain tin cans after consuming canned food, prioritizing their placement in the player's inventory. If the inventory is full, tin cans will fall to the world. My English is not very good, please forgive me. --- .../java/micdoodle8/mods/galacticraft/core/items/ItemFood.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemFood.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemFood.java index e7e4a860b6..3dee55238b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemFood.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemFood.java @@ -169,7 +169,7 @@ public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityLivingBas worldIn.playSound(null, entityLiving.posX, entityLiving.posY, entityLiving.posZ, SoundEvents.ENTITY_PLAYER_BURP, SoundCategory.PLAYERS, 0.5F, worldIn.rand.nextFloat() * 0.1F + 0.9F); if (!worldIn.isRemote && (stack.getItemDamage() < 4 || stack.getItemDamage() == 9)) { - entityLiving.entityDropItem(new ItemStack(GCItems.canister, 1, 0), 0.0F); + ItemHandlerHelper.giveItemToPlayer(player, new ItemStack(GCItems.canister, 1, 0), 0); } stack.shrink(1); return stack;