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 0c8de32 commit 8647182
Show file tree
Hide file tree
Showing 3 changed files with 19 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.4-3.2.1.4] - 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.4-3.2.1.3] - 2024-08-03
### Fixed
- fixed some issues with the FluidStorage interaction to be more compatible with other mods (Fabric/Quilt)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
package de.cech12.bucketlib.api.item;

import de.cech12.bucketlib.api.BucketLib;
import de.cech12.bucketlib.platform.Services;
import de.cech12.bucketlib.util.*;
import de.cech12.bucketlib.util.BucketLibUtil;
import de.cech12.bucketlib.util.ColorUtil;
import de.cech12.bucketlib.util.ItemStackUtil;
import de.cech12.bucketlib.util.RegistryUtil;
import de.cech12.bucketlib.util.WorldInteractionUtil;
import net.minecraft.advancements.CriteriaTriggers;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
Expand Down Expand Up @@ -105,7 +110,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=3.2.1.3
mod_version=3.2.1.4
mod_id=bucketlib
mod_name=BucketLib
mod_author=Cech12
Expand Down

0 comments on commit 8647182

Please sign in to comment.