Jump to content

[SOLVED!] [1.12.2]Making an item using an OBJ model and blockstates JSON


Recommended Posts

Posted
10 minutes ago, Thegametutor101 said:

If i don't put the .obj wouldn't it get confused between pokeball.obj and pokeball.mtl..?

No. .mtl is not a .obj file. AFAIK It will look for .obj files first if you called OBJLoader.addDomain, then it will look for .json files.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
2 hours ago, Thegametutor101 said:

@V0idWa1k3r ok so..i went through the entire .obj file and fixed all negative "vt"s but the issue is still the same... any other idea?

Well, if you would update your github repository I could debug it and tell you the next issue.

Posted
8 hours ago, Cadiboo said:

No. .mtl is not a .obj file. AFAIK It will look for .obj files first if you called OBJLoader.addDomain, then it will look for .json files.

Done..still doesn't work

 

8 hours ago, V0idWa1k3r said:

Well, if you would update your github repository I could debug it and tell you the next issue.

here you go:

https://github.com/Thegametutor101/Pixelmon_Project_School/tree/Pixelmon_Main

Posted

Now you never call the pre-init method in your proxy, thus the OBJLoader doesn't know that it is supposed to process your mod. You did have it called previously, why you removed that lime of code I don't know.

You do need the .obj extension at the definition of your model so the OBJLoader itself knows that you are looking for a wavefront model.

 

Also stop using common proxy, it makes no sense.

And don't have your common proxy as your server proxy, that makes even less sense.

 

And well, it took me a while to figure this issue out, but your blockstates file isn't a forge blockstates file. 

forge_maker != forge_marker.

 

Now those issues done and all your obj model is still broken.

Quote

Caused by: java.lang.RuntimeException: OBJLoader.Parser: Exception parsing line #986: `vt 1.029911 0.247618`

UVs MUST be within a [0-1] bounds. This one isn't.

  • Like 1
Posted
11 hours ago, V0idWa1k3r said:

Now you never call the pre-init method in your proxy, thus the OBJLoader doesn't know that it is supposed to process your mod. You did have it called previously, why you removed that lime of code I don't know.

You do need the .obj extension at the definition of your model so the OBJLoader itself knows that you are looking for a wavefront model.

 

Also stop using common proxy, it makes no sense.

And don't have your common proxy as your server proxy, that makes even less sense.

 

And well, it took me a while to figure this issue out, but your blockstates file isn't a forge blockstates file. 

forge_maker != forge_marker.

 

Now those issues done and all your obj model is still broken.

UVs MUST be within a [0-1] bounds. This one isn't.

OH YEAH!! Finally it works!!

I placed the OBJLoader back in the Main's preInit

Checked every single line for vt out of bounds

Corrected the forge_marker tag I miss spelled

Set the Main to use the ClientProxy instead of CommonProxy

 

ok the model needs work but it finally loads!! Thank you so Much @V0idWa1k3r!!!

 

 

2019-04-22_12.19.36.png

Posted
6 hours ago, Thegametutor101 said:

I placed the OBJLoader back in the Main's preInit

This will crash on a dedicated server

6 hours ago, Thegametutor101 said:

Set the Main to use the ClientProxy instead of CommonProxy

This entirely defeats the whole point of proxies and will crash very uglily on a dedicated server

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
56 minutes ago, Cadiboo said:

This will crash on a dedicated server

This entirely defeats the whole point of proxies and will crash very uglily on a dedicated server

Oh..ok so how should I call the OBJLoader if it is in the ClientProxy?..

Posted (edited)

I would just not use proxies at all. I would put OBJLoader.addDomain in the static initialisers of my client event subscriber.

Proxies work by having a common interface that both your server and client proxy implement and having a field with @SidedProxy that Forge will fill with an instance of either your server or client proxy class when your mod is loaded. This allows you to run code that will crash on the wrong physical side. For your problem you should have a method in your proxy interface called addOBJLoaderDomainIfOnClient. Then your server proxy should have a NOOP implementation (an implementation that doesn’t do anything at all) and your client proxy should have an implementation that calls OBJLoader.addDomain. You would then call PROXY.addOBJLoaderDomainIfOnClientin preInit. On the dedicated server this would do nothing, and on the client it will register your domain.

As you can see, proxies are a lot more complicated than sided event subscribers where everything just works(tm).

Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
31 minutes ago, Cadiboo said:

I would just not use proxies at all. I would put OBJLoader.addDomain in the static initialisers of my client event subscriber.

Proxies work by having a common interface that both your server and client proxy implement and having a field with @SidedProxy that Forge will fill with an instance of either your server or client proxy class when your mod is loaded. This allows you to run code that will crash on the wrong physical side. For your problem you should have a method in your proxy interface called addOBJLoaderDomainIfOnClient. Then your server proxy should have a NOOP implementation (an implementation that doesn’t do anything at all) and your client proxy should have an implementation that calls OBJLoader.addDomain. You would then call PROXY.addOBJLoaderDomainIfOnClientin preInit. On the dedicated server this would do nothing, and on the client it will register your domain.

As you can see, proxies are a lot more complicated than sided event subscribers where everything just works(tm).

Ok. So if I understand correctly:

 

I create a method in the Proxies named "addOBJLoaderDomainIfOnClient" that has inside of it the OBJLoader.addDomain.

 

Then in my RegistryHandler (where I register all items/blocks @BusSubscribeEvent) I would call the method in my proxy through a @SubscribeEvent.

 

And finally I have the CommonProxy implement "NOOP"

 

...is that right?

 

I'm not sure if you mean't I call the "addOBJLoaderDomainIfOnClient" method from the Main's preInit

or in a "@BusSubscribeEvent" s "@SubscribeEvent".

Posted
1 minute ago, Thegametutor101 said:

I create a method in the Proxies named "addOBJLoaderDomainIfOnClient" that has inside of it the OBJLoader.addDomain.

No, you create an empty method if you’re using a normal class or an abstract method if your using an abstract class or define a method if your using an interface.

2 minutes ago, Thegametutor101 said:

Then in my RegistryHandler (where I register all items/blocks @BusSubscribeEvent) I would call the method in my proxy through a @SubscribeEvent.

This would work but it doesn’t make sense to call it from there, you would call the method in preInit.

3 minutes ago, Thegametutor101 said:

And finally I have the CommonProxy implement "NOOP"

If your using a class, yes. NOOP stands for NO OPeration i.e. do nothing.

 

4 minutes ago, Thegametutor101 said:

I'm not sure if you mean't I call the "addOBJLoaderDomainIfOnClient" method from the Main's preInit

or in a "@BusSubscribeEvent" s "@SubscribeEvent".

If your using a proxy, you would call it from preInit. If you’re doing it in a client event subscriber you can just call it from inside a static initialiser, without any other code at all.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
4 minutes ago, Cadiboo said:

No, you create an empty method if you’re using a normal class or an abstract method if your using an abstract class or define a method if your using an interface.

This would work but it doesn’t make sense to call it from there, you would call the method in preInit.

If your using a class, yes. NOOP stands for NO OPeration i.e. do nothing.

 

If your using a proxy, you would call it from preInit. If you’re doing it in a client event subscriber you can just call it from inside a static initialiser, without any other code at all.

Ok perfect, I will try to implement all of this info into my mod

Posted
14 hours ago, Cadiboo said:

No, you create an empty method if you’re using a normal class or an abstract method if your using an abstract class or define a method if your using an interface.

This would work but it doesn’t make sense to call it from there, you would call the method in preInit.

If your using a class, yes. NOOP stands for NO OPeration i.e. do nothing.

 

If your using a proxy, you would call it from preInit. If you’re doing it in a client event subscriber you can just call it from inside a static initialiser, without any other code at all.

Ok! did it all and everything works perfectly! Thank you @Cadiboo for explaning proxies for me :)

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

    • What in particular? I barely used that mod this time around, and it's never been a problem in the past.
    • Im trying to build my mod using shade since i use the luaj library however i keep getting this error Reason: Task ':reobfJar' uses this output of task ':shadowJar' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. So i try adding reobfJar.dependsOn shadowJar  Could not get unknown property 'reobfJar' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. my gradle file plugins { id 'eclipse' id 'idea' id 'maven-publish' id 'net.minecraftforge.gradle' version '[6.0,6.2)' id 'com.github.johnrengelman.shadow' version '7.1.2' id 'org.spongepowered.mixin' version '0.7.+' } apply plugin: 'net.minecraftforge.gradle' apply plugin: 'org.spongepowered.mixin' apply plugin: 'com.github.johnrengelman.shadow' version = mod_version group = mod_group_id base { archivesName = mod_id } // Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. java.toolchain.languageVersion = JavaLanguageVersion.of(17) //jarJar.enable() println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" minecraft { mappings channel: mapping_channel, version: mapping_version copyIdeResources = true runs { configureEach { workingDirectory project.file('run') property 'forge.logging.markers', 'REGISTRIES' property 'forge.logging.console.level', 'debug' arg "-mixin.config=derp.mixin.json" mods { "${mod_id}" { source sourceSets.main } } } client { // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. property 'forge.enabledGameTestNamespaces', mod_id } server { property 'forge.enabledGameTestNamespaces', mod_id args '--nogui' } gameTestServer { property 'forge.enabledGameTestNamespaces', mod_id } data { workingDirectory project.file('run-data') args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') } } } sourceSets.main.resources { srcDir 'src/generated/resources' } repositories { flatDir { dirs './libs' } maven { url = "https://jitpack.io" } } configurations { shade implementation.extendsFrom shade } dependencies { minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" implementation 'org.luaj:luaj-jse-3.0.2' implementation fg.deobf("com.github.Virtuoel:Pehkui:${pehkui_version}") annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' minecraftLibrary 'luaj:luaj-jse:3.0.2' shade 'luaj:luaj-jse:3.0.2' } // Example for how to get properties into the manifest for reading at runtime. tasks.named('jar', Jar).configure { manifest { attributes([ 'Specification-Title' : mod_id, 'Specification-Vendor' : mod_authors, 'Specification-Version' : '1', // We are version 1 of ourselves 'Implementation-Title' : project.name, 'Implementation-Version' : project.jar.archiveVersion, 'Implementation-Vendor' : mod_authors, 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", "TweakOrder" : 0, "MixinConfigs" : "derp.mixin.json" ]) } rename 'mixin.refmap.json', 'derp.mixin-refmap.json' } shadowJar { archiveClassifier = '' configurations = [project.configurations.shade] finalizedBy 'reobfShadowJar' } assemble.dependsOn shadowJar reobf { re shadowJar {} } publishing { publications { mavenJava(MavenPublication) { artifact jar } } repositories { maven { url "file://${project.projectDir}/mcmodsrepo" } } }  
    • All versions of Minecraft Forge suddenly black screen even without mods (tried reinstalling original Minecraft, Java, updating drivers doesn't work)
  • Topics

×
×
  • Create New...

Important Information

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