Skip to content

Commit

Permalink
fixed: MobBucketItems with non-bucketable entities were added to crea…
Browse files Browse the repository at this point in the history
…tive menu
  • Loading branch information
cech12 committed Nov 4, 2023
1 parent 07f5b28 commit 48d0fc2
Show file tree
Hide file tree
Showing 3 changed files with 8 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.20.1-2.3.0.3] - 2023-11-04
### Fixed
- MobBucketItems with non-bucketable entities were added to creative menu (found in Naturalist mod 4.0)

## [1.20.1-2.3.0.2] - 2023-10-30
### Fixed
- Milk string was not translated correctly https://github.com/cech12/CeramicBucket/issues/74
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.0.2
mod_version=2.3.0.3
mod_group_id=cech12.bucketlib
mod_name=BucketLib
mod_authors=Cech12
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/cech12/bucketlib/util/RegistryUtil.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package cech12.bucketlib.util;

import net.minecraft.client.Minecraft;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.animal.Bucketable;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.MobBucketItem;
import net.minecraft.world.item.SolidBucketItem;
Expand Down Expand Up @@ -32,7 +34,7 @@ private static void readRegistry() {
Method method = MobBucketItem.class.getDeclaredMethod("getFishType");
method.setAccessible(true);
EntityType<?> entityType = (EntityType<?>) method.invoke(bucket);
if (entityType != null) {
if (entityType != null && Minecraft.getInstance().level != null && entityType.create(Minecraft.getInstance().level) instanceof Bucketable) {
bucketEntities.add(new BucketEntity(entityType, bucket.getFluid(), bucket));
}
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ignored) {}
Expand Down

0 comments on commit 48d0fc2

Please sign in to comment.