Jump to content

Recommended Posts

Posted
Learningmod.java
package Com.absithiumgamer.learningmod;
import Com.absithiumgamer.learningmod.proxy.CommonProxy;
import init.ModItems;
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.MOD_ID, name = Reference.NAME, version = Reference.VERSION, acceptedMinecraftVersions = Reference.ACCEPTED_VESRIONS)

	public class learningmod {
	
	@Instance
	public static learningmod instance;

	@SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)
	public static CommonProxy proxy;

	@EventHandler
	public void preInit(FMLPreInitializationEvent event)
	{
		ModItems.init();
		ModItems.register();
	}
	
	@EventHandler
	public void Init(FMLInitializationEvent event)
	{
		proxy.init();	
	}
	
	@EventHandler
	public void postInit(FMLPostInitializationEvent event)
	{
		
	}
}

Reference
package Com.absithiumgamer.learningmod;

public class Reference {

	public static final String MOD_ID = "alm";
	public static final String NAME = "Learning Mod";
	public static final String VERSION="1.0";
	public static final String ACCEPTED_VESRIONS = "[1.11.2]";
	
	public static final String CLIENT_PROXY_CLASS = "Com.absithiumgamer.learningmod.proxy.ClientProxy";
	public static final String SERVER_PROXY_CLASS = "Com.absithiumgamer.learningmod.proxy.Serverproxy";
	
	public static enum learningmodItems{
			OBSIDIANINGOT("obsidianingot","ItemObsidianingot");
		
		private String unlocalizedName;
		private String registryName;
		
		learningmodItems(String unlocalizedName,String registryName) {
			this.unlocalizedName = unlocalizedName;
			this.registryName = registryName;
		}
			public String getUnlocalizedName() {
				return unlocalizedName;
			}
			public String getRegistryName() {
				return registryName;
			}
	}
}

ModItems.java
package init;

import items.ItemObsidianingot;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class ModItems {
	
	public static Item obsidianingot;
	
	public static void init () {
		obsidianingot = new ItemObsidianingot();
	}
	
	public static void register() {
		GameRegistry.register(obsidianingot);
	}
	
	public static void registerRenders() {
		registerRender(obsidianingot);
	}
	
	private static void registerRender(Item item) {
		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
	}
	
}

ItemObsidianingot
package items;

import Com.absithiumgamer.learningmod.Reference;
import net.minecraft.item.Item;

public class ItemObsidianingot extends Item {
	
	public ItemObsidianingot() {
		setUnlocalizedName(Reference.learningmodItems.OBSIDIANINGOT.getUnlocalizedName());
		setRegistryName(Reference.learningmodItems.OBSIDIANINGOT.getRegistryName());
	}
}

itemobsidianingot
{
    "parent": "item/generated",
    "textures": {
        "layer0": "alm:item/obsidianingot"
     },
     
    "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]
        }
    }
}

en_US.lang
item.obsidianingot.name=Obsidian Ingot

Any help would be appreciated the problem is that the item texture does not display in the game 

Posted
4 hours ago, diesieben07 said:

You just use setCustomModelResourceLocation instead of the ItemModelMesher method.

Coming from someone who updated all of his projects quite recently, I actually had a lot of trouble trying to update. I can understand why they are confused. I'd offer to help, but my "patchwork" is shoddy on that bit. I often just update ItemModelMesher on my old mods to match the current syntax, and just use ModelLoader on new projects.

 

ItemModelMesher works, but it doesn't work well. ModelLoader is a lot more stable.

  • Like 1

Follow these rules when talking to me, and we'll get along fine.

1).I know Java fairly well. I don't know as much about modding. They are not the same, don't compare them.

2). I consider myself to always be learning. I make mistakes, you make mistakes. Who doesn't?

3). Insult me, and I will leave the thread. I have a real life, I don't have time to throw petty insults in a Minecraft Modding forum.

 

ModMCdl - Co-Founder and Director of Design for Artemis Game Studios

Posted
10 hours ago, ModMCdl said:

ItemModelMesher works, but it doesn't work well. ModelLoader is a lot more stable.

This is because the ModelMesher is Mojang's code and must be called at a very specific point during startup, whereas the ModelLoader is Forge supplied so that you (as a modder) can't fuck up.

  • Like 1

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.

Posted
private static void registerRender(Item item) {
		Minecraft.getMinecraft().getRenderItem().setcustommodelresourcelocation().register(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
	}
	
}

i replaced them but get the error method.setcustommodelresourcelocation()cant be resolved

Posted

ModelLoader is a static class. That means in stead of:

Minecraft.getMinecraft().getRenderItem()

You put

ModelLoader

And then because method names are case-sensitive, you need to use:

setCustomModelResourceLocation

instead of

setcustommodelresourcelocation

 

This really isn't that hard.

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.

Posted

 

(ModelLoader).setCustomModelResourceLocation(obsidianingot, 0, null).register(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));

i got this but it says model loader cannot be resolved to a variable and line breakpoint: mod items line 26 register render(items)

 

Posted

It looks like you might need to study some Java fundamentals, because this is fairly basic syntax that you seem to be having trouble with. The correct line is:

ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));

 

Posted
12 minutes ago, Absithium_gamer said:

thx and yea probably new to java script

Java is to Javascript as Car is to Carpet.

  • Like 2

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.

Posted
6 hours ago, Draco18s said:

Java is to Javascript as Car is to Carpet.

You made my day, Draco xD

 

But seriously, yes. Brush up on at least basic Java first. Minecraft Modding is a wonderful way to learn how to program in Java, but you need to know the fundamentals first, otherwise you will have no idea what anything you're doing actually means.

Follow these rules when talking to me, and we'll get along fine.

1).I know Java fairly well. I don't know as much about modding. They are not the same, don't compare them.

2). I consider myself to always be learning. I make mistakes, you make mistakes. Who doesn't?

3). Insult me, and I will leave the thread. I have a real life, I don't have time to throw petty insults in a Minecraft Modding forum.

 

ModMCdl - Co-Founder and Director of Design for Artemis Game Studios

Posted
11 hours ago, diesieben07 said:

It most definitely is not. Minecraft Modding is a giant mess of hacks on top of hacks and a minefield of horrible practices and undocumented code. This is not how "real world" development should work (and if it does at your company, run!).

It actually is. While it may not suit you in particular, I know several friends who really got down to it and used Minecraft Modding as a way to implement what they were learning in Java. It isn't an independent way to learn, but it allows an outlet to take what you learn and utilize it and build up off of it.

Follow these rules when talking to me, and we'll get along fine.

1).I know Java fairly well. I don't know as much about modding. They are not the same, don't compare them.

2). I consider myself to always be learning. I make mistakes, you make mistakes. Who doesn't?

3). Insult me, and I will leave the thread. I have a real life, I don't have time to throw petty insults in a Minecraft Modding forum.

 

ModMCdl - Co-Founder and Director of Design for Artemis Game Studios

Posted
4 minutes ago, ModMCdl said:

but it allows an outlet to take what you learn and utilize it and build up off of it.

That is not "learning Java" that's "taking what you know and utilizing it."

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.

Posted
19 hours ago, Draco18s said:

That is not "learning Java" that's "taking what you know and utilizing it."

Which is a major step of the learning process. I guess my initial statement was a bit vague. I was trying to emphasize that an underlying understanding of java must be known first.

Follow these rules when talking to me, and we'll get along fine.

1).I know Java fairly well. I don't know as much about modding. They are not the same, don't compare them.

2). I consider myself to always be learning. I make mistakes, you make mistakes. Who doesn't?

3). Insult me, and I will leave the thread. I have a real life, I don't have time to throw petty insults in a Minecraft Modding forum.

 

ModMCdl - Co-Founder and Director of Design for Artemis Game Studios

Posted
6 hours ago, diesieben07 said:

My statement still stands. Taking practices from Minecraft Modding and applying them to "real-world programming" is a bad idea.

(I'll point out that Minecraft practices were better than what I was doing before because I was never taught any sort of organizational schema...)

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

    • 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)
    • When i join minecraft all ok, when i join world all working fine, but when i open indentity menu, i get this The game crashed whilst unexpected error Error: java.lang.NullPointerException: Cannot invoke "top.ribs.scguns.common.Gun$Projectile.getDamage()" because "this.projectile" is null crash report here https://paste.ee/p/0vKaf
  • Topics

×
×
  • Create New...

Important Information

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