Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hello community!

 

I glaldy heard that it is now possible to use Obj's with forge again since Forge 1.8-11.14.4.1563

 

I'm a newbie in that case and heared there are differences between 1.7.10 and 1.8 Obj model implementation.

I hoped that eventually a tutorial for 1.7.10 would work in 1.8 either but yeah, I was wrong.

 

 

Can someone guide me trough this?

  • Author

Thank you very much sir!

 

That's at least something to begin with!

If you have any questions regarding with this, feel free to ask me, since i was able to get it working.

Its fairly simple AND laggy. DO not plan to use "HQ" models, because MC engine cannot handle it.

  • Author

Thank you for your help, I surely will ask you if I have anything messy.

 

Thanks again, and see you later!

  • Author

Well, here is an update of my status.

 

I took the code as it was and did change the structure a bit.

 

I placed all classes in the ModelLoaderRegistryDebug.java file in sepereta java files.

I placed the java files in an own package:

 

net.clash_of_nations.forge.confacilities.obj ->

 

CustomModelBlock.java

OBJCustomDataBlock.java

OBJDirectionBlock.java

OBJDirectionEye.java

OBJDynamicEye.java

OBJDynamicEyeTileEntity.java (temporarily placed here)

OBJTesseractBlock.java

OBJTesseractBlockTileEntity.java

OBJVertexColoring1.java

OBJVertexColoring2.java

OBJVertexColoring2TileEntity.java

 

(I didn't change any code and implemented all necessary packages)

 

So my ModelLoaderRegistryDebug.java file (renamed to ObjReg.java) only contains this code (It serves as a list for the initialization in my main java file called CoNFacilities.java):

 

 

package net.clash_of_nations.forge.confacilities;

import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.client.model.b3d.B3DLoader;
import net.minecraftforge.client.model.obj.OBJLoader;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.clash_of_nations.forge.confacilities.CoNFacilities;
import net.clash_of_nations.forge.confacilities.obj.CustomModelBlock;
import net.clash_of_nations.forge.confacilities.obj.OBJCustomDataBlock;
import net.clash_of_nations.forge.confacilities.obj.OBJDirectionBlock;
import net.clash_of_nations.forge.confacilities.obj.OBJTesseractBlock;
import net.clash_of_nations.forge.confacilities.obj.OBJTesseractTileEntity;
import net.clash_of_nations.forge.confacilities.obj.OBJVertexColoring1;
import net.clash_of_nations.forge.confacilities.obj.OBJVertexColoring2;
import net.clash_of_nations.forge.confacilities.obj.OBJVertexColoring2TileEntity;
import net.clash_of_nations.forge.confacilities.obj.OBJDirectionEye;
import net.clash_of_nations.forge.confacilities.obj.OBJDynamicEye;
import net.clash_of_nations.forge.confacilities.obj.OBJDynamicEyeTileEntity;

public class ObjReg{

static String MODID = CoNFacilities.MODID;

    public static void objLoaderInit(){
    	
        GameRegistry.registerBlock(CustomModelBlock.instance, CustomModelBlock.name);
        GameRegistry.registerBlock(OBJTesseractBlock.instance, OBJTesseractBlock.name);
        GameRegistry.registerBlock(OBJVertexColoring1.instance, OBJVertexColoring1.name);
        GameRegistry.registerBlock(OBJDirectionEye.instance, OBJDirectionEye.name);
        GameRegistry.registerBlock(OBJVertexColoring2.instance, OBJVertexColoring2.name);
        GameRegistry.registerBlock(OBJDirectionBlock.instance, OBJDirectionBlock.name);
        GameRegistry.registerBlock(OBJCustomDataBlock.instance, OBJCustomDataBlock.name);
        GameRegistry.registerBlock(OBJDynamicEye.instance, OBJDynamicEye.name);
        GameRegistry.registerTileEntity(OBJTesseractTileEntity.class, OBJTesseractBlock.name);
        GameRegistry.registerTileEntity(OBJVertexColoring2TileEntity.class, OBJVertexColoring2.name);
        GameRegistry.registerTileEntity(OBJDynamicEyeTileEntity.class, OBJDynamicEye.name);

    }

public static void objClientPreInit(){
    	
        B3DLoader.instance.addDomain(MODID.toLowerCase());
        Item item = Item.getItemFromBlock(CustomModelBlock.instance);
        ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + CustomModelBlock.name, "inventory"));
        
        OBJLoader.instance.addDomain(MODID.toLowerCase());
        Item item2 = Item.getItemFromBlock(OBJTesseractBlock.instance);
        ModelLoader.setCustomModelResourceLocation(item2, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + OBJTesseractBlock.name, "inventory"));
        
        Item item3 = Item.getItemFromBlock(OBJVertexColoring1.instance);
        ModelLoader.setCustomModelResourceLocation(item3, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + OBJVertexColoring1.name, "inventory"));
        
        Item item4 = Item.getItemFromBlock(OBJDirectionEye.instance);
        ModelLoader.setCustomModelResourceLocation(item4, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + OBJDirectionEye.name, "inventory"));
        
        Item item5 = Item.getItemFromBlock(OBJVertexColoring2.instance);
        ModelLoader.setCustomModelResourceLocation(item5, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + OBJVertexColoring2.name, "inventory"));
        
        Item item6 = Item.getItemFromBlock(OBJDirectionBlock.instance);
        ModelLoader.setCustomModelResourceLocation(item6, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + OBJDirectionBlock.name, "inventory"));
        
        Item item7 = Item.getItemFromBlock(OBJCustomDataBlock.instance);
        ModelLoader.setCustomModelResourceLocation(item7, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + OBJCustomDataBlock.name, "inventory"));
        
        Item item8 = Item.getItemFromBlock(OBJDynamicEye.instance);
        ModelLoader.setCustomModelResourceLocation(item8, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + OBJDynamicEye.name, "inventory"));
        
    }
}

 

 

 

They are like I said initialized in my main CoNFacilities java file:

 

 

package net.clash_of_nations.forge.confacilities;

import net.clash_of_nations.forge.confacilities.ObjReg;
import net.clash_of_nations.forge.confacilities.blocks.BlockLoader;

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.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.relauncher.Side;



@Mod(modid = CoNFacilities.MODID)
public class CoNFacilities {

public static final String MODID = "CoNFacilities";

@Instance
public static CoNFacilities instance = new CoNFacilities();

@EventHandler
public void preInit(FMLPreInitializationEvent e) {
	System.out.println("[PreInit] Loading Configuration.");
	ObjReg.objLoaderInit();
        if (e.getSide() == Side.CLIENT){
        ObjReg.objClientPreInit();
        }
}


@EventHandler
public void init(FMLInitializationEvent e){
	System.out.println("[ModInit] Loading Mod.");
	BlockLoader.loadBlocks();


}

@EventHandler
public void postInit(FMLPostInitializationEvent e){
	System.out.println("[PostInit] Loading connections between Mods.");
}

}

 

 

 

I did this because I think it makes it easier for me to keep everything in sight and makes my main file less messy.

 

I also placed all obj models in the package:

assets.confacilities.models.obj

 

all textures in the package:

assets.confacilities.textures.objs

 

all .json (blockstates) in the package:

assets.confacilities.blockstates

 

I updated all references for textures and models in the .json files.

 

So, when I try to start this whole thing, the game starts, but without loading my OBJ's. It is loading my simple Block that I created which is loaded here:

...	
@EventHandler
public void init(FMLInitializationEvent e){
	System.out.println("[ModInit] Loading Mod.");
	BlockLoader.loadBlocks();


}
...

 

BlockLoader.loadBlocks(); is the important line.

 

When I take a look to the console, it smashes out one error:

EDIT: I solved this problem. Was an unimportant mcmod.info error. I don't get any errors.

 

Did I do something wrong?

 

Please let me know if you need something else to see the error.

 

I'm glad for everyone who helps and thank you guys!

  • Author

Nevermind, brought it to work!

 

There were just simple logic problems in the classes, because i seperatet them. Everything works fine now!

 

Thanks to everyone helping me trough this. If you have also questions, you can ask me too now :).

 

Have a nice day everyone!

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.