Jump to content

Recommended Posts

Posted

Hello, i've created a block in my ModBlocks class. When i place it the texture works perfectly fine but it won't render in my inventory. (Jason and texture images are all named correctly).

Here is my code:

 

public class ModBlocks

{

public static Block black_cobblestone;

 

 

public static void init()

{

black_cobblestone = new Block(Material.ROCK).setRegistryName("black_cobblestone").setUnlocalizedName("black_cobblestone").setCreativeTab(Tabs.tabStoneBlocks);

}

 

 

 

public static void registerRenders()

{

registerRender(black_cobblestone);

}

 

public static void register()

{

registerBlock(black_cobblestone);

}

 

public static void registerBlock(Block block)

{

GameRegistry.register(block);

ItemBlock item = new ItemBlock(block);

item.setRegistryName(block.getRegistryName());

GameRegistry.register(item);

}

 

public static void registerRender(Block block)

{

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory"));

}

}

 

I don't have any separate class for each item.

Please can you help it is really important thanks!

Posted

[*]Do not use

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register

for rendering. It's purely the years of experience and extensive knowledge of the rendering system, that let the Mojang coders keep the vanilla rendering "above the water".

[*]Use the forge provided

ModelLoader

instead: Exactly the same variables used to call it. Just switch out

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register

for

 ModelLoader.setCustomModelResourceLocation

[*]

ModelLoader

rendering has to be called in

preInit

, of course, after the blocks & items have been registered.

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Posted

I've done what you said, now the registeRenders is like this:

ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "Inventory"));

 

But now the game crashes, here is the crash report

 

---- Minecraft Crash Report ----

// Ouch. That hurt :(

 

Time: 8/29/16 11:37 AM

Description: Initializing game

 

java.lang.NullPointerException: Initializing game

at net.minecraftforge.client.model.ModelLoader.setCustomModelResourceLocation(ModelLoader.java:1095)

at com.rage.mod.init.ModBlocks.registerRender(ModBlocks.java:49)

at com.rage.mod.init.ModBlocks.registerRenders(ModBlocks.java:30)

at com.rage.mod.proxy.ClientProxy.preInit(ClientProxy.java:17)

at com.rage.mod.main.Main.preInit(Main.java:31)

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.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:597)

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 com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:239)

at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:217)

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 com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:142)

at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:607)

at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:255)

at net.minecraft.client.Minecraft.startGame(Minecraft.java:477)

at net.minecraft.client.Minecraft.run(Minecraft.java:386)

at net.minecraft.client.main.Main.main(Main.java:118)

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)

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.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.minecraftforge.client.model.ModelLoader.setCustomModelResourceLocation(ModelLoader.java:1095)

at com.rage.mod.init.ModBlocks.registerRender(ModBlocks.java:49)

at com.rage.mod.init.ModBlocks.registerRenders(ModBlocks.java:30)

at com.rage.mod.proxy.ClientProxy.preInit(ClientProxy.java:17)

at com.rage.mod.main.Main.preInit(Main.java:31)

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.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:597)

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 com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:239)

at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:217)

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 com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:142)

at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:607)

at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:255)

at net.minecraft.client.Minecraft.startGame(Minecraft.java:477)

 

-- Initialization --

Details:

Stacktrace:

at net.minecraft.client.Minecraft.run(Minecraft.java:386)

at net.minecraft.client.main.Main.main(Main.java:118)

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)

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.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)

at GradleStart.main(GradleStart.java:26)

 

-- System Details --

Details:

Minecraft Version: 1.10.2

Operating System: Mac OS X (x86_64) version 10.11.3

Java Version: 1.8.0_65, Oracle Corporation

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

Memory: 810039560 bytes (772 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)

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

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

FML: MCP 9.32 Powered by Forge 12.18.1.2073 4 mods loaded, 4 mods active

States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

UCH mcp{9.19} [Minecraft Coder Pack] (minecraft.jar)

UCH FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.10.2-12.18.1.2073.jar)

UCH Forge{12.18.1.2073} [Minecraft Forge] (forgeSrc-1.10.2-12.18.1.2073.jar)

UCE bcraft{1.10-R1} [block Craft] (bin)

Loaded coremods (and transformers):

Launched Version: 1.10.2

LWJGL: 2.9.2

OpenGL: NVIDIA GeForce GT 750M OpenGL Engine GL version 2.1 NVIDIA-10.8.14 310.42.15f01, NVIDIA Corporation

GL Caps: Using GL 1.3 multitexturing.

Using GL 1.3 texture combiners.

Using framebuffer objects because ARB_framebuffer_object 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 Intel® Core i7-4980HQ CPU @ 2.80GHz

Posted

 

Main class:

 

 

package com.rage.mod.main;

 

import org.apache.logging.log4j.Logger;

 

import com.rage.mod.proxy.CommonProxy;

 

import net.minecraft.block.Block;

import net.minecraftforge.fml.common.Mod;

import net.minecraftforge.fml.common.Mod.EventHandler;

import net.minecraftforge.fml.common.Mod.Instance;

import net.minecraftforge.fml.common.SidedProxy;

import net.minecraftforge.fml.common.event.FMLInitializationEvent;

import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;

import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

 

@Mod(modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION)

 

public class Main {

 

@SidedProxy(clientSide = Reference.CLIENTPROXY, serverSide = Reference.COMMONPROXY)

public static CommonProxy proxy; 

@Instance

public static Main instance;

 

public static Logger logger;

 

@EventHandler

public void preInit(FMLPreInitializationEvent event)

{

logger = event.getModLog();

proxy.preInit(event);

}

@EventHandler

public void init(FMLInitializationEvent event)

{

proxy.init(event);

 

}

@EventHandler

public void postInit(FMLPostInitializationEvent event)

{

proxy.postInit(event);

}

}

 

 

 

Client Proxy

 

 

package com.rage.mod.proxy;

 

import com.rage.mod.init.ModBlocks;

 

import net.minecraftforge.fml.common.event.FMLInitializationEvent;

import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;

import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

 

public class ClientProxy extends CommonProxy

{

 

@Override

public void preInit(FMLPreInitializationEvent event)

{

super.preInit(event);

ModBlocks.init();

ModBlocks.registerRenders();

ModBlocks.register();

}

@Override

public void init(FMLInitializationEvent event)

{

super.init(event);

 

 

}

@Override

public void postInit(FMLPostInitializationEvent event)

{

super.postInit(event);

}

 

}

 

 

 

 

Common Proxy

 

 

package com.rage.mod.proxy;

 

import net.minecraftforge.fml.common.event.FMLInitializationEvent;

import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;

import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

 

public class CommonProxy {

 

public void preInit(FMLPreInitializationEvent event)

{

 

}

 

public void init(FMLInitializationEvent event)

{

 

}

 

public void postInit(FMLPostInitializationEvent event)

{

 

}

}

 

 

 

Posted

yeah, as I thought.

ModelLoader

rendering has to be called in

preInit

, of course, after the blocks & items have been registered.

You try to set the render for blocks, that does not yet exist.

 

Switch these around:

ModBlocks.registerRenders();

ModBlocks.register();

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Posted

>_<

Damnit, failed to see in time.

If you read this post, would you mind answering why you have your Block Registration, in the Client-Proxy?

That should be in the common-proxy, otherwise, if you load up a server with this, there will not be any blocks, because the server cannot see them, literally, if the server doesn't crash before that.

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Posted

If you read this post, would you mind answering why you have your Block Registration, in the Client-Proxy?

That should be in the common-proxy

 

Or your main mod class.

I see no point in passing off the initialization events to the proxy classes when they can just do the work themselves.  Prior to 1.8 my common proxy would be virtually empty except for the stub methods for the client proxy to override.

 

Now in 1.10 it contains several wrapper methods around GameRegistry.register so I don't have to set the registryName between creating the item and registering it.

 

End result, my main class is full of the dirty work (a lot of people put this in a

ModBlocks

class, and that's fine, but there's litterally no reason to pass the event off to the proxy, only to call ModBlocks.doStuff(): just call doStuff from Main!)

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

    • *** buffer overflow detected ***: terminated /usr/bin/forge-1.12.2d: line 162: 15787 Aborted                 (core dumped) ${SUDO_CMD} screen -S "${SESSION_NAME}" -Q select . > /dev/null Starting server...There are several suitable screens on:     14630.forge-1.12.2    (Detached)     15796.forge-1.12.2    (Detached) Use -S to specify a session How do i fix this issue?
    • Oh I forgot to update the title. I figured out the issue and I'm rather embarrassed to say that it was a file path issue. The game already knew I was accessing the achievements so I wasn't suppose to include advancements in the file path. Minecraft file paths have always confused me a little bit... ResourceLocation advancementId = new ResourceLocation( TheDeadRise.MODID,"adventure/spawntrigger");
    • Can someone help my with this? My forge server won't open and I'm not that good with this stuff. It gave me this error message:   C:\Users\apbeu\Desktop\Forge server>java -Xmx4G -Xms1G -jar server.jar nogui 2024-12-11 18:21:01,054 main WARN Advanced terminal features are not available in this environment [18:21:01] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher running: args [--gameDir, ., --launchTarget, fmlserver, --fml.forgeVersion, 36.2.34, --fml.mcpVersion, 20210115.111550, --fml.mcVersion, 1.16.5, --fml.forgeGroup, net.minecraftforge, nogui] [18:21:01] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher 8.1.3+8.1.3+main-8.1.x.c94d18ec starting: java version 21.0.4 by Oracle Corporation Exception in thread "main" java.lang.IllegalAccessError: class cpw.mods.modlauncher.SecureJarHandler (in unnamed module @0x402e37bc) cannot access class sun.security.util.ManifestEntryVerifier (in module java.base) because module java.base does not export sun.security.util to unnamed module @0x402e37bc         at cpw.mods.modlauncher.SecureJarHandler.lambda$static$1(SecureJarHandler.java:45)         at cpw.mods.modlauncher.api.LamdbaExceptionUtils.uncheck(LamdbaExceptionUtils.java:95)         at cpw.mods.modlauncher.SecureJarHandler.<clinit>(SecureJarHandler.java:45)         at cpw.mods.modlauncher.Launcher.lambda$new$6(Launcher.java:55)         at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)         at cpw.mods.modlauncher.api.TypesafeMap.computeIfAbsent(TypesafeMap.java:52)         at cpw.mods.modlauncher.api.TypesafeMap.computeIfAbsent(TypesafeMap.java:47)         at cpw.mods.modlauncher.Environment.computePropertyIfAbsent(Environment.java:62)         at cpw.mods.modlauncher.Launcher.<init>(Launcher.java:55)         at cpw.mods.modlauncher.Launcher.main(Launcher.java:66)         at net.minecraftforge.server.ServerMain$Runner.runLauncher(ServerMain.java:63)         at net.minecraftforge.server.ServerMain$Runner.access$100(ServerMain.java:60)         at net.minecraftforge.server.ServerMain.main(ServerMain.java:57) C:\Users\apbeu\Desktop\Forge server>pause
    • Here is the url for the crash report if anyone can help me, please. https://mclo.gs/KGn5LWy  
    • Every single time I try and open my modpack it crashes before the game fully opens and I don't know what is wrong. I open the crash logs but I don't understand what any of it means. What do I do?
  • Topics

×
×
  • Create New...

Important Information

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