Jump to content

Recommended Posts

Posted

(Deepl translation is used)

I am using IntelliJ to make a mod with Forge 1.12.2. (This is my first time modding).

I was looking at the tutorial on the Japanese web page and adding blocks, but
I got an error.

---- Minecraft Crash Report ----
// I bet Cylons wouldn't have this problem.

Time: 1/7/23 12:11 AM
Description: Initializing game

java.lang.NullPointerException: Initializing game
	at net.minecraft.item.ItemBlock.getCreativeTab(ItemBlock.java:142)
	at net.minecraft.item.Item.getCreativeTabs(Item.java:691)
	at net.minecraft.item.Item.isInCreativeTab(Item.java:416)
	at net.minecraft.item.ItemBlock.getSubItems(ItemBlock.java:147)
	at net.minecraft.client.Minecraft.populateSearchTreeManager(Minecraft.java:587)
	at net.minecraft.client.Minecraft.init(Minecraft.java:529)
	at net.minecraft.client.Minecraft.run(Minecraft.java:378)
	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.legacydev.Main.start(Main.java:86)
	at net.minecraftforge.legacydev.MainClient.main(MainClient.java:29)


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.ItemBlock.getCreativeTab(ItemBlock.java:142)
	at net.minecraft.item.Item.getCreativeTabs(Item.java:691)
	at net.minecraft.item.Item.isInCreativeTab(Item.java:416)
	at net.minecraft.item.ItemBlock.getSubItems(ItemBlock.java:147)
	at net.minecraft.client.Minecraft.populateSearchTreeManager(Minecraft.java:587)
	at net.minecraft.client.Minecraft.init(Minecraft.java:529)

-- Initialization --
Details:
Stacktrace:
	at net.minecraft.client.Minecraft.run(Minecraft.java:378)
	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.legacydev.Main.start(Main.java:86)
	at net.minecraftforge.legacydev.MainClient.main(MainClient.java:29)

-- System Details --
Details:
	Minecraft Version: 1.12.2
	Operating System: Windows 11 (amd64) version 10.0
	Java Version: 1.8.0_351, Oracle Corporation
	Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
	Memory: 359153200 bytes (342 MB) / 1261961216 bytes (1203 MB) up to 3799515136 bytes (3623 MB)
	JVM Flags: 0 total; 
	IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
	FML: MCP 9.42 Powered by Forge 14.23.5.2860 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 |
	|:----- |:---------- |:------------ |:---------------------------------------------------------- |:--------- |
	| LCH   | minecraft  | 1.12.2       | minecraft.jar                                              | None      |
	| LCH   | mcp        | 9.42         | minecraft.jar                                              | None      |
	| LCH   | FML        | 8.0.99.99    | forge-1.12.2-14.23.5.2860_mapped_stable_39-1.12-recomp.jar | None      |
	| LCH   | forge      | 14.23.5.2860 | forge-1.12.2-14.23.5.2860_mapped_stable_39-1.12-recomp.jar | None      |
	| LCH   | letter_mod | 1.0-SNAPSHOT | main                                                       | None      |

	Loaded coremods (and transformers): 
	GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.6.0 NVIDIA 526.47' Renderer: 'NVIDIA GeForce RTX 3050/PCIe/SSE2'
	Launched Version: ${MC_VERSION}
	LWJGL: 2.9.4
	OpenGL: NVIDIA GeForce RTX 3050/PCIe/SSE2 GL version 4.6.0 NVIDIA 526.47, 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: 12x Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz

 

And in the IntelliJ console I get


 Caused by: java.io.FileNotFoundException: letter_mod:models/item/latin_letter_a.json

 Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException

 Caused by: java.lang.RuntimeException: Encountered an exception when loading model definition of model letter_mod:blockstates/latin_letter_a_block.json

 Caused by: java.io.FileNotFoundException: letter_mod:blockstates/latin_letter_a_block.json

 
FileNotFoundException, so I checked to see if the file existed, and it was firmly there.

I would appreciate it if someone could help me out.

Posted

Sorry, I forgot to post a screenshot.

 

file structure↓

%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%

 

Program↓

package rumisystem.letter_mod.letter_mod;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.registry.GameRegistry;

import java.util.Objects;
import java.util.logging.Logger;

@Mod(
        modid = Letter_mod.MOD_ID,
        name = Letter_mod.MOD_NAME,
        version = Letter_mod.VERSION
)
public class Letter_mod {

    public static final String MOD_ID = "letter_mod";
    public static final String MOD_NAME = "Letter_mod";
    public static final String VERSION = "1.0-SNAPSHOT";

    /**
     * This is the instance of your mod as created by Forge. It will never be null.
     */
    @Mod.Instance(MOD_ID)
    public static Letter_mod INSTANCE;

    /**
     * This is the first initialization event. Register tile entities here.
     * The registry events below will have fired prior to entry to this method.
     */
    @Mod.EventHandler
    public void preinit(FMLPreInitializationEvent event) {

    }

    /**
     * This is the second initialization event. Register custom recipes
     */
    @Mod.EventHandler
    public void init(FMLInitializationEvent event) {
        System.out.println("Letter MOD By RumiSystem and Rumisan");
    }

    /**
     * This is the final initialization event. Register actions from other mods here
     */
    @Mod.EventHandler
    public void postinit(FMLPostInitializationEvent event) {

    }

    /**
     * Forge will automatically look up and bind blocks to the fields in this class
     * based on their registry name.
     */
    @GameRegistry.ObjectHolder(MOD_ID)
    public static class Blocks {
      /*
          public static final MySpecialBlock mySpecialBlock = null; // placeholder for special block below
      */
        public static Block LatinLetter_A = null;                                                 //ラテン文字のA
    }

    /**
     * Forge will automatically look up and bind items to the fields in this class
     * based on their registry name.
     */
    @GameRegistry.ObjectHolder(MOD_ID)
    public static class Items {
      /*
          public static final ItemBlock mySpecialBlock = null; // itemblock for the block above
          public static final MySpecialItem mySpecialItem = null; // placeholder for special item below
      */
      public static ItemBlock LatinLetter_A = null;                                                      //ラテン文字のA
    }

    /**
     * This is a special class that listens to registry events, to allow creation of mod blocks and items at the proper time.
     */
    @Mod.EventBusSubscriber
    public static class ObjectRegistryHandler {
        /**
         * Listen for the register event for creating custom items
         */
        @SubscribeEvent
        public static void addItems(RegistryEvent.Register<Item> event) {
           /*
             event.getRegistry().register(new ItemBlock(Blocks.myBlock).setRegistryName(MOD_ID, "myBlock"));
             event.getRegistry().register(new MySpecialItem().setRegistryName(MOD_ID, "mySpecialItem"));
            */
            event.getRegistry().registerAll(
                    new ItemBlock(Blocks.LatinLetter_A).setRegistryName("latin_letter_A")
            );
        }

        /**
         * Listen for the register event for creating custom blocks
         */
        @SubscribeEvent
        public static void addBlocks(RegistryEvent.Register<Block> event) {
           /*
             event.getRegistry().register(new MySpecialBlock().setRegistryName(MOD_ID, "mySpecialBlock"));
            */

            event.getRegistry().registerAll(
                    new Block(Material.ROCK)
                            .setRegistryName(MOD_ID, "latin_letter_A_block")/*登録名の設定*/
                            .setCreativeTab(CreativeTabs.MISC)/*クリエのタブ*/
                            .setTranslationKey("block_latin_letter_A")/*システム名の設定*/
                            .setHardness(1.5F)/*硬さ*/
                            .setResistance(1.0F)/*爆破耐性*/
            );
        }

        @SubscribeEvent
        public static void registerModels(ModelRegistryEvent event){

        }
    }

    /* EXAMPLE ITEM AND BLOCK - you probably want these in separate files
    public static class MySpecialItem extends Item {

    }

    public static class MySpecialBlock extends Block {

    }
    */
}

 

Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Back then there was a number which determined the tier of an item and block. If the block tier is lower or equal to the item number, the block would be mined. this however, has changed and now it goes by "needs_netherite_tool" which is fine, until you realized that some mods had items and blocks that exceeded these values. You can make you own "needs_mod_tool" but I feel that this is more limiting(and just more work) than before. So is there anyway to use something similar to the old tier system while also still being compatible with a lot of other mod tools?
    • Well, when I log in to the server, sometimes within an hour, sometimes within a minute, the server closes and informs me that there was a Ticking entity error. Below is the crash report
    • Try switching to Windowed or Borderless Window mode in Minecraft. These modes make it easier for the recorder to capture gameplay, as it still has access to the display without the game taking up all of the graphics resources.
    • This forum is for Forge, not NeoForge. Please go to them for support.
    • Forge version: 55.0.0 Minecraft version: 1.21.5 Downloads: As this is the start of a new version, it is recommended that you check the downloads page and use the latest version to receive any bug fixes. Downloads page Intro: Good evening! Today, we have released our initial build of Forge 55.0 for Minecraft 1.21.5. 1.21.5 is the newest member of the 1.21 family of versions, which was released yesterday on March 25, 2025. As a reminder, the first minor (X.0) of a Forge version is a beta. Forge betas are marked as such on the bottom left of the title screen and are candidates for any breaking changes. Additionally, there are a couple of important things to note about this update, which I've made sure to mention in this post as well. Feel free to chat with us about bugs or these implementation changes on GitHub and in our Discord server. As always, we will continue to keep all versions of 1.21 and 1.20 in active support as covered by our tiered support policy. Cheers, happy modding, and good luck porting! Rendering Refactor For those who tuned in to Minecraft Live on March 22, 2025, you may already know that Mojang have announced their intention to bring their new Vibrant Visuals overhaul to Java in the future. They've taken the first steps toward this by refactoring how rendering pipelines and render types are handled internally. This has, in turn, made many of Forge's rendering APIs that have existed for years obsolete, as they (for the most part) can be done directly in vanilla. If there was a rendering API that was provided by Forge which you believe should be re-implemented, we're happy to discuss on GitHub through an issue or a pull request. Deprecation of weapon-like ToolActions In 1.21.5, Minecraft added new data components for defining the characteristics of weapons in data. This includes attack speed, block tags which define efficient blocks, and more. As such, we will begin marking our ToolActions solution for this as deprecated. ToolActions were originally added to address the problem of creating modded tools that needed to perform the same actions as vanilla tools. There are still a few tool actions that will continue to be used, such as the shears tool action for example. There are some existing Forge tool actions that are currently obsolete and have no effect given the way the new data components are implemented. We will continue to work on these deprecations and invite you to chat with us on GitHub or Discord if you have any questions.
  • Topics

×
×
  • Create New...

Important Information

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