Jump to content

{SOLVED} [1.12.2] Game crash when right-click on earhBlock with Seeds


Recommended Posts

Posted (edited)

I everybody,

 

I'm making a mod and I'm following shadowfacts' tutorial.

 

Today I wanted to da a simple crop, so following this tutorial I made my corn crops.

 

Everythink work except for one thing. When I righ-click on a block with my seeds the game crash.

 

My project: https://github.com/IlTosaerba/Minecraft-1.12.2-WLLC-Mod/tree/IlTosaerba-WLLC-1.12.2]-Mod   (The "resource/assets" has been exploded 'cause GitHub don't permit the upload of +100 files and I don't understand how to create folders and so on)

 

Crash Error: 

Spoiler

---- Minecraft Crash Report ----
// You should try our sister game, Minceraft!

Time: 3/11/18 5:33 PM
Description: Unexpected error

java.lang.NullPointerException: Unexpected error
    at net.minecraft.item.ItemSeeds.getPlant(ItemSeeds.java:61)
    at net.minecraft.block.Block.canSustainPlant(Block.java:1931)
    at net.minecraft.item.ItemSeeds.onItemUse(ItemSeeds.java:34)
    at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:201)
    at net.minecraft.client.multiplayer.PlayerControllerMP.processRightClickBlock(PlayerControllerMP.java:499)
    at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1692)
    at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:2379)
    at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2145)
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1933)
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1186)
    at net.minecraft.client.Minecraft.run(Minecraft.java:441)
    at net.minecraft.client.main.Main.main(Main.java:118)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
    at GradleStart.main(GradleStart.java:26)


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

-- Head --
Thread: Client thread
Stacktrace:
    at net.minecraft.item.ItemSeeds.getPlant(ItemSeeds.java:61)
    at net.minecraft.block.Block.canSustainPlant(Block.java:1931)
    at net.minecraft.item.ItemSeeds.onItemUse(ItemSeeds.java:34)
    at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:201)
    at net.minecraft.client.multiplayer.PlayerControllerMP.processRightClickBlock(PlayerControllerMP.java:499)
    at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1692)
    at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:2379)
    at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2145)

-- Affected level --
Details:
    Level name: MpServer
    All players: 1 total; [EntityPlayerSP['Player617'/226, l='MpServer', x=289.27, y=72.00, z=262.34]]
    Chunk stats: MultiplayerChunkCache: 539, 539
    Level seed: 0
    Level generator: ID 00 - default, ver 1. Features enabled: false
    Level generator options: 
    Level spawn location: World: (286,64,260), Chunk: (at 14,4,4 in 17,16; contains blocks 272,0,256 to 287,255,271), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
    Level time: 3635 game time, 3635 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: creative (ID 1). Hardcore: false. Cheats: false
    Forced entities: 88 total; [EntitySkeleton['Skeleton'/128, l='MpServer', x=286.52, y=49.00, z=238.27], EntitySkeleton['Skeleton'/129, l='MpServer', x=284.98, y=48.00, z=233.92], EntityZombie['Zombie'/130, l='MpServer', x=275.40, y=48.00, z=233.78], EntityBat['Bat'/131, l='MpServer', x=281.49, y=50.34, z=235.50], EntityCreeper['Creeper'/132, l='MpServer', x=279.23, y=48.00, z=237.52], EntitySpider['Spider'/133, l='MpServer', x=283.97, y=49.00, z=233.99], EntityCreeper['Creeper'/134, l='MpServer', x=283.82, y=39.00, z=269.58], EntityZombie['Zombie'/135, l='MpServer', x=274.50, y=30.00, z=275.50], EntityCreeper['Creeper'/136, l='MpServer', x=280.47, y=40.00, z=277.15], EntityCreeper['Creeper'/137, l='MpServer', x=285.43, y=39.00, z=277.79], EntityBat['Bat'/138, l='MpServer', x=279.38, y=32.87, z=274.65], EntitySkeleton['Skeleton'/139, l='MpServer', x=286.50, y=21.00, z=312.50], EntitySkeleton['Skeleton'/140, l='MpServer', x=274.16, y=24.00, z=307.82], EntityZombie['Zombie'/141, l='MpServer', x=275.75, y=24.00, z=311.49], EntitySkeleton['Skeleton'/142, l='MpServer', x=275.90, y=25.00, z=312.50], EntitySkeleton['Skeleton'/143, l='MpServer', x=274.50, y=25.00, z=316.50], EntityCreeper['Creeper'/144, l='MpServer', x=289.20, y=24.00, z=309.57], EntitySquid['Squid'/145, l='MpServer', x=276.21, y=57.89, z=321.77], EntityZombie['Zombie'/146, l='MpServer', x=280.50, y=15.00, z=334.50], EntitySkeleton['Skeleton'/147, l='MpServer', x=275.73, y=20.00, z=324.46], EntitySlime['Slime'/148, l='MpServer', x=278.78, y=17.55, z=326.85], EntityWitch['Witch'/149, l='MpServer', x=284.29, y=23.00, z=326.50], EntityZombie['Zombie'/150, l='MpServer', x=285.48, y=22.00, z=322.77], EntityItem['item.tile.mushroom'/155, l='MpServer', x=288.78, y=25.00, z=265.13], EntityEnderman['Enderman'/156, l='MpServer', x=300.76, y=29.00, z=263.50], EntitySkeleton['Skeleton'/157, l='MpServer', x=297.33, y=27.00, z=264.48], EntityCreeper['Creeper'/158, l='MpServer', x=288.83, y=39.00, z=271.51], EntityZombie['Zombie'/159, l='MpServer', x=296.21, y=42.00, z=284.58], EntityCreeper['Creeper'/160, l='MpServer', x=290.50, y=42.00, z=279.50], EntitySpider['Spider'/161, l='MpServer', x=303.30, y=32.00, z=278.00], EntityItem['item.tile.flower1.dandelion'/162, l='MpServer', x=293.93, y=61.00, z=312.42], EntityItem['item.tile.flower1.dandelion'/163, l='MpServer', x=294.65, y=63.00, z=308.25], EntitySquid['Squid'/164, l='MpServer', x=296.34, y=61.01, z=315.57], EntityItem['item.item.seeds'/165, l='MpServer', x=292.58, y=64.00, z=309.29], EntityItem['item.tile.flower1.dandelion'/166, l='MpServer', x=290.61, y=64.00, z=308.55], EntityItem['item.tile.flower1.dandelion'/167, l='MpServer', x=290.37, y=64.00, z=310.61], EntityPig['Pig'/174, l='MpServer', x=315.44, y=73.00, z=281.26], EntityPig['Pig'/175, l='MpServer', x=323.25, y=74.00, z=279.49], EntityPig['Pig'/176, l='MpServer', x=311.25, y=72.00, z=281.27], EntityPig['Pig'/177, l='MpServer', x=317.21, y=70.00, z=294.67], EntityBat['Bat'/178, l='MpServer', x=311.58, y=18.14, z=314.43], EntityZombie['Zombie'/179, l='MpServer', x=316.50, y=39.00, z=304.82], EntityZombie['Zombie'/180, l='MpServer', x=316.50, y=14.00, z=320.50], EntityPig['Pig'/54, l='MpServer', x=219.81, y=69.00, z=237.79], EntityPig['Pig'/55, l='MpServer', x=223.66, y=69.00, z=242.20], EntityBat['Bat'/56, l='MpServer', x=223.95, y=32.05, z=277.57], EntityWitch['Witch'/57, l='MpServer', x=222.50, y=39.00, z=277.50], EntityCreeper['Creeper'/58, l='MpServer', x=219.84, y=33.00, z=285.45], EntityItem['item.tile.flower2.poppy'/186, l='MpServer', x=331.06, y=64.00, z=228.99], EntityZombie['Zombie'/59, l='MpServer', x=222.50, y=32.00, z=284.19], EntitySkeleton['Skeleton'/187, l='MpServer', x=320.50, y=22.00, z=292.50], EntityCreeper['Creeper'/60, l='MpServer', x=218.50, y=19.00, z=296.50], EntitySkeleton['Skeleton'/188, l='MpServer', x=335.25, y=52.00, z=297.47], EntityZombie['Zombie'/189, l='MpServer', x=333.50, y=52.00, z=293.71], EntityZombie['Zombie'/62, l='MpServer', x=215.50, y=34.00, z=288.50], EntitySkeleton['Skeleton'/195, l='MpServer', x=340.29, y=15.00, z=198.49], EntityPig['Pig'/68, l='MpServer', x=234.12, y=70.00, z=245.50], EntityItem['item.item.seeds'/196, l='MpServer', x=343.34, y=64.00, z=290.22], EntityPig['Pig'/69, l='MpServer', x=225.60, y=69.00, z=246.78], EntityCreeper['Creeper'/70, l='MpServer', x=227.50, y=39.00, z=275.50], EntityCreeper['Creeper'/71, l='MpServer', x=225.18, y=39.00, z=276.58], EntityZombie['Zombie'/72, l='MpServer', x=226.50, y=22.00, z=299.50], EntityCreeper['Creeper'/73, l='MpServer', x=237.21, y=25.00, z=303.50], EntityBat['Bat'/346, l='MpServer', x=341.75, y=29.99, z=333.59], EntityItem['item.tile.mushroom'/95, l='MpServer', x=252.88, y=11.00, z=200.20], EntityCreeper['Creeper'/97, l='MpServer', x=246.50, y=12.00, z=325.50], EntityPlayerSP['Player617'/226, l='MpServer', x=289.27, y=72.00, z=262.34], EntityPig['Pig'/104, l='MpServer', x=261.62, y=69.00, z=197.76], EntityPig['Pig'/105, l='MpServer', x=269.29, y=68.00, z=202.65], EntityPig['Pig'/106, l='MpServer', x=256.76, y=69.00, z=204.77], EntitySkeleton['Skeleton'/107, l='MpServer', x=267.76, y=48.00, z=237.24], EntitySkeleton['Skeleton'/108, l='MpServer', x=257.34, y=32.00, z=252.08], EntityCreeper['Creeper'/109, l='MpServer', x=258.30, y=32.00, z=249.36], EntitySkeleton['Skeleton'/110, l='MpServer', x=256.51, y=33.00, z=253.25], EntityBat['Bat'/111, l='MpServer', x=269.57, y=53.10, z=241.06], EntityCreeper['Creeper'/112, l='MpServer', x=261.50, y=39.00, z=271.50], EntitySkeleton['Skeleton'/113, l='MpServer', x=260.45, y=39.00, z=276.23], EntityCreeper['Creeper'/114, l='MpServer', x=261.42, y=24.00, z=301.79], EntityZombie['Zombie'/115, l='MpServer', x=270.18, y=24.00, z=311.25], EntityZombie['Zombie'/116, l='MpServer', x=265.83, y=26.00, z=309.36], EntityZombie['Zombie'/117, l='MpServer', x=275.07, y=25.00, z=312.50], EntityZombie['Zombie'/118, l='MpServer', x=270.27, y=24.00, z=313.50], EntitySkeleton['Skeleton'/119, l='MpServer', x=256.49, y=28.00, z=308.32], EntityZombie['Zombie'/120, l='MpServer', x=257.50, y=28.00, z=312.50], EntityCreeper['Creeper'/124, l='MpServer', x=281.50, y=57.00, z=200.50], EntityPig['Pig'/125, l='MpServer', x=272.23, y=68.00, z=197.70], EntityZombie['Zombie'/126, l='MpServer', x=278.91, y=49.00, z=238.26], EntitySkeleton['Skeleton'/127, l='MpServer', x=282.50, y=48.00, z=235.50]]
    Retry entities: 0 total; []
    Server brand: fml,forge
    Server type: Integrated singleplayer server
Stacktrace:
    at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:461)
    at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2896)
    at net.minecraft.client.Minecraft.run(Minecraft.java:470)
    at net.minecraft.client.main.Main.main(Main.java:118)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
    at GradleStart.main(GradleStart.java:26)

-- System Details --
Details:
    Minecraft Version: 1.12.2
    Operating System: Windows 10 (amd64) version 10.0
    Java Version: 1.8.0_162, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 523714776 bytes (499 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
    JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
    IntCache: cache: 4, tcache: 0, allocated: 13, tallocated: 95
    FML: MCP 9.42 Powered by Forge 14.23.2.2624 5 mods loaded, 5 mods active
    States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

    | State     | ID        | Version      | Source                           | Signature |
    |:--------- |:--------- |:------------ |:-------------------------------- |:--------- |
    | UCHIJAAAA | minecraft | 1.12.2       | minecraft.jar                    | None      |
    | UCHIJAAAA | mcp       | 9.42         | minecraft.jar                    | None      |
    | UCHIJAAAA | FML       | 8.0.99.99    | forgeSrc-1.12.2-14.23.2.2624.jar | None      |
    | UCHIJAAAA | forge     | 14.23.2.2624 | forgeSrc-1.12.2-14.23.2.2624.jar | None      |
    | UCHIJAAAA | wllc      | 1.0          | bin                              | None      |

    Loaded coremods (and transformers): 
    GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.6.0 NVIDIA 391.01' Renderer: 'GeForce GTX 1060 6GB/PCIe/SSE2'
    Launched Version: 1.12.2
    LWJGL: 2.9.4
    OpenGL: GeForce GTX 1060 6GB/PCIe/SSE2 GL version 4.6.0 NVIDIA 391.01, NVIDIA Corporation
    GL Caps: Using GL 1.3 multitexturing.
Using GL 1.3 texture combiners.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Shaders are available because OpenGL 2.1 is supported.
VBOs are available because OpenGL 1.5 is supported.

    Using VBOs: Yes
    Is Modded: Definitely; Client brand changed to 'fml,forge'
    Type: Client (map_client.txt)
    Resource Packs: 
    Current Language: English (US)
    Profiler Position: N/A (disabled)
    CPU: 8x AMD FX(tm)-9590 Eight-Core Processor 

 

Edited by IlTosaerba
Posted
33 minutes ago, diesieben07 said:
  • Blocks.CROP_CORN is null at this point. You cannot pass null for that parameter though.

@diesieben07 We should have this problem in the common problems list. I vaguely recall trying to ping you about it before.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
17 minutes ago, diesieben07 said:

How do you want to add it? "Don't pass null to things that should not be null"?

This issue is only ever a problem "when someone is creating crops" (90%+). Usually it's someone passing an item to a block constructor, but only about 60-40.

I'd write it as...

"Do not pass items to block constructors, if passing blocks to items, insure blocks are initialized first. This is a very common issue when making crops and seeds. Use the debugger to verify your references are not null."

Or

"When passing block and item references to constructors, insure correct order of operations. Use the debugger to verify your references are not null. Blocks should be initialized before items."

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted (edited)
23 minutes ago, diesieben07 said:

The specific issue you are describing is solved if you comply with the recommended approach of creating your blocks and items in the registry events (block registration fires first).

Yes, I agree. But even so I still see people doing this wrong. Like I said, I've seen people pass their item reference to their block (heck I once saw someone do both: item ref to the block and the block ref to the item!). Literally every time I see a thread with the word "crop" or "seeds" in the title I know what the problem is, and it's this problem. The registry events have (somehow) not made this common issue go away.

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Cracked Launchers are not supported
    • After some time minecraft crashes with an error. Here is the log https://drive.google.com/file/d/1o-2R6KZaC8sxjtLaw5qj0A-GkG_SuoB5/view?usp=sharing
    • The specific issue is that items in my inventory wont stack properly. For instance, if I punch a tree down to collect wood, the first block I collected goes to my hand. So when I punch the second block of wood to collect it, it drops, but instead of stacking with the piece of wood already in my hand, it goes to the second slot in my hotbar instead. Another example is that I'll get some dirt, and then when I'm placing it down later I'll accidentally place a block where I don't want it. When I harvest it again, it doesn't go back to the stack that it came from on my hotbar, where it should have gone, but rather into my inventory. That means that if my inventory is full, then the dirt wont be picked up even though there should be space available in the stack I'm holding. The forge version I'm using is 40.3.0, for java 1.18.2. I'll leave the mods I'm using here, and I'd appreciate it if anybody can point me in the right direction in regards to figuring out how to fix this. I forgot to mention that I think it only happens on my server but I'm not entirely sure. PLEASE HELP ME! LIST OF THE MODS. aaa_particles Adorn AdvancementPlaques AI-Improvements AkashicTome alexsdelight alexsmobs AmbientSounds amwplushies Animalistic another_furniture AppleSkin Aquaculture aquamirae architectury artifacts Atlas-Lib AutoLeveling AutoRegLib auudio balm betterfpsdist biggerstacks biomancy BiomesOPlenty blockui blueprint Bookshelf born_in_chaos Botania braincell BrassAmberBattleTowers brutalbosses camera CasinoCraft cfm (MrCrayfish’s Furniture Mod) chat_heads citadel cloth-config Clumps CMDCam CNB cobweb collective comforts convenientcurioscontainer cookingforblockheads coroutil CosmeticArmorReworked CozyHome CrabbersDelight crashexploitfixer crashutilities Create CreativeCore creeperoverhaul cristellib crittersandcompanions Croptopia CroptopiaAdditions CullLessLeaves curios curiouslanterns curiouslights Curses' Naturals CustomNPCs CyclopsCore dannys_expansion decocraft Decoration Mod DecorationDelightRefurbished Decorative Blocks Disenchanting DistantHorizons doubledoors DramaticDoors drippyloadingscreen durabilitytooltip dynamic-fps dynamiclights DynamicTrees DynamicTreesBOP DynamicTreesPlus Easy Dungeons EasyAnvils EasyMagic easy_npc eatinganimation ecologics effective_fg elevatorid embeddium emotecraft enchantlimiter EnchantmentDescriptions EnderMail engineersdecor entityculling entity_model_features entity_texture_features epicfight EvilCraft exlinefurniture expandability explosiveenhancement factory-blocks fairylights fancymenu FancyVideo FarmersDelight fast-ip-ping FastSuite ferritecore finsandtails FixMySpawnR Forge Middle Ages fossil FpsReducer2 furnish GamingDeco geckolib goblintraders goldenfood goodall H.e.b habitat harvest-with-ease hexerei hole_filler huge-structure-blocks HunterIllager iammusicplayer Iceberg illuminations immersive_paintings incubation infinitybuttons inventoryhud InventoryProfilesNext invocore ItemBorders itemzoom Jade jei (Just Enough Items) JetAndEliasArmors journeymap JRFTL justzoom kiwiboi Kobolds konkrete kotlinforforge lazydfu LegendaryTooltips libIPN lightspeed lmft lodestone LongNbtKiller LuckPerms Lucky77 MagmaMonsters malum ManyIdeasCore ManyIdeasDoors marbledsarsenal marg mcw-furniture mcw-lights mcw-paths mcw-stairs mcw-trapdoors mcw-windows meetyourfight melody memoryleakfix Mimic minecraft-comes-alive MineTraps minibosses MmmMmmMmmMmm MOAdecor (ART, BATH, COOKERY, GARDEN, HOLIDAYS, LIGHTS, SCIENCE) MobCatcher modonomicon mods_optimizer morehitboxes mowziesmobs MutantMonsters mysticalworld naturalist NaturesAura neapolitan NekosEnchantedBooks neoncraft2 nerb nifty NightConfigFixes nightlights nocube's_villagers_sell_animals NoSeeNoTick notenoughanimations obscure_api oculus oresabovediamonds otyacraftengine Paraglider Patchouli physics-mod Pillagers Gun PizzaCraft placeableitems Placebo player-animation-lib pneumaticcraft-repressurized polymorph PrettyPipes Prism projectbrazier Psychadelic-Chemistry PuzzlesLib realmrpg_imps_and_demons RecipesLibrary reeves-furniture RegionsUnexplored restrictedportals revive-me Scary_Mobs_And_Bosses selene shetiphiancore ShoulderSurfing smoothboot
    • Hi everyone, I'm currently developing a Forge 1.21 mod for Minecraft and I want to display a custom HUD overlay for a minigame. My goal: When the game starts, all players should see an item/block icon (from the base game, not a custom texture) plus its name/text in the HUD – similar to how the bossbar overlay works. The HUD should appear centered above the hotbar (or at a similar prominent spot), and update dynamically (icon and name change as the target item changes). What I've tried: I looked at many online tutorials and several GitHub repos (e.g. SeasonHUD, MiniHUD), but most of them use NeoForge or Forge versions <1.20 that provide the IGuiOverlay API (e.g. implements IGuiOverlay, RegisterGuiOverlaysEvent). In Forge 1.21, it seems that neither IGuiOverlay nor RegisterGuiOverlaysEvent exist anymore – at least, I can't import them and they are missing from the docs and code completion. I tried using RenderLevelStageEvent as a workaround but it is probably not intended for custom HUDs. I am not using NeoForge, and switching the project to NeoForge is currently not an option for me. I tried to look at the original minecraft source code to see how elements like hearts, hotbar etc are drawn on the screen but I am too new to Minecraft modding to understand. What I'm looking for: What is the correct way to add a custom HUD element (icon + text) in Forge 1.21, given that the previous overlay API is missing? Is there a new recommended event, callback, or method in Forge 1.21 for custom HUD overlays, or is everyone just using a workaround? Is there a minimal open-source example repo for Forge 1.21 that demonstrates a working HUD overlay without relying on NeoForge or deprecated Forge APIs? My ideal solution: Centered HUD element with an in-game item/block icon (from the base game's assets, e.g. a diamond or any ItemStack / Item) and its name as text, with a transparent background rectangle. It should be visible to the players when the mini game is running. Easy to update the item (e.g. static variable or other method), so it can change dynamically during the game. Any help, code snippets, or up-to-date references would be really appreciated! If this is simply not possible right now in Forge 1.21, it would also help to know that for sure. Thank you very much in advance!
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.