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 84f2e61 commit 025aefb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 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.21-4.1.0.1] - 2024-08-29
### Fixed
- workaround to avoid game crash caused by "noBucket()" fluids of Registrate mod (thanks to PhilTheGreatLOL for the report) #45

## [1.21-4.1.0.0] - 2024-07-14
### Changed
- updated NeoForge to 21.0.94-beta
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package de.cech12.bucketlib.api.item;

import de.cech12.bucketlib.api.BucketLib;
import de.cech12.bucketlib.platform.Services;
import de.cech12.bucketlib.util.BucketLibUtil;
import de.cech12.bucketlib.util.ItemStackUtil;
Expand Down Expand Up @@ -107,7 +108,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.LOG.error("IllegalArgumentException occurred while trying to get the bucket item of fluid '" + Services.FLUID.getFluidDescription(fluid) + "' [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 != Services.FLUID.getMilkFluid()) {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Project
group=de.cech12.bucketlib
mod_version=4.1.0.0
mod_version=4.1.0.1
mod_id=bucketlib
mod_name=BucketLib
mod_author=Cech12
Expand Down

0 comments on commit 025aefb

Please sign in to comment.