Skip to content

Commit

Permalink
fix hopper bucket crash while filling buckets
Browse files Browse the repository at this point in the history
  • Loading branch information
CursedFlames committed Jul 15, 2023
1 parent d52f122 commit 1feecdf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions HopperBucket/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
### v1.20.X-1.0.1
* Fix filling buckets when there are empty buckets in multiple slots at once

### v1.20.X-1.0.0
* Initial release
### v1.20.X-1.0.2
* Fix crash when attempting to fill a bucket with all slots full and no single-item bucket stack
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ private static void onSuckInItems(Level level, Hopper hopper, CallbackInfoReturn
if (!hopper.hasAnyOf(Collections.singleton(Items.BUCKET))) return;
var emptySlotIndex = getFirstEmptySlot(hopper);
var bucketStackIndex = emptySlotIndex == -1 ? getFirstStackOfSizeOneIndex(hopper, Items.BUCKET) : getFirstStackIndex(hopper, Items.BUCKET);
if (bucketStackIndex == -1) return;
var bucketStack = hopper.getItem(bucketStackIndex);
if (bucketStack.getCount() > 1 && emptySlotIndex == -1) return;

var pos = BlockPos.containing(hopper.getLevelX(), hopper.getLevelY() + 1.0, hopper.getLevelZ());
var blockState = level.getBlockState(pos);
Expand Down
2 changes: 1 addition & 1 deletion HopperBucket/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ group=cursedflames.hopperbucket
# Note: still needs to be added manually in some places rather than relying on automatic replacement
mod_id=hopperbucket
# The mod version. See https://semver.org/
mod_version=1.0.1
mod_version=1.0.2
# The human-readable display name for the mod.
mod_name=Hopper Bucket
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
Expand Down

0 comments on commit 1feecdf

Please sign in to comment.