diff --git a/CHANGELOG.md b/CHANGELOG.md index dd55607..de2cd90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Forge Recommended Versioning](https://mcforge.readthedocs.io/en/latest/conventions/versioning/). +## [1.20.1-2.3.4.3] - 2024-09-07 +### Fixed +- buckets could not be stacked after holding fish or axolotl (thanks to Sinhika & Blazified for the report) #46 + ## [1.20.1-2.3.4.2] - 2024-08-29 ### Fixed - workaround to avoid game crash caused by "noBucket()" fluids of Registrate mod (thanks to PhilTheGreatLOL for the report) #45 diff --git a/gradle.properties b/gradle.properties index 0325f13..0bae3ae 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ mixin_version=0.8.5 ## Mod Properties mod_id=bucketlib -mod_version=2.3.4.2 +mod_version=2.3.4.3 mod_group_id=cech12.bucketlib mod_name=BucketLib mod_authors=Cech12 diff --git a/src/main/java/cech12/bucketlib/api/item/UniversalBucketItem.java b/src/main/java/cech12/bucketlib/api/item/UniversalBucketItem.java index cddab2f..ce088e6 100644 --- a/src/main/java/cech12/bucketlib/api/item/UniversalBucketItem.java +++ b/src/main/java/cech12/bucketlib/api/item/UniversalBucketItem.java @@ -276,11 +276,13 @@ public InteractionResultHolder use(@Nonnull Level level, @Nonnull Pla //remove entity to be able to use tryPlaceFluid method FluidActionResult fluidActionResult = FluidUtil.tryPlaceFluid(player, level, interactionHand, pos, BucketLibUtil.removeEntityType(itemstack, false), fluidStack); if (fluidActionResult.isSuccess()) { + ItemStack result = fluidActionResult.getResult(); if (BucketLibUtil.containsEntityType(itemstack)) { //place entity if exists - spawnEntityFromBucket(player, level, itemstack, pos, false); + result = spawnEntityFromBucket(player, level, itemstack, pos, false); + result = BucketLibUtil.removeFluid(result); } - return InteractionResultHolder.sidedSuccess(BucketLibUtil.createEmptyResult(itemstack, player, fluidActionResult.getResult(), interactionHand), level.isClientSide()); + return InteractionResultHolder.sidedSuccess(BucketLibUtil.createEmptyResult(itemstack, player, result, interactionHand), level.isClientSide()); } } } else if (BucketLibUtil.containsEntityType(itemstack)) { @@ -318,6 +320,14 @@ public ItemStack spawnEntityFromBucket(@Nullable Player player, Level level, Ite if (entity instanceof Bucketable bucketable) { bucketable.loadFromBucketTag(itemStack.getOrCreateTag()); bucketable.setFromBucket(true); + //remove entity data + ItemStack tempStack = new ItemStack(itemStack.getItem(), 1); + bucketable.saveToBucketTag(tempStack); + if (tempStack.getTag() != null && itemStack.getTag() != null) { + CompoundTag nbt = itemStack.getTag(); + tempStack.getTag().getAllKeys().forEach(nbt::remove); + itemStack.setTag(nbt); + } } if (player != null) { serverLevel.gameEvent(player, GameEvent.ENTITY_PLACE, pos);