Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Registering Entities (1.16.5)


Recommended Posts

4 minutes ago, diesieben07 said:

You already created an EntityType in your previous code.

Then I suppose im still a little confused, I've typed it out a few different ways and it always comes back with an error

 

public static EntityType<EntityChocolateSlime> CHOCOLATE_SLIME = ENTITIES.register("chocolate_slime", ()->
            new EntityType.Builder(EntityChocolateSlime::new, EntityClassification.MONSTER).size(2.04F,2.04F).trackingRange(8));

This is what I keep coming back to though, however EntityType.Builder errors out.

 

Link to post
Share on other sites
public static final EntityType<EntityChocolateSlime> CHOCOLATE_SLIME = ENTITIES.register(EntityNames.CHOCOLATE_SLIME,()-> EntityChocolateSlime::new, 
            EntityClassification.MONSTER, 2.04F, 2.04F);

Like this?

Link to post
Share on other sites

I think what you are missing is the actual function to build your entity type. Just add .build() and it should be fine. Also dont use static initializers as @diesieben07 already said. Use RegistryObjects instead.

4 hours ago, tal124 said:

Then I suppose im still a little confused, I've typed it out a few different ways and it always comes back with an error

 


public static EntityType<EntityChocolateSlime> CHOCOLATE_SLIME = ENTITIES.register("chocolate_slime", ()->
            new EntityType.Builder(EntityChocolateSlime::new, EntityClassification.MONSTER).size(2.04F,2.04F).trackingRange(8));

This is what I keep coming back to though, however EntityType.Builder errors out.

 

 

 

Here is an example of how i register entity types:

public static RegistryObject<EntityType<EntityItemUpgradable>> ENTITY_UPGRADABLE = ALL.register("upgradable_type",
        () -> EntityType.Builder.<EntityItemUpgradable>create(EntityItemUpgradable::new, EntityClassification.MISC)
                .build(new ResourceLocation(Main.MODID, "upgradable_type").toString()));
Link to post
Share on other sites
Posted (edited)
3 hours ago, DietmarKracht said:

I think what you are missing is the actual function to build your entity type. Just add .build() and it should be fine. Also dont use static initializers as @diesieben07 already said. Use RegistryObjects instead.

 

 

Here is an example of how i register entity types:


public static RegistryObject<EntityType<EntityItemUpgradable>> ENTITY_UPGRADABLE = ALL.register("upgradable_type",
        () -> EntityType.Builder.<EntityItemUpgradable>create(EntityItemUpgradable::new, EntityClassification.MISC)
                .build(new ResourceLocation(Main.MODID, "upgradable_type").toString()));

Thank you for the sample but now its simply saying my registry object isn't present, the code pushes out, but it says NullPointerException: Registry Object not present: chocolate:chocolate_slime

Edited by tal124
Link to post
Share on other sites
---- Minecraft Crash Report ----
// Shall we play a game?

Time: 3/16/21 3:30 PM
Description: Mod loading error has occurred

java.lang.Exception: Mod Loading has failed
	at net.minecraftforge.fml.CrashReportExtender.dumpModLoadingCrashReport(CrashReportExtender.java:85) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraftforge.fml.client.ClientModLoader.completeModLoading(ClientModLoader.java:188) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.lambda$null$1(Minecraft.java:513) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.util.Util.acceptOrElse(Util.java:323) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraft.client.Minecraft.lambda$new$2(Minecraft.java:509) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.ResourceLoadProgressGui.render(ResourceLoadProgressGui.java:113) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.GameRenderer.updateCameraAndRender(GameRenderer.java:493) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1002) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.run(Minecraft.java:612) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:184) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_282] {}
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_282] {}
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_282] {}
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_282] {}
	at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:52) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.9.jar:?] {}
	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:105) [forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {}


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Render thread
Stacktrace:
	at java.util.Objects.requireNonNull(Objects.java:290) ~[?:1.8.0_282] {}
-- MOD chocolate --
Details:
	Caused by 0: java.lang.ExceptionInInitializerError
		at tyrannus.chocolate.setup.ModBlocks.register(ModBlocks.java:102) ~[?:?] {re:classloading}
		at tyrannus.chocolate.setup.ModBlocks.register(ModBlocks.java:95) ~[?:?] {re:classloading}
		at tyrannus.chocolate.setup.ModBlocks.<clinit>(ModBlocks.java:77) ~[?:?] {re:classloading}
		at tyrannus.chocolate.chocolate.<init>(chocolate.java:42) ~[?:?] {re:classloading}
		at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_282] {}
		at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_282] {}
		at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_282] {}
		at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_282] {}
		at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_282] {}
		at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:81) ~[forge:36.0] {re:classloading}
		at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:120) ~[forge:?] {re:classloading}
		at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1640) ~[?:1.8.0_282] {}
		at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1632) ~[?:1.8.0_282] {}
		at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) ~[?:1.8.0_282] {}
		at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) ~[?:1.8.0_282] {}
		at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) ~[?:1.8.0_282] {}
		at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175) ~[?:1.8.0_282] {}

	Mod File: main
	Failure message: Chocolate (chocolate) has failed to load correctly
		java.lang.ExceptionInInitializerError: null
	Mod Version: NONE
	Mod Issue URL: NOT PROVIDED
	Exception message: java.lang.NullPointerException: Registry Object not present: chocolate:chocolate_slime
Stacktrace:
	at java.util.Objects.requireNonNull(Objects.java:290) ~[?:1.8.0_282] {}
	at net.minecraftforge.fml.RegistryObject.get(RegistryObject.java:120) ~[forge:?] {re:classloading}
	at tyrannus.chocolate.setup.ModItems.<clinit>(ModItems.java:106) ~[?:?] {re:classloading}
	at tyrannus.chocolate.setup.ModBlocks.register(ModBlocks.java:102) ~[?:?] {re:classloading}
	at tyrannus.chocolate.setup.ModBlocks.register(ModBlocks.java:95) ~[?:?] {re:classloading}
	at tyrannus.chocolate.setup.ModBlocks.<clinit>(ModBlocks.java:77) ~[?:?] {re:classloading}
	at tyrannus.chocolate.chocolate.<init>(chocolate.java:42) ~[?:?] {re:classloading}
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_282] {}
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_282] {}
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_282] {}
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_282] {}
	at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_282] {}
	at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:81) ~[forge:36.0] {re:classloading}
	at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:120) ~[forge:?] {re:classloading}
	at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1640) ~[?:1.8.0_282] {}
	at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1632) ~[?:1.8.0_282] {}
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) ~[?:1.8.0_282] {}
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) ~[?:1.8.0_282] {}
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) ~[?:1.8.0_282] {}
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175) ~[?:1.8.0_282] {}


-- System Details --
Details:
	Minecraft Version: 1.16.5
	Minecraft Version ID: 1.16.5
	Operating System: Windows 10 (amd64) version 10.0
	Java Version: 1.8.0_282, Amazon.com Inc.
	Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), Amazon.com Inc.
	Memory: 1666800792 bytes (1589 MB) / 3224371200 bytes (3075 MB) up to 7618953216 bytes (7266 MB)
	CPUs: 24
	JVM Flags: 1 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump
	ModLauncher: 8.0.9+86+master.3cf110c
	ModLauncher launch target: fmluserdevclient
	ModLauncher naming: mcp
	ModLauncher services: 
		/mixin-0.8.2.jar mixin PLUGINSERVICE 
		/eventbus-4.0.0.jar eventbus PLUGINSERVICE 
		/forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-launcher.jar object_holder_definalize PLUGINSERVICE 
		/forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-launcher.jar runtime_enum_extender PLUGINSERVICE 
		/accesstransformers-3.0.1.jar accesstransformer PLUGINSERVICE 
		/forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-launcher.jar capability_inject_definalize PLUGINSERVICE 
		/forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-launcher.jar runtimedistcleaner PLUGINSERVICE 
		/mixin-0.8.2.jar mixin TRANSFORMATIONSERVICE 
		/forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-launcher.jar fml TRANSFORMATIONSERVICE 
	FML: 36.0
	Forge: net.minecraftforge:36.0.48
	FML Language Providers: 
		javafml@36.0
		minecraft@1
	Mod List: 
		client-extra.jar                                  |Minecraft                     |minecraft                     |1.16.5              |CREATE_REG|a1:d4:5e:04:4f:d3:d6:e0:7b:37:97:cf:77:b0:de:ad:4a:47:ce:8c:96:49:5f:0a:cf:8c:ae:b2:6d:4b:8a:3f
		forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16|Forge                         |forge                         |36.0.48             |CREATE_REG|NOSIGNATURE
		main                                              |Chocolate                     |chocolate                     |NONE                |ERROR     |NOSIGNATURE
	Crash Report UUID: 4fa0efb2-03a8-4530-857c-52cd156f3c41

 

Link to post
Share on other sites

I swapped them and got this again

---- Minecraft Crash Report ----
// Shall we play a game?

Time: 3/16/21 4:14 PM
Description: Mod loading error has occurred

java.lang.Exception: Mod Loading has failed
	at net.minecraftforge.fml.CrashReportExtender.dumpModLoadingCrashReport(CrashReportExtender.java:85) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraftforge.fml.client.ClientModLoader.completeModLoading(ClientModLoader.java:188) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.lambda$null$1(Minecraft.java:513) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.util.Util.acceptOrElse(Util.java:323) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraft.client.Minecraft.lambda$new$2(Minecraft.java:509) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.ResourceLoadProgressGui.render(ResourceLoadProgressGui.java:113) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.GameRenderer.updateCameraAndRender(GameRenderer.java:493) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1002) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.run(Minecraft.java:612) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:184) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_282] {}
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_282] {}
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_282] {}
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_282] {}
	at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:52) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.9.jar:?] {}
	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:105) [forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {}


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Render thread
Stacktrace:
	at java.util.Objects.requireNonNull(Objects.java:290) ~[?:1.8.0_282] {}
-- MOD chocolate --
Details:
	Caused by 0: java.lang.ExceptionInInitializerError
		at tyrannus.chocolate.setup.ModBlocks.register(ModBlocks.java:102) ~[?:?] {re:classloading}
		at tyrannus.chocolate.setup.ModBlocks.register(ModBlocks.java:95) ~[?:?] {re:classloading}
		at tyrannus.chocolate.setup.ModBlocks.<clinit>(ModBlocks.java:77) ~[?:?] {re:classloading}
		at tyrannus.chocolate.chocolate.<init>(chocolate.java:42) ~[?:?] {re:classloading}
		at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_282] {}
		at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_282] {}
		at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_282] {}
		at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_282] {}
		at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_282] {}
		at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:81) ~[forge:36.0] {re:classloading}
		at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:120) ~[forge:?] {re:classloading}
		at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1640) ~[?:1.8.0_282] {}
		at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1632) ~[?:1.8.0_282] {}
		at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) ~[?:1.8.0_282] {}
		at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) ~[?:1.8.0_282] {}
		at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) ~[?:1.8.0_282] {}
		at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175) ~[?:1.8.0_282] {}

	Mod File: main
	Failure message: Chocolate (chocolate) has failed to load correctly
		java.lang.ExceptionInInitializerError: null
	Mod Version: NONE
	Mod Issue URL: NOT PROVIDED
	Exception message: java.lang.NullPointerException: Registry Object not present: chocolate:chocolate_slime
Stacktrace:
	at java.util.Objects.requireNonNull(Objects.java:290) ~[?:1.8.0_282] {}
	at net.minecraftforge.fml.RegistryObject.get(RegistryObject.java:120) ~[forge:?] {re:classloading}
	at tyrannus.chocolate.setup.ModItems.<clinit>(ModItems.java:106) ~[?:?] {re:classloading}
	at tyrannus.chocolate.setup.ModBlocks.register(ModBlocks.java:102) ~[?:?] {re:classloading}
	at tyrannus.chocolate.setup.ModBlocks.register(ModBlocks.java:95) ~[?:?] {re:classloading}
	at tyrannus.chocolate.setup.ModBlocks.<clinit>(ModBlocks.java:77) ~[?:?] {re:classloading}
	at tyrannus.chocolate.chocolate.<init>(chocolate.java:42) ~[?:?] {re:classloading}
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_282] {}
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_282] {}
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_282] {}
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_282] {}
	at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_282] {}
	at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:81) ~[forge:36.0] {re:classloading}
	at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:120) ~[forge:?] {re:classloading}
	at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1640) ~[?:1.8.0_282] {}
	at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1632) ~[?:1.8.0_282] {}
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) ~[?:1.8.0_282] {}
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) ~[?:1.8.0_282] {}
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) ~[?:1.8.0_282] {}
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175) ~[?:1.8.0_282] {}


-- System Details --
Details:
	Minecraft Version: 1.16.5
	Minecraft Version ID: 1.16.5
	Operating System: Windows 10 (amd64) version 10.0
	Java Version: 1.8.0_282, Amazon.com Inc.
	Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), Amazon.com Inc.
	Memory: 2733412320 bytes (2606 MB) / 3161456640 bytes (3015 MB) up to 7618953216 bytes (7266 MB)
	CPUs: 24
	JVM Flags: 1 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump
	ModLauncher: 8.0.9+86+master.3cf110c
	ModLauncher launch target: fmluserdevclient
	ModLauncher naming: mcp
	ModLauncher services: 
		/mixin-0.8.2.jar mixin PLUGINSERVICE 
		/eventbus-4.0.0.jar eventbus PLUGINSERVICE 
		/forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-launcher.jar object_holder_definalize PLUGINSERVICE 
		/forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-launcher.jar runtime_enum_extender PLUGINSERVICE 
		/accesstransformers-3.0.1.jar accesstransformer PLUGINSERVICE 
		/forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-launcher.jar capability_inject_definalize PLUGINSERVICE 
		/forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-launcher.jar runtimedistcleaner PLUGINSERVICE 
		/mixin-0.8.2.jar mixin TRANSFORMATIONSERVICE 
		/forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-launcher.jar fml TRANSFORMATIONSERVICE 
	FML: 36.0
	Forge: net.minecraftforge:36.0.48
	FML Language Providers: 
		javafml@36.0
		minecraft@1
	Mod List: 
		client-extra.jar                                  |Minecraft                     |minecraft                     |1.16.5              |CREATE_REG|a1:d4:5e:04:4f:d3:d6:e0:7b:37:97:cf:77:b0:de:ad:4a:47:ce:8c:96:49:5f:0a:cf:8c:ae:b2:6d:4b:8a:3f
		forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16|Forge                         |forge                         |36.0.48             |CREATE_REG|NOSIGNATURE
		main                                              |Chocolate                     |chocolate                     |NONE                |ERROR     |NOSIGNATURE
	Crash Report UUID: dc6a8c1b-2ae6-49b9-b271-ed348743358a

 

Link to post
Share on other sites

I don't think regular spawn eggs work with deferred register. The item registration happens before entities so when registering the spawn egg the entity registry object is no present.

Try taking out the spawn egg code and it should work fine. 

 

Here is an additional thread on registering entities with deferred register. It also goes over what needs to be done to make spawn eggs work. It is for 1.15.1 but should work pretty well with 1.16.5 as well.

 

 

 

 

  • Thanks 1
Link to post
Share on other sites
Link to post
Share on other sites
22 hours ago, Beethoven92 said:

They've replaced .put for something idk what but its deprecated now, and now my entity registers but it won't summon

summon.PNG

Link to post
Share on other sites
public class EntityChocolateSlime extends SlimeEntity {
    public EntityChocolateSlime(EntityType<? extends EntityChocolateSlime> type, World worldIn) {
        super(type, worldIn);
    }


    public static AttributeModifierMap.MutableAttribute func_234294_m_() {
        return MonsterEntity.func_234295_eP_().createMutableAttribute(Attributes.MOVEMENT_SPEED, (double)0.2F);
    }
    public static boolean func_223367_b(EntityType<EntityChocolateSlime> p_223367_0_, IWorld p_223367_1_, SpawnReason p_223367_2_, BlockPos p_223367_3_, Random p_223367_4_) {
        return p_223367_1_.getDifficulty() != Difficulty.PEACEFUL;
    }

    public boolean isNotColliding(IWorldReader worldIn) {
        return worldIn.checkNoEntityCollision(this) && !worldIn.containsAnyLiquid(this.getBoundingBox());
    }
    public EntityType<? extends EntityChocolateSlime> getType() {
        return (EntityType<? extends EntityChocolateSlime>)super.getType();
    }

    protected void setSlimeSize(int size, boolean resetHealth) {
        super.setSlimeSize(size, resetHealth);
        this.getAttribute(Attributes.ARMOR).setBaseValue((double)(size * 3));
    }
    protected int getJumpDelay() {
        return super.getJumpDelay() * 4;
    }

    protected void alterSquishAmount() {
        this.squishAmount *= 0.9F;
    }

    protected void jump() {
        Vector3d vector3d = this.getMotion();
        this.setMotion(vector3d.x, (double)(this.getJumpUpwardsMotion() + (float)this.getSlimeSize() * 0.1F), vector3d.z);
        this.isAirBorne = true;
        net.minecraftforge.common.ForgeHooks.onLivingJump(this);
    }
    protected void handleFluidJump(ITag<Fluid> fluidTag) {
        if (fluidTag == FluidTags.LAVA) {
            Vector3d vector3d = this.getMotion();
            this.setMotion(vector3d.x, (double)(0.22F + (float)this.getSlimeSize() * 0.05F), vector3d.z);
            this.isAirBorne = true;
        } else {
            super.handleFluidJump(fluidTag);
        }

    }
    protected boolean canDamagePlayer() {
        return this.isServerWorld();
    }

    protected float func_225512_er_() {
        return super.func_225512_er_() + 2.0F;
    }

    protected SoundEvent getHurtSound(DamageSource damageSourceIn) {
        return this.isSmallSlime() ? SoundEvents.ENTITY_MAGMA_CUBE_HURT_SMALL : SoundEvents.ENTITY_SLIME_HURT;
    }

    protected SoundEvent getDeathSound() {
        return this.isSmallSlime() ? SoundEvents.ENTITY_SLIME_DEATH_SMALL : SoundEvents.ENTITY_SLIME_DEATH;
    }

    protected SoundEvent getSquishSound() {
        return this.isSmallSlime() ? SoundEvents.ENTITY_SLIME_SQUISH_SMALL : SoundEvents.ENTITY_SLIME_SQUISH;
    }

    protected SoundEvent getJumpSound() {
        return SoundEvents.ENTITY_SLIME_JUMP;
    }
}

My ModSlime code

public class ModEntities {

    public static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITIES, chocolate.MODID);

    //Attaches the deferred register to the event bus
    public static void init() {
        ENTITIES.register(FMLJavaModLoadingContext.get().getModEventBus());
    }

    public static final String CHOCOLATE_SLIME_NAME = "chocolate_slime";
    public static final RegistryObject<EntityType<EntityChocolateSlime>> CHOCOLATE_SLIME = ENTITIES.register(CHOCOLATE_SLIME_NAME, () ->
            EntityType.Builder.<EntityChocolateSlime>create(EntityChocolateSlime::new, EntityClassification.MONSTER)
                    .size(EntityType.SLIME.getWidth(), EntityType.SLIME.getHeight())
                    .build(new ResourceLocation(chocolate.MODID, CHOCOLATE_SLIME_NAME).toString())
    );



}

My Entity Registry code

 

[00:02:48] [Server thread/WARN] [minecraft/EntityType]: Exception loading entity: 
java.lang.NullPointerException: null
	at net.minecraft.entity.ai.attributes.AttributeModifierManager.getAttributeValue(AttributeModifierManager.java:67) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraft.entity.LivingEntity.getAttributeValue(LivingEntity.java:1849) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraft.entity.LivingEntity.getMaxHealth(LivingEntity.java:1610) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraft.entity.LivingEntity.<init>(LivingEntity.java:209) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraft.entity.MobEntity.<init>(MobEntity.java:108) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.entity.monster.SlimeEntity.<init>(SlimeEntity.java:56) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at tyrannus.chocolate.init.entities.EntityChocolateSlime.<init>(EntityChocolateSlime.java:26) ~[main/:?] {re:classloading}
	at net.minecraft.entity.EntityType.create(EntityType.java:448) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraft.entity.EntityType.lambda$loadEntityUnchecked$1(EntityType.java:459) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at java.util.Optional.map(Optional.java:215) ~[?:1.8.0_282] {}
	at net.minecraft.entity.EntityType.loadEntityUnchecked(EntityType.java:458) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraft.entity.EntityType.loadEntity(EntityType.java:516) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraft.entity.EntityType.loadEntityAndExecute(EntityType.java:498) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraft.command.impl.SummonCommand.summonEntity(SummonCommand.java:50) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraft.command.impl.SummonCommand.lambda$register$1(SummonCommand.java:34) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:262) ~[brigadier-1.0.17.jar:?] {re:classloading}
	at net.minecraft.command.Commands.handleCommand(Commands.java:222) ~[forge:?] {re:classloading}
	at net.minecraft.network.play.ServerPlayNetHandler.handleSlashCommand(ServerPlayNetHandler.java:1162) ~[forge:?] {re:classloading}
	at net.minecraft.network.play.ServerPlayNetHandler.func_244548_c(ServerPlayNetHandler.java:1142) ~[forge:?] {re:classloading}
	at net.minecraft.network.play.ServerPlayNetHandler.processChatMessage(ServerPlayNetHandler.java:1121) ~[forge:?] {re:classloading}
	at net.minecraft.network.play.client.CChatMessagePacket.processPacket(CChatMessagePacket.java:40) ~[forge:?] {re:classloading}
	at net.minecraft.network.play.client.CChatMessagePacket.processPacket(CChatMessagePacket.java:8) ~[forge:?] {re:classloading}
	at net.minecraft.network.PacketThreadUtil.lambda$checkThreadAndEnqueue$0(PacketThreadUtil.java:19) ~[forge:?] {re:classloading}
	at net.minecraft.util.concurrent.TickDelayedTask.run(TickDelayedTask.java:20) ~[forge:?] {re:classloading}
	at net.minecraft.util.concurrent.ThreadTaskExecutor.run(ThreadTaskExecutor.java:139) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.util.concurrent.RecursiveEventLoop.run(RecursiveEventLoop.java:22) ~[forge:?] {re:classloading}
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:759) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:159) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.util.concurrent.ThreadTaskExecutor.driveOne(ThreadTaskExecutor.java:109) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.driveOneInternal(MinecraftServer.java:742) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.driveOne(MinecraftServer.java:736) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.util.concurrent.ThreadTaskExecutor.driveUntil(ThreadTaskExecutor.java:122) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.runScheduledTasks(MinecraftServer.java:722) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:668) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.lambda$startServer$0(MinecraftServer.java:233) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_282] {}
[00:02:48] [Render thread/INFO] [minecraft/NewChatGui]: [CHAT] Unable to summon entity

My error code that happens when I try to summon the entity

Link to post
Share on other sites

I'm still a little confused, so I have to register it in my ModEntities like so

 

 public static void EntityAttributeCreationEvent() {
        GlobalEntityTypeAttributes.getAttributesForEntity(ModEntities.CHOCOLATE_SLIME.get());
    }

and then also put it into my setup like this

 

private void setup(final FMLCommonSetupEvent event) {
        // some preinit code
        LOGGER.info("The Pre-Chocoinator");
        LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName());

        ModEntities.EntityAttributeCreationEvent();
    }

And then also have some attributes in my Entity class, and this is where I get a bit confused because I just borrowed what you had just to see if it would summon/spawn

public MutableAttribute MutableAttribute()
    {
        return LivingEntity.registerAttributes().createMutableAttribute(Attributes.MAX_HEALTH, 2.0).
                createMutableAttribute(Attributes.FOLLOW_RANGE, 16.0).
                createMutableAttribute(Attributes.MOVEMENT_SPEED, 0.75);
    }

And I'm still getting an error when I try to summon it.

[07:42:47] [Server thread/WARN] [minecraft/EntityType]: Exception loading entity: 
java.lang.NullPointerException: null
	at net.minecraft.entity.ai.attributes.AttributeModifierManager.getAttributeValue(AttributeModifierManager.java:67) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraft.entity.LivingEntity.getAttributeValue(LivingEntity.java:1849) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraft.entity.LivingEntity.getMaxHealth(LivingEntity.java:1610) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraft.entity.LivingEntity.<init>(LivingEntity.java:209) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraft.entity.MobEntity.<init>(MobEntity.java:108) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.entity.monster.SlimeEntity.<init>(SlimeEntity.java:56) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at tyrannus.chocolate.init.entities.EntityChocolateSlime.<init>(EntityChocolateSlime.java:38) ~[main/:?] {re:classloading}
	at net.minecraft.entity.EntityType.create(EntityType.java:448) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraft.entity.EntityType.lambda$loadEntityUnchecked$1(EntityType.java:459) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at java.util.Optional.map(Optional.java:215) ~[?:1.8.0_282] {}
	at net.minecraft.entity.EntityType.loadEntityUnchecked(EntityType.java:458) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraft.entity.EntityType.loadEntity(EntityType.java:516) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraft.entity.EntityType.loadEntityAndExecute(EntityType.java:498) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraft.command.impl.SummonCommand.summonEntity(SummonCommand.java:50) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraft.command.impl.SummonCommand.lambda$register$1(SummonCommand.java:34) ~[forge-1.16.5-36.0.48_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:262) ~[brigadier-1.0.17.jar:?] {re:classloading}
	at net.minecraft.command.Commands.handleCommand(Commands.java:222) ~[forge:?] {re:classloading}
	at net.minecraft.network.play.ServerPlayNetHandler.handleSlashCommand(ServerPlayNetHandler.java:1162) ~[forge:?] {re:classloading}
	at net.minecraft.network.play.ServerPlayNetHandler.func_244548_c(ServerPlayNetHandler.java:1142) ~[forge:?] {re:classloading}
	at net.minecraft.network.play.ServerPlayNetHandler.processChatMessage(ServerPlayNetHandler.java:1121) ~[forge:?] {re:classloading}
	at net.minecraft.network.play.client.CChatMessagePacket.processPacket(CChatMessagePacket.java:40) ~[forge:?] {re:classloading}
	at net.minecraft.network.play.client.CChatMessagePacket.processPacket(CChatMessagePacket.java:8) ~[forge:?] {re:classloading}
	at net.minecraft.network.PacketThreadUtil.lambda$checkThreadAndEnqueue$0(PacketThreadUtil.java:19) ~[forge:?] {re:classloading}
	at net.minecraft.util.concurrent.TickDelayedTask.run(TickDelayedTask.java:20) ~[forge:?] {re:classloading}
	at net.minecraft.util.concurrent.ThreadTaskExecutor.run(ThreadTaskExecutor.java:139) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.util.concurrent.RecursiveEventLoop.run(RecursiveEventLoop.java:22) ~[forge:?] {re:classloading}
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:759) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:159) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.util.concurrent.ThreadTaskExecutor.driveOne(ThreadTaskExecutor.java:109) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.driveOneInternal(MinecraftServer.java:742) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.driveOne(MinecraftServer.java:736) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.util.concurrent.ThreadTaskExecutor.drainTasks(ThreadTaskExecutor.java:97) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.runScheduledTasks(MinecraftServer.java:721) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:668) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.lambda$startServer$0(MinecraftServer.java:233) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_282] {}

 

Link to post
Share on other sites
16 minutes ago, tal124 said:

I'm still a little confused, so I have to register it in my ModEntities like so

That is not what you were told to do. You need to handle EntityAttributeCreationEvent, not FMLCommonSetupEvent.

Calling your method "EntityAttributeCreationEvent" makes no sense.

 

Your "registration" also doesn't register anything. It just gets the attributes for your entity, which will still be null at this point, again because you didn't actually register anything.

 

The "MutableAttribute" method (why did you call it that?!) also does nothing, because you never call it.

Link to post
Share on other sites
Posted (edited)
6 hours ago, diesieben07 said:

That is not what you were told to do. You need to handle EntityAttributeCreationEvent, not FMLCommonSetupEvent.

Calling your method "EntityAttributeCreationEvent" makes no sense.

 

Your "registration" also doesn't register anything. It just gets the attributes for your entity, which will still be null at this point, again because you didn't actually register anything.

 

The "MutableAttribute" method (why did you call it that?!) also does nothing, because you never call it.

I apologize the previous two comments had me a little confused about what to do, and I called it MutableAttribute because any other attribute would say it needs to be called that, but I realize that its probably because I had muteableAttribute being called inside it.

Edited by tal124
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • I may have simply needed to update the import. Sorry about that.
    • I'm using forge-1.17.1-37.0.15-mdk, and the empty project starts without any problems. I have no idea where the problem lies.
    • It happens with Language Support for Java. Because of this error, my code will not be able to resolve the reference. Please help me. Error Messages: ---------------------------------- [Warn  - 9:37:53] 2021/08/01 9:37:53 While loading class "org.eclipse.buildship.core.internal.util.gradle.PublishedGradleVersions$LookupStrategy", thread "Thread[Worker-1: Loading available Gradle versions,5,main]" timed out waiting (30035ms) for thread "Thread[pool-2-thread-1,5,main]" to finish starting bundle "org.eclipse.buildship.core_3.1.5.v20210112-1646-s [14]". To avoid deadlock, thread "Thread[Worker-1: Loading available Gradle versions,5,main]" is proceeding but "org.eclipse.buildship.core.internal.util.gradle.PublishedGradleVersions$LookupStrategy" may not be fully initialized. Unable to acquire the state change lock for the module: osgi.identity; type="osgi.bundle"; version:Version="3.1.5.v20210112-1646-s"; osgi.identity="org.eclipse.buildship.core"; singleton:="true" [id=14] STARTED [STARTED] org.osgi.framework.BundleException: Unable to acquire the state change lock for the module: osgi.identity; type="osgi.bundle"; version:Version="3.1.5.v20210112-1646-s"; osgi.identity="org.eclipse.buildship.core"; singleton:="true" [id=14] STARTED [STARTED]     at org.eclipse.osgi.container.Module.lockStateChange(Module.java:350)     at org.eclipse.osgi.container.Module.start(Module.java:419)     at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:511)     at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:117)     at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:572)     at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:345)     at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:401)     at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:480)     at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:170)     at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519)     at org.eclipse.buildship.core.internal.util.gradle.PublishedGradleVersionsWrapper$LoadVersionsJob.run(PublishedGradleVersionsWrapper.java:60)     at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63) Caused by: java.util.concurrent.TimeoutException: Timeout after waiting 30 seconds to acquire the lock.     at org.eclipse.osgi.container.Module.lockStateChange(Module.java:347)     ... 11 more Caused by: org.eclipse.osgi.framework.util.ThreadInfoReport: Thread dump ... ----------------------------------  
    • Can someone please tell me why this is happening and help me find a solution. thanks. Edit: Nevermind I figured it out.
    • I am trying to store data through my ItemStack capability storage, but I stumbled upon a roadblock. My ItemStack Capability Storage: public class WandItemStorage implements Capability.IStorage<IWandCap> { @Nullable @Override public INBT writeNBT(Capability<IWandCap> capability, IWandCap instance, Direction side) { CompoundNBT tag = new CompoundNBT(); tag.put("spells", instance.getSpells()); return tag; } @Override public void readNBT(Capability<IWandCap> capability, IWandCap instance, Direction side, INBT nbt) { } } My ItemStack Capability: public class WandCap implements IWandCap { private List<Spell> spells; public WandCap () { spells = new ArrayList<>(); } @Override public List<Spell> getSpells() { return this.spells; } @Override public void addSpells(Spell... spells) { this.spells.addAll(Arrays.asList(spells)); } @Override public void addSpell(Spell spell) { this.spells.add(spell); } @Override public void removeSpells(Spell... spells) { this.spells.removeAll(Arrays.asList(spells)); } @Override public void removeSpell(Spell spell) { this.spells.remove(spell); } @Override public boolean containsSpell(Spell spell) { return this.spells.contains(spell); } } I'm currently trying to put a List of Spells (my custom object) to the Write and Read NBT methods of my ItemStack cap storage, but CompoundNBT doesn't have a method for putting a custom object into a tag. All it has is the put() method from what I'm seeing, however the put() method requires an INBT for the second parameter, which I do not have. Would I need to convert my List of Spells to an INBT, and how would I go about doing that?
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.