Jump to content

Recommended Posts

Posted

The item is staying as a purple and black box. How do I fix it?

 

Main:

 

package com.example.examplemod;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;

@Mod(modid = Test.MODID, version = Test.VERSION)
public class Test
{
public static ItemBase test;

    public static final String MODID = "modid";
    public static final String VERSION = "1.0";
    
    @SidedProxy(clientSide = "com.example.examplemod.ClientProxy", serverSide = "com.example.examplemod.CommonProxy")
    public static CommonProxy proxy;
    
    @EventHandler
    public void init(FMLInitializationEvent event)
    {
    	
	test = (ItemBase) new ItemBase("test").setCreativeTab(CreativeTabs.tabCombat);
	GameRegistry.registerItem(test, "test");

	proxy.init();
    }
}

 

 

Item:

 

package com.example.examplemod;

import net.minecraft.item.Item;

public class ItemBase extends Item{

private String name;

public ItemBase(String name){
	super();
	this.name = name;
	this.setUnlocalizedName(name);
}

public String getName(){
	return name;
}
}

 

 

ClientProxy:

 

package com.example.examplemod;

import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;

public class ClientProxy extends CommonProxy{
public void init(){
	ModelResourceLocation itemModelResourceLocation = new ModelResourceLocation("modid:test", "inventory");
    final int DEFAULT_ITEM_SUBTYPE = 0;
    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Test.test, DEFAULT_ITEM_SUBTYPE, itemModelResourceLocation);
}
}

 

 

JSON file: test.json

 

{
    "parent": "builtin/generated",
    "textures": {
        "layer0": “modid:items/test”
    },
    "display": {
        "thirdperson": {
            "rotation": [ -90, 0, 0 ],
            "translation": [ 0, 1, -3 ],
            "scale": [ 0.55, 0.55, 0.55 ]
        },
        "firstperson": {
            "rotation": [ 0, -135, 25 ],
            "translation": [ 0, 4, 2 ],
            "scale": [ 1.7, 1.7, 1.7 ]
        }
    }
}

 

 

Path:

 

src/main/resources/assets/modid/models/item/test.json

 

src/main/resources/assets/modid/textures/items/test.png

 

Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.

Posted

Hmm well ill change the texture thing but that doesn't fix the model does it?

 

And yes I'm doing testing

Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.

Posted

log:

 

[16:01:45] [main/INFO] [GradleStart]: Extra: []

[16:01:45] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --accessToken, {REDACTED}, --assetIndex, 1.8, --assetsDir, /Users/Kids/.gradle/caches/minecraft/assets, --version, 1.8, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker]

[16:01:45] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker

[16:01:45] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker

[16:01:45] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker

[16:01:45] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker

[16:01:45] [main/INFO] [FML]: Forge Mod Loader version 8.99.124.1450 for Minecraft 1.8 loading

[16:01:45] [main/INFO] [FML]: Java is Java HotSpot 64-Bit Server VM, version 1.7.0_71, running on Mac OS X:x86_64:10.10.3, installed at /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/jre

[16:01:45] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation

[16:01:45] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker

[16:01:45] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin

[16:01:45] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin

[16:01:45] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker

[16:01:45] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker

[16:01:45] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker

[16:01:45] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker

[16:01:45] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker

[16:01:45] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper

[16:01:45] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work!

[16:01:46] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing

[16:01:46] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper

[16:01:46] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker

[16:01:47] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker

[16:01:47] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker

[16:01:47] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker

[16:01:47] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main}

[16:01:47] [Client thread/INFO]: Setting user: Player669

[16:01:49] [Client thread/INFO]: LWJGL Version: 2.9.2

[16:01:49] [Client thread/INFO] [sTDOUT]: [net.minecraftforge.fml.client.SplashProgress:start:235]: ---- Minecraft Crash Report ----

// Daisy, daisy...

 

Time: 7/14/15 4:01 PM

Description: Loading screen debug info

 

This is just a prompt for computer specs to be printed. THIS IS NOT A ERROR

 

 

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

---------------------------------------------------------------------------------------

 

-- System Details --

Details:

Minecraft Version: 1.8

Operating System: Mac OS X (x86_64) version 10.10.3

Java Version: 1.7.0_71, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 750031840 bytes (715 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML:

Loaded coremods (and transformers):

GL info: ' Vendor: 'ATI Technologies Inc.' Version: '2.1 ATI-1.32.20' Renderer: 'ATI Radeon HD 5770 OpenGL Engine'

[16:01:49] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization

[16:01:49] [Client thread/INFO] [FML]: MinecraftForge v11.14.3.1450 Initialized

[16:01:50] [Client thread/INFO] [FML]: Replaced 204 ore recipies

[16:01:50] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization

[16:01:50] [Client thread/INFO] [FML]: Found 0 mods from the command line. Injecting into mod discoverer

[16:01:50] [Client thread/INFO] [FML]: Searching /Users/Kids/Desktop/MiniMods/MyFit 1.8/eclipse/mods for mods

[16:01:50] [Client thread/INFO] [modid]: Mod modid is missing the required element 'name'. Substituting modid

[16:01:51] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load

[16:01:51] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, modid] at CLIENT

[16:01:51] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, modid] at SERVER

[16:01:51] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:modid

[16:01:51] [Client thread/INFO] [FML]: Processing ObjectHolder annotations

[16:01:51] [Client thread/INFO] [FML]: Found 384 ObjectHolder annotations

[16:01:51] [Client thread/INFO] [FML]: Identifying ItemStackHolder annotations

[16:01:51] [Client thread/INFO] [FML]: Found 0 ItemStackHolder annotations

[16:01:51] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0

[16:01:51] [Client thread/INFO] [FML]: Applying holder lookups

[16:01:51] [Client thread/INFO] [FML]: Holder lookups applied

[16:01:51] [Client thread/INFO] [FML]: Injecting itemstacks

[16:01:51] [Client thread/INFO] [FML]: Itemstack injection complete

[16:01:52] [sound Library Loader/INFO]: Starting up SoundSystem...

[16:01:52] [Thread-8/INFO]: Initializing LWJGL OpenAL

[16:01:52] [Thread-8/INFO]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

[16:01:52] [Thread-8/INFO]: OpenAL initialized.

[16:01:52] [sound Library Loader/INFO]: Sound engine started

[16:01:54] [Client thread/INFO]: Created: 512x512 textures-atlas

[16:01:54] [Client thread/INFO] [FML]: Injecting itemstacks

[16:01:54] [Client thread/INFO] [FML]: Itemstack injection complete

[16:01:54] [Client thread/INFO] [FML]: Forge Mod Loader has successfully loaded 4 mods

[16:01:54] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:modid

[16:01:54] [Client thread/INFO]: SoundSystem shutting down...

[16:01:54] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com

[16:01:54] [sound Library Loader/INFO]: Starting up SoundSystem...

[16:01:55] [Thread-10/INFO]: Initializing LWJGL OpenAL

[16:01:55] [Thread-10/INFO]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

[16:01:55] [Thread-10/INFO]: OpenAL initialized.

[16:01:55] [sound Library Loader/INFO]: Sound engine started

[16:01:55] [Client thread/ERROR] [FML]: Exception loading model modid:item/test with loader instance, skipping

com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unterminated object at line 4 column 26

at com.google.gson.internal.Streams.parse(Streams.java:56) ~[streams.class:?]

at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:54) ~[TreeTypeAdapter.class:?]

at com.google.gson.Gson.fromJson(Gson.java:803) ~[Gson.class:?]

at com.google.gson.Gson.fromJson(Gson.java:741) ~[Gson.class:?]

at net.minecraft.client.renderer.block.model.ModelBlock.deserialize(ModelBlock.java:47) ~[ModelBlock.class:?]

at net.minecraft.client.resources.model.ModelBakery.loadModel(ModelBakery.java:269) ~[ModelBakery.class:?]

at net.minecraftforge.client.model.ModelLoader.access$900(ModelLoader.java:71) ~[ModelLoader.class:?]

at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:534) ~[ModelLoader$VanillaLoader.class:?]

at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:92) [ModelLoaderRegistry.class:?]

at net.minecraftforge.client.model.ModelLoader.loadAnyModel(ModelLoader.java:201) [ModelLoader.class:?]

at net.minecraftforge.client.model.ModelLoader.getModel(ModelLoader.java:184) [ModelLoader.class:?]

at net.minecraftforge.client.model.ModelLoader.loadItems(ModelLoader.java:171) [ModelLoader.class:?]

at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:96) [ModelLoader.class:?]

at net.minecraft.client.resources.model.ModelManager.onResourceManagerReload(ModelManager.java:29) [ModelManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:143) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:121) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:775) [Minecraft.class:?]

at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:331) [FMLClientHandler.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:529) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:356) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_71]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_71]

at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_71]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]

at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]

at GradleStart.main(Unknown Source) [start/:?]

Caused by: com.google.gson.stream.MalformedJsonException: Unterminated object at line 4 column 26

at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1505) ~[JsonReader.class:?]

at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:480) ~[JsonReader.class:?]

at com.google.gson.stream.JsonReader.hasNext(JsonReader.java:403) ~[JsonReader.class:?]

at com.google.gson.internal.bind.TypeAdapters$25.read(TypeAdapters.java:666) ~[TypeAdapters$25.class:?]

at com.google.gson.internal.bind.TypeAdapters$25.read(TypeAdapters.java:667) ~[TypeAdapters$25.class:?]

at com.google.gson.internal.bind.TypeAdapters$25.read(TypeAdapters.java:642) ~[TypeAdapters$25.class:?]

at com.google.gson.internal.Streams.parse(Streams.java:44) ~[streams.class:?]

... 28 more

[16:01:56] [Client thread/INFO]: Created: 512x512 textures-atlas

[16:01:56] [Client thread/ERROR] [FML]: Model definition for location modid:test#inventory not found

 

 

 

edited the original json (at the beginning of the post) to match my current one

Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.

Posted

I don't know exactly how, but it seems your quotation marks around your texture path are... different. I'm not sure why, but if you change it it should fix it. Use this:

{
    "parent":"builtin/generated",
    "textures": {
        "layer0":"modid:items/test"
    },
    "display": {
        "thirdperson": {
            "rotation": [ -90, 0, 0 ],
            "translation": [ 0, 1, -3 ],
            "scale": [ 0.55, 0.55, 0.55 ]
        },
        "firstperson": {
            "rotation": [ 0, -135, 25 ],
            "translation": [ 0, 4, 2 ],
            "scale": [ 1.7, 1.7, 1.7 ]
        }
    }
}

I'll put something here when I have something of value I need to put at the end of every post. For now it's this mostly pointless text.

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

    • You probably used jd-gui to open it, didn't you? Nothing wrong with that, I also made that mistake, except that Notch was a smart guy and he obfuscated the code. That's why you only see files called "a", "b", "c" and then a file that combines them all. As I said, use RetroMCP to deobfuscate the code so that you will 100% understand it and be able to navigate it.
    • Decompiling minecraft indev, infdev, alpha, beta or whichever legacy version is really easy. I'm not a plug, I just also got interested in modding legacy versions (Infdev to be specific). Use https://github.com/MCPHackers/RetroMCP-Java Once you install their client and the Zulu Architecture that they say they recommend (or use your own Java). I encountered some problems, so I run it with: "java -jar RetroMCP-Java-CLI.jar". You should run it in a seperate folder (not in downloads), otherwise the files and folders will go all over the place. How to use RetroMCP: Type setup (every time you want change version), copy-paste the version number from their list (they support indev), write "decompile" and done! The code will now be deobfuscated and filenames will be normal, instead of "a", "b" and "c"! Hope I helped you, but I don't expect you to reply, as this discussion is 9 years old! What a piece of history!  
    • I know that this may be a basic question, but I am very new to modding. I am trying to have it so that I can create modified Vanilla loot tables that use a custom enchantment as a condition (i.e. enchantment present = item). However, I am having trouble trying to implement this; the LootItemRandomChanceWithEnchantedBonusCondition constructor needs a Holder<Enchantment> and I am unable to use the getOrThrow() method on the custom enchantment declared in my mod's enchantments class. Here is what I have so far in the GLM:   protected void start(HolderLookup.Provider registries) { HolderLookup.RegistryLookup<Enchantment> registrylookup = registries.lookupOrThrow(Registries.ENCHANTMENT); LootItemRandomChanceWithEnchantedBonusCondition lootItemRandomChanceWithEnchantedBonusCondition = new LootItemRandomChanceWithEnchantedBonusCondition(0.0f, LevelBasedValue.perLevel(0.07f), registrylookup.getOrThrow(*enchantment here*)); this.add("nebu_from_deepslate", new AddItemModifier(new LootItemCondition[]{ LootItemBlockStatePropertyCondition.hasBlockStateProperties(Blocks.DEEPSLATE).build(), LootItemRandomChanceCondition.randomChance(0.25f).build(), lootItemRandomChanceWithEnchantedBonusCondition }, OrichalcumItems.NEBU.get())); }   Inserting Enchantments.[vanilla enchantment here] actually works but trying to declare an enchantment from my custom enchantments class as [mod enchantment class].[custom enchantment] does not work even though they are both a ResourceKey and are registered in Registries.ENCHANTMENT. Basically, how would I go about making it so that a custom enchantment declared as a ResourceKey<Enchantment> of value ResourceKey.create(Registries.ENCHANTMENT, ResourceLocation.fromNamespaceAndPath([modid], [name])), declared in a seperate enchantments class, can be used in the LootItemRandomChanceWithEnchantedBonusCondition constructor as a Holder? I can't use getOrThrow() because there is no level or block entity/entity in the start() method and it is running as datagen. It's driving me nuts.
    • Hi here is an update. I was able to fix the code so my mod does not crash Minecraft. Please understand that I am new to modding but I honestly am having a hard time understanding how anyone can get this to work without having extensive programming and debugging experience as well as searching across the Internet, multiple gen AI bots (claude, grok, openai), and examining source code hidden in the gradle directory and in various github repositories. I guess I am wrong because clearly there are thousands of mods so maybe I am just a newbie. Ok, rant over, here is a step by step summary so others can save the 3 days it took me to figure this out.   1. First, I am using forge 54.1.0 and Minecraft 1.21.4 2. I am creating a mod to add a shotgun to Minecraft 3. After creating the mod and compiling it, I installed the .jar file to the proper directory in Minecraft and used 1.21.4-forge-54.1.0 4. The mod immediately crashed with the error: Caused by: java.lang.NullPointerException: Item id not set 5. Using the stack trace, I determined that the Exception was being thrown from the net.minecraft.world.item.Item.Properties class 6. It seems that there are no javadocs for this class, so I used IntelliJ which was able to provide a decompiled version of the class, which I then examined to see the source of the error. Side question: Are there javadocs? 7. This method, specifically, was the culprit: protected String effectiveDescriptionId() {      return this.descriptionId.get(Objects.requireNonNull(this.id, "Item id not set"));  } 8. Now my quest was to determine how to set this.id. Looking at the same source file, I determined there was another method:  public Item.Properties setId(ResourceKey<Item> pId) {             this.id = pId;             return this;   } 9. So now, I need to figure out how to call setId(). This required working backwards a bit. Starting from the constructor, I stubbed out the variable p which is of type Item.Properties public static final RegistryObject<Item> SHOTGUN = ITEMS.register("shotgun", () -> new ShotgunItem(p)); Rather than putting this all on one line, I split it up for readability like this: private static final Item.Properties p = new Item.Properties().useItemDescriptionPrefix().setId(rk); Here is was the missing function, setId(), which takes a type of ResourceKey<Item>. My next problem is that due to the apparent lack of documentation (I tried searching the docs on this site) I could not determine the full import path to ResourceKey. I did some random searching on the Internet and stumbled across a Github repository which gave two clues: import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; Then I created the rk variable like this: private static ResourceKey<Item> rk = ResourceKey.create(Registries.ITEM, ResourceLocation.parse("modid:shotgunmod")); And now putting it all together in order: private static ResourceKey<Item> rk = ResourceKey.create(Registries.ITEM, ResourceLocation.parse("modid:shotgunmod")); private static final Item.Properties p = new Item.Properties().useItemDescriptionPrefix().setId(rk); public static final RegistryObject<Item> SHOTGUN = ITEMS.register("shotgun", () -> new ShotgunItem(p)); This compiled and the mod no longer crashes. I still have more to do on it, but hopefully this will save someone hours. I welcome any feedback and if I missed some obvious modding resource or tutorial that has this information. If not, I might suggest we add it somewhere for people trying to write a mod that doesn't crash. Thank you !!!  
  • Topics

×
×
  • Create New...

Important Information

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