Skip to content

Commit

Permalink
Fixed Fabric and Forge Registry
Browse files Browse the repository at this point in the history
  • Loading branch information
MeAlam1 committed Nov 4, 2024
1 parent 778e4c2 commit 92cb7ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.EntityType;
import software.bluelib.BlueLibConstants;
Expand Down Expand Up @@ -47,13 +49,13 @@ public static void initializeEntities() {
ResourceLocation.fromNamespaceAndPath(BlueLibConstants.MOD_ID, "example_one"),
EntityType.Builder.of(DragonEntity::new, CREATURE)
.sized(0.6F, 1.8F)
.build("example_one"));
.build(ResourceKey.create(Registries.ENTITY_TYPE, ResourceLocation.fromNamespaceAndPath(BlueLibConstants.MOD_ID, "example_one"))));

EXAMPLE_TWO = Registry.register(
BuiltInRegistries.ENTITY_TYPE,
ResourceLocation.fromNamespaceAndPath(BlueLibConstants.MOD_ID, "example_two"),
EntityType.Builder.of(RexEntity::new, CREATURE)
.sized(0.6F, 1.8F)
.build("example_two"));
.build(ResourceKey.create(Registries.ENTITY_TYPE, ResourceLocation.fromNamespaceAndPath(BlueLibConstants.MOD_ID, "example_two"))));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

package software.bluelib.example.init;

import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory;
Expand Down Expand Up @@ -43,8 +44,7 @@ public class ModEntities {
.setUpdateInterval(3)
.fireImmune()
.sized(0.6f, 1.8f)
.build(ResourceLocation.fromNamespaceAndPath(BlueLibConstants.MOD_ID, "dragon").toString()));

.build(ResourceKey.create(ForgeRegistries.Keys.ENTITY_TYPES, ResourceLocation.fromNamespaceAndPath(BlueLibConstants.MOD_ID, "dragon"))));
/**
* A {@code public static final} {@link RegistryObject} of {@link EntityType} for the {@link RexEntity}.
*
Expand All @@ -57,7 +57,7 @@ public class ModEntities {
.setUpdateInterval(3)
.fireImmune()
.sized(0.6f, 1.8f)
.build(ResourceLocation.fromNamespaceAndPath(BlueLibConstants.MOD_ID, "rex").toString()));
.build(ResourceKey.create(ForgeRegistries.Keys.ENTITY_TYPES, ResourceLocation.fromNamespaceAndPath(BlueLibConstants.MOD_ID, "rex"))));

/**
* A {@code public static} method to register the {@link EntityType} for this mod.
Expand Down

0 comments on commit 92cb7ec

Please sign in to comment.