Skip to content

Commit

Permalink
workaround to avoid game crash caused by "noBucket()" fluids of Regis…
Browse files Browse the repository at this point in the history
…trate mod #45
  • Loading branch information
cech12 committed Aug 29, 2024
1 parent 6f4083b commit 28850a7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.2] - 2024-08-29
### Fixed
- workaround to avoid game crash caused by "noBucket()" fluids of Registrate mod (thanks to PhilTheGreatLOL for the report) #45

## [1.20.1-2.3.4.1] - 2024-06-24
### Fixed
- optimized bucket item model rendering to avoid lags in screens like JEI or EMI (thanks to truskawex for the report) https://github.com/cech12/WoodenBucket/issues/19
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ mixin_version=0.8.5

## Mod Properties
mod_id=bucketlib
mod_version=2.3.4.1
mod_version=2.3.4.2
mod_group_id=cech12.bucketlib
mod_name=BucketLib
mod_authors=Cech12
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cech12/bucketlib/BucketLib.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class BucketLib {
public static RegistryObject<RecipeSerializer<?>> BUCKET_FILLING_SHAPED_RECIPE_SERIALIZER = RECIPE_SERIALIZERS.register("bucket_filling_shaped", () -> BucketFillingShapedRecipe.Serializer.INSTANCE);
public static RegistryObject<RecipeSerializer<?>> BUCKET_FILLING_SHAPELESS_RECIPE_SERIALIZER = RECIPE_SERIALIZERS.register("bucket_filling_shapeless", () -> BucketFillingShapelessRecipe.Serializer.INSTANCE);

private static final Logger LOGGER = LogManager.getLogger();
public static final Logger LOGGER = LogManager.getLogger();

private static final List<UniversalBucketItem> buckets = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cech12.bucketlib.api.item;

import cech12.bucketlib.BucketLib;
import cech12.bucketlib.api.BucketLibTags;
import cech12.bucketlib.config.ServerConfig;
import cech12.bucketlib.item.UniversalBucketFluidHandler;
Expand Down Expand Up @@ -124,7 +125,14 @@ public boolean canHoldFluid(Fluid fluid) {
if (fluid == Fluids.EMPTY) {
return true;
}
Item bucket = fluid.getBucket();
Item bucket;
try {
bucket = fluid.getBucket();
} catch (IllegalArgumentException ex) {
//workaround to avoid game crash caused by getBucket() method of "noBucket" fluids of Registrate (tterrag1098) mod: https://github.com/tterrag1098/Registrate/issues/69
BucketLib.LOGGER.error("IllegalArgumentException occurred while trying to get the bucket item of fluid '" + fluid.getFluidType() + "' [fluid.getBucket()]. BucketLib is not compatible with this fluid. Please contact the mod developer of the mod which adds this fluid!", ex);
return false;
}
if (bucket instanceof MilkBucketItem && fluid != ForgeMod.MILK.get()) {
return false;
}
Expand Down

0 comments on commit 28850a7

Please sign in to comment.