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

[1.16.5] NullPointerException: Registry Object not present


Myxtro
 Share

Recommended Posts

I'm making some tools and I'm using a Set of type Block to specify on what blocks the tools would work. This is all in my ItemInit class which I use to register items. See below.

private static Set<Block> EFFECTIVE_ON = Sets.newHashSet(Blocks.ANDESITE);

This works fine with minecraft blocks. Problems occur when I want to use mod blocks like this:

private static Set<Block> EFFECTIVE_ON = Sets.newHashSet(BlockInit.AMBER_BLOCK.get());

 

I get an error while loading the game, which is a NullPointerException. 

Exception message: java.lang.NullPointerException: Registry Object not present: extinctioncraft:amber_block

 

It seems my block can't be found by this set despite the block working fine in the game itself. 

 

I already tried the following without success:

- Checked if the BlockInit is registered in the main class. ( BlockInit.BLOCKS.register(bus); )

- Checked if the block is registered in the BlockInit class. 

Link to comment
Share on other sites

29 minutes ago, Luis_ST said:

where do you use the Set?
you need to use a Supplier when using RegistryObjects before they are initialized (or RegistryObjects)
create a Set of RegistryObjects and use RegistryObject#get when you want to use the Set

It is used when creating a ToolItem in the third argument. 

public static final RegistryObject<Item> IRON_GEO_HAMMER = ITEMS.register("iron_geo_hammer", 
			() -> new ToolItem(1, 1, ItemTier.IRON, EFFECTIVE_ON, new Item.Properties()));

Do I need to change anything here?

Edited by Myxtro
Link to comment
Share on other sites

2 minutes ago, Luis_ST said:

replace "EFFECTIVE_ON" with the Set

EFFECTIVE_ON is the name of the set. Here's the set for refference. 

private static Set<Block> EFFECTIVE_ON = Sets.newHashSet(BlockInit.AMBER_BLOCK.get());

I could ofcourse replace EFFECTIVE_ON with the set but I would then have to repeat this for each item it is applicable to.

Link to comment
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.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • ---- Minecraft Crash Report ---- WARNING: coremods are present:   mt ([1.8.9] KeystrokesMod v4.jar)   PatcherTweaker (Patcher-1.6.1 (1.8.9).jar)   ModTweaker (Patcher-1.6.1 (1.8.9).jar) Contact their authors BEFORE contacting forge // Hey, that tickles! Hehehe! Time: 26/10/21 23:49 Description: Unexpected error java.lang.NullPointerException: Unexpected error     at net.minecraft.client.network.NetworkPlayerInfo.handler$getLocationSkin$zbm000(SourceFile:532)     at net.minecraft.client.network.NetworkPlayerInfo.getLocationSkin(SourceFile)     at net.minecraft.client.entity.AbstractClientPlayer.getLocationSkin(AbstractClientPlayer.java:63)     at net.minecraft.client.renderer.ItemRenderer.renderPlayerArm(ItemRenderer.java:212)     at net.minecraft.client.renderer.ItemRenderer.renderItemInFirstPerson(ItemRenderer.java:353)     at net.minecraft.client.renderer.EntityRenderer.renderHand(EntityRenderer.java:782)     at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1415)     at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1230)     at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1058)     at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1051)     at net.minecraft.client.Minecraft.run(Minecraft.java:349)     at net.minecraft.client.main.Main.main(SourceFile:124)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:497)     at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)     at net.minecraft.launchwrapper.Launch.main(Launch.java:28) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace:     at net.minecraft.client.network.NetworkPlayerInfo.handler$getLocationSkin$zbm000(SourceFile:532)     at net.minecraft.client.network.NetworkPlayerInfo.getLocationSkin(SourceFile)     at net.minecraft.client.entity.AbstractClientPlayer.getLocationSkin(AbstractClientPlayer.java:63)     at net.minecraft.client.renderer.ItemRenderer.renderPlayerArm(ItemRenderer.java:212)     at net.minecraft.client.renderer.ItemRenderer.renderItemInFirstPerson(ItemRenderer.java:353)     at net.minecraft.client.renderer.EntityRenderer.renderHand(EntityRenderer.java:782)     at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1415)     at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1230) -- Affected level -- Details:     Level name: MpServer     All players: 12 total; [EntityPlayerSP['lilBillie'/117861, l='MpServer', x=1.02, y=75.31, z=18.94], EntityOtherPlayerMP['y5x60eui04'/750, l='MpServer', x=-5.50, y=69.00, z=17.50], EntityOtherPlayerMP['q2gwv2832w'/702, l='MpServer', x=-2.50, y=69.50, z=3.50], EntityOtherPlayerMP['5nvxci2ld1'/705, l='MpServer', x=-9.50, y=70.00, z=1.50], EntityOtherPlayerMP['45223jxf7k'/706, l='MpServer', x=-5.50, y=70.00, z=-0.50], EntityOtherPlayerMP['w82014v3b9'/703, l='MpServer', x=3.50, y=69.50, z=3.50], EntityOtherPlayerMP['g773492273'/708, l='MpServer', x=6.50, y=70.00, z=-0.50], EntityOtherPlayerMP['7g0xxjyisc'/709, l='MpServer', x=10.50, y=70.00, z=1.50], EntityOtherPlayerMP['de2f63c4t6'/754, l='MpServer', x=-6.50, y=69.00, z=-15.50], EntityOtherPlayerMP['jf09pdy5t2'/704, l='MpServer', x=-1.50, y=70.00, z=-1.50], EntityOtherPlayerMP['5y4cl0pz75'/707, l='MpServer', x=2.50, y=70.00, z=-1.50], EntityOtherPlayerMP['m9q9v9mk09'/10, l='MpServer', x=-15.50, y=69.00, z=0.50]]     Chunk stats: MultiplayerChunkCache: 240, 240     Level seed: 0     Level generator: ID 01 - flat, ver 0. Features enabled: false     Level generator options:      Level spawn location: 1.00,71.00,26.00 - World: (1,71,26), Chunk: (at 1,4,10 in 0,1; contains blocks 0,0,16 to 15,255,31), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)     Level time: 543930604 game time, 6000 day time     Level dimension: 0     Level storage version: 0x00000 - Unknown?     Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)     Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: false     Forced entities: 404 total; [EntityArmorStand['§b§nClick to cycle!'/2, l='MpServer', x=0.00, y=-1.41, z=0.00], EntityArmorStand['§b§nClick to cycle!'/3, l='MpServer', x=0.00, y=-1.41, z=0.00], EntityOtherPlayerMP['m9q9v9mk09'/10, l='MpServer', x=-15.50, y=69.00, z=0.50], EntityArmorStand['§b§lBest Win Streak'/12, l='MpServer', x=-29.50, y=72.50, z=0.00], EntityArmorStand['§7Blitz Duels'/14, l='MpServer', x=-29.50, y=72.13, z=0.00], EntityArmorStand['§e1. §6SOLOBRUN0§r§6 [OXY]§7 - §e1,070'/16, l='MpServer', x=-29.50, y=71.66, z=0.00], EntityArmorStand['§e2. §bverleh§r§3 [XO]§7 - §e1,017'/18, l='MpServer', x=-29.50, y=71.28, z=0.00], EntityArmorStand['§e3. §6Abstractas§r§e [??????]§7 - §e1,000'/20, l='MpServer', x=-29.50, y=70.94, z=0.00], EntityArmorStand['§e4. §7Minty_Murderer§7 - §e918'/22, l='MpServer', x=-29.50, y=70.56, z=0.00], EntityArmorStand['§e5. §6overhere§r§e [16]§7 - §e687'/24, l='MpServer', x=-29.50, y=70.19, z=0.00], EntityArmorStand['§e6. §7kay_21§r§6 [YT]§7 - §e661'/26, l='MpServer', x=-29.50, y=69.81, z=0.00], EntityArmorStand['§e7. §6Divzer§r§3 [BETRAY?]§7 - §e599'/28, l='MpServer', x=-29.50, y=69.44, z=0.00], EntityArmorStand['§e8. §6Ateam_§r§2 [K?NG]§7 - §e582'/30, l='MpServer', x=-29.50, y=69.06, z=0.00], EntityArmorStand['§e9. §aRayBarnacle§7 - §e490'/32, l='MpServer', x=-29.50, y=68.72, z=0.00], EntityArmorStand['§e10. §bStuffies§r§3 [?ERROR?]§7 - §e489'/34, l='MpServer', x=-29.50, y=68.34, z=0.00], EntityArmorStand['§b§lMonthly Wins'/36, l='MpServer', x=-29.50, y=72.50, z=-9.00], EntityArmorStand['§7Blitz Duels'/38, l='MpServer', x=-29.50, y=72.13, z=-9.00], EntityArmorStand['§e1. §6catgirlsarah§r§e [?REBL?]§7 - §e4,885'/40, l='MpServer', x=-29.50, y=71.66, z=-9.00], EntityArmorStand['§e2. §61kcuh§r§e [SAN]§7 - §e3,556'/42, l='MpServer', x=-29.50, y=71.28, z=-9.00], EntityArmorStand['§e3. §6Hefney§r§7 [ALPAP]§7 - §e2,944'/44, l='MpServer', x=-29.50, y=70.94, z=-9.00], EntityArmorStand['§e4. §6faderjord§7 - §e2,756'/46, l='MpServer', x=-29.50, y=70.56, z=-9.00], EntityArmorStand['§e5. §bILoveHefney§r§7 [ALPAP]§7 - §e2,701'/48, l='MpServer', x=-29.50, y=70.19, z=-9.00], EntityOtherPlayerMP['m9q9v9mk09'/10, l='MpServer', x=-15.50, y=69.00, z=0.50], EntityArmorStand['§e6. §aBeepTest2§r§e [SAN]§7 - §e1,795'/50, l='MpServer', x=-29.50, y=69.81, z=-9.00], EntityArmorStand['§e7. §bxirq§r§2 [K?NG]§7 - §e1,756'/52, l='MpServer', x=-29.50, y=69.44, z=-9.00], EntityArmorStand['§e8. §bDeathStreaks§r§7 [ALPAP]§7 - §e1,707'/54, l='MpServer', x=-29.50, y=69.06, z=-9.00], EntityArmorStand['§e9. §aMajadooma§r§2 [K?NG]§7 - §e1,642'/56, l='MpServer', x=-29.50, y=68.72, z=-9.00], EntityArmorStand['§e10. §6SpookyScary_J§r§2 [SHANK]§7 - §e1,508'/58, l='MpServer', x=-29.50, y=68.34, z=-9.00], EntityArmorStand['§6§lClick to toggle!'/60, l='MpServer', x=-29.50, y=67.88, z=-9.00], EntityArmorStand['§r§7Lifetime §a§lMonthly §r§7Weekly'/62, l='MpServer', x=-29.50, y=67.50, z=-9.00], EntityArmorStand['§b§lBest Win Streak'/64, l='MpServer', x=-29.50, y=72.50, z=0.00], EntityArmorStand['§7Classic Duels'/66, l='MpServer', x=-29.50, y=72.13, z=0.00], EntityArmorStand['§e1. §6WholeLottaFetti§r§3 [XO]§7 - §e4,264'/68, l='MpServer', x=-29.50, y=71.66, z=0.00], EntityArmorStand['§e2. §6Seniorless§7 - §e2,902'/70, l='MpServer', x=-29.50, y=71.28, z=0.00], EntityArmorStand['§e3. §6nickolqi§r§3 [XO]§7 - §e2,150'/72, l='MpServer', x=-29.50, y=70.94, z=0.00], EntityArmorStand['§e4. §6Divzer§r§3 [BETRAY?]§7 - §e2,127'/74, l='MpServer', x=-29.50, y=70.56, z=0.00], EntityArmorStand['§e5. §6Jien§r§e [16]§7 - §e1,719'/76, l='MpServer', x=-29.50, y=70.19, z=0.00], EntityArmorStand['§e6. §bmaazie§7 - §e1,700'/78, l='MpServer', x=-29.50, y=69.81, z=0.00], EntityArmorStand['§e7. §bOritatamu§r§e [500]§7 - §e1,663'/80, l='MpServer', x=-29.50, y=69.44, z=0.00], EntityArmorStand['§e8. §aMonogyny§r§3 [2001]§7 - §e1,657'/82, l='MpServer', x=-29.50, y=69.06, z=0.00], EntityArmorStand['§e9. §bVuraz§r§e [REBOUND]§7 - §e1,567'/84, l='MpServer', x=-29.50, y=68.72, z=0.00], EntityArmorStand['§e10. §blaeolovesurmom§7 - §e1,422'/86, l='MpServer', x=-29.50, y=68.34, z=0.00], EntityArmorStand['§b§lMonthly Wins'/88, l='MpServer', x=-29.50, y=72.50, z=-9.00], EntityArmorStand['§7Classic Duels'/90, l='MpServer', x=-29.50, y=72.13, z=-9.00], EntityArmorStand['Armor Stand'/1114, l='MpServer', x=-50.50, y=85.50, z=34.50], EntityArmorStand['Armor Stand'/1115, l='MpServer', x=-50.50, y=85.13, z=34.50], EntityArmorStand['§e1. §aFREEWACKY§r§3 [XO]§7 - §e10,258'/92, l='MpServer', x=-29.50, y=71.66, z=-9.00], EntityArmorStand['§e2. §6Deviant§r§e [500]§7 - §e5,035'/94, l='MpServer', x=-29.50, y=71.28, z=-9.00], EntityArmorStand['§e3. §brenardstimpy§r§e [16]§7 - §e4,472'/96, l='MpServer', x=-29.50, y=70.94, z=-9.00], EntityArmorStand['§e4. §bHeadlined§r§6 [ABIDE]§7 - §e4,306'/98, l='MpServer', x=-29.50, y=70.56, z=-9.00], EntityArmorStand['§e5. §aweirdlol§r§e [500]§7 - §e4,222'/100, l='MpServer', x=-29.50, y=70.19, z=-9.00], EntityArmorStand['§e6. §bCh5ru§r§e [STUPID]§7 - §e3,404'/102, l='MpServer', x=-29.50, y=69.81, z=-9.00], EntityArmorStand['§c10 Available!§r'/117863, l='MpServer', x=15.50, y=70.69, z=8.50], EntityArmorStand['§65 Halloween Boxes!§r'/117862, l='MpServer', x=-5.50, y=69.56, z=17.50], EntityArmorStand['§e7. §6xX_zykzfan_Xx§r§3 [?VOID?]§7 - §e3,264'/104, l='MpServer', x=-29.50, y=69.44, z=-9.00], EntityArmorStand['§c10 Available!§r'/117864, l='MpServer', x=-14.50, y=70.69, z=8.50], EntityArmorStand['§e8. §aDRAINGANGJOSH§r§e [500]§7 - §e3,139'/106, l='MpServer', x=-29.50, y=69.06, z=-9.00], EntityArmorStand['§e9. §6wisly§r§6 [RIGEL]§7 - §e2,996'/108, l='MpServer', x=-29.50, y=68.72, z=-9.00], EntityArmorStand['§e10. §aBestAtGame§r§2 [CLOVER?]§7 - §e2,990'/110, l='MpServer', x=-29.50, y=68.34, z=-9.00], EntityArmorStand['§6§lClick to toggle!'/112, l='MpServer', x=-29.50, y=67.88, z=-9.00], EntityArmorStand['§r§7Lifetime §a§lMonthly §r§7Weekly'/114, l='MpServer', x=-29.50, y=67.50, z=-9.00], EntityArmorStand['§b§lBest Win Streak'/116, l='MpServer', x=-29.50, y=72.50, z=0.00], EntityArmorStand['§7Sumo Duels'/118, l='MpServer', x=-29.50, y=72.13, z=0.00], EntityArmorStand['§e1. §6Jinta§r§e [16]§7 - §e9,819'/120, l='MpServer', x=-29.50, y=71.66, z=0.00], EntityArmorStand['§e2. §bGLIZZZZZZZZZZY§r§3 [WECLICK]§7 - §e6,400'/122, l='MpServer', x=-29.50, y=71.28, z=0.00], EntityArmorStand['§e3. §bChromeHeartsOnMe§7 - §e5,997'/124, l='MpServer', x=-29.50, y=70.94, z=0.00], EntityArmorStand['§e4. §6kasejo2§r§3 [XO]§7 - §e5,892'/126, l='MpServer', x=-29.50, y=70.56, z=0.00], EntityArmorStand['§e5. §aUpdateDuels§r§2 [SHINTO]§7 - §e5,797'/128, l='MpServer', x=-29.50, y=70.19, z=0.00], EntityArmorStand['§e6. §aPESTxJORDAN§r§e [?BBC?]§7 - §e4,859'/130, l='MpServer', x=-29.50, y=69.81, z=0.00], EntityArmorStand['§e7. §btimxkane§r§6 [666]§7 - §e4,854'/132, l='MpServer', x=-29.50, y=69.44, z=0.00], EntityArmorStand['§e8. §6nickolqi§r§3 [XO]§7 - §e4,087'/134, l='MpServer', x=-29.50, y=69.06, z=0.00], EntityArmorStand['§e9. §aMONKEJACOB§r§3 [ADJUST]§7 - §e4,077'/136, l='MpServer', x=-29.50, y=68.72, z=0.00], EntityArmorStand['§e10. §667kd§r§6 [OXY]§7 - §e3,999'/138, l='MpServer', x=-29.50, y=68.34, z=0.00], EntityArmorStand['§b§lMonthly Wins'/140, l='MpServer', x=-29.50, y=72.50, z=-9.00], EntityArmorStand['§7Sumo Duels'/142, l='MpServer', x=-29.50, y=72.13, z=-9.00], EntityArmorStand['§e1. §7KurumiIsHot§r§e [?BBC?]§7 - §e22,895'/144, l='MpServer', x=-29.50, y=71.66, z=-9.00], EntityArmorStand['§e2. §bSaint_Lion§r§e [?BBC?]§7 - §e21,269'/146, l='MpServer', x=-29.50, y=71.28, z=-9.00], EntityArmorStand['§e3. §6quenchiousFAN§r§3 [WOUND]§7 - §e19,967'/148, l='MpServer', x=-29.50, y=70.94, z=-9.00], EntityArmorStand['§e4. §7senleh§r§e [16]§7 - §e19,397'/150, l='MpServer', x=-29.50, y=70.56, z=-9.00], EntityArmorStand['§e5. §6Rupert§r§e [16]§7 - §e17,863'/152, l='MpServer', x=-29.50, y=70.19, z=-9.00], EntityArmorStand['§e6. §6pcnk§7 - §e16,797'/154, l='MpServer', x=-29.50, y=69.81, z=-9.00], EntityArmorStand['§e7. §ajqt§7 - §e16,319'/156, l='MpServer', x=-29.50, y=69.44, z=-9.00], EntityArmorStand['§e8. §bJasxnn§7 - §e14,497'/158, l='MpServer', x=-29.50, y=69.06, z=-9.00], EntityArmorStand['§e9. §6NotAppreciated§r§e [?BBC?]§7 - §e14,364'/160, l='MpServer', x=-29.50, y=68.72, z=-9.00], EntityArmorStand['§e10. §6Coohnair§r§e [?BBC?]§7 - §e12,973'/162, l='MpServer', x=-29.50, y=68.34, z=-9.00], EntityArmorStand['§6§lClick to toggle!'/164, l='MpServer', x=-29.50, y=67.88, z=-9.00], EntityArmorStand['§r§7Lifetime §a§lMonthly §r§7Weekly'/166, l='MpServer', x=-29.50, y=67.50, z=-9.00], EntityWither['§d§lSKYBLOCK CRY§6§lS§5§lTAL HOLLOWS'/-1234, l='MpServer', x=-9.06, y=66.84, z=-8.81], EntityArmorStand['§b§lBest Win Streak'/220, l='MpServer', x=-29.50, y=72.50, z=0.00], EntityArmorStand['§7Bow Duels'/222, l='MpServer', x=-29.50, y=72.13, z=0.00], EntityArmorStand['§e1. §bMistyBay§r§3 [ASCEND?]§7 - §e964'/224, l='MpServer', x=-29.50, y=71.66, z=0.00], EntityArmorStand['§e2. §6Slynn§r§7
    • Oh never mind ! I found the error i wrote "degastrotaparetranotratodium" in my ItemInit class. It now Works ! THANKS  
    • I joined the server not too long ago and I found the everyone on there to be kind and the staff were very helpful with anything I needed.
    • Thank you so much! i can't wait to play with my friends, Hope you guys fix it soon!😀
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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