Skip to content

Commit

Permalink
fixed: dedicated servers could not start with version 1.20.1-2.3.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
cech12 committed Nov 4, 2023
1 parent 48d0fc2 commit 3f71530
Show file tree
Hide file tree
Showing 3 changed files with 7 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.0.4] - 2023-11-04
### Fixed
- dedicated servers could not start with version 1.20.1-2.3.0.3

## [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)
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.3
mod_version=2.3.0.4
mod_group_id=cech12.bucketlib
mod_name=BucketLib
mod_authors=Cech12
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/cech12/bucketlib/util/RegistryUtil.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
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;
Expand All @@ -9,6 +8,7 @@
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.material.Fluid;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.server.ServerLifecycleHooks;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
Expand All @@ -34,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 && Minecraft.getInstance().level != null && entityType.create(Minecraft.getInstance().level) instanceof Bucketable) {
if (entityType != null && entityType.create(ServerLifecycleHooks.getCurrentServer().overworld()) instanceof Bucketable) {
bucketEntities.add(new BucketEntity(entityType, bucket.getFluid(), bucket));
}
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ignored) {}
Expand Down

0 comments on commit 3f71530

Please sign in to comment.