From 834efe59e8d9e0e473e1b37aad56ddfe53df4dfe Mon Sep 17 00:00:00 2001 From: Raycoms Date: Wed, 21 Aug 2024 20:45:32 +0200 Subject: [PATCH] Several fixes for bottles --- .../com/minecolonies/core/items/ItemLargeBottle.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/minecolonies/core/items/ItemLargeBottle.java b/src/main/java/com/minecolonies/core/items/ItemLargeBottle.java index e18968eb5bd..ee6641b7a56 100644 --- a/src/main/java/com/minecolonies/core/items/ItemLargeBottle.java +++ b/src/main/java/com/minecolonies/core/items/ItemLargeBottle.java @@ -12,7 +12,8 @@ import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.animal.Cow; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.*; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.Level; import net.minecraft.world.phys.BlockHitResult; @@ -39,11 +40,11 @@ public ItemLargeBottle(@NotNull final Properties builder) @Override public InteractionResult interactLivingEntity(@NotNull final ItemStack stack, @NotNull final Player player, @NotNull final LivingEntity entity, @NotNull final InteractionHand hand) { - if (entity instanceof Cow && !entity.isBaby()) { + if (entity instanceof Cow && !entity.isBaby()) + { player.playSound(SoundEvents.COW_MILK, 1.0F, 1.0F); + InventoryUtils.addItemStackToItemHandler(new InvWrapper(player.getInventory()), ModItems.large_milk_bottle.getDefaultInstance()); stack.shrink(1); - final ItemStack newStack = ModItems.large_milk_bottle.getDefaultInstance(); - InventoryUtils.addItemStackToItemHandler(new InvWrapper(player.getInventory()), newStack); return InteractionResult.SUCCESS; } return super.interactLivingEntity(stack, player, entity, hand); @@ -68,9 +69,8 @@ public InteractionResultHolder use(@NotNull final Level level, final if (level.getFluidState(blockpos).is(FluidTags.WATER)) { level.playSound(player, player.getX(), player.getY(), player.getZ(), SoundEvents.BOTTLE_FILL, SoundSource.NEUTRAL, 1.0F, 1.0F); + InventoryUtils.addItemStackToItemHandler(new InvWrapper(player.getInventory()), ModItems.large_water_bottle.getDefaultInstance()); itemstack.shrink(1); - final ItemStack newStack = ModItems.large_water_bottle.getDefaultInstance(); - InventoryUtils.addItemStackToItemHandler(new InvWrapper(player.getInventory()), newStack); return InteractionResultHolder.success(itemstack); } }