Jump to content

[1.10.2]Duplicate Textures


FieryChocobo

Recommended Posts

Hi, i am currently trying to learn modding by following Mr.Crayfishs Youtube Tutorial.

 

I have started adding my own items, currently i have 2 implemented:

- Woven Ring (plantRing)

- Carved Ring (woodenRing)

 

For some reason my textures seem to be duplicated, as in the last loaded texture applies to both items ingame. If i go into my ModItems file and change the order in which items are loaded or comment out one of the two then the other one will load its texture fine.

 

ModItems file:

package com.fierychocobo.dryad.init;

import com.fierychocobo.dryad.Reference;
import com.fierychocobo.dryad.items.ItemDryadGem;
import com.fierychocobo.dryad.items.ItemPlantRing;
import com.fierychocobo.dryad.items.ItemWoodRing;

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 dryadGem;
public static Item woodRing;
public static Item plantRing;

public static void init(){
//	dryadGem = new ItemDryadGem();
	plantRing = new ItemPlantRing();
	woodRing = new ItemWoodRing();
}

public static void register(){
//	GameRegistry.register(dryadGem);
	GameRegistry.register(plantRing);
	GameRegistry.register(woodRing);
}

public static void registerRenders(){
//	registerRender(dryadGem);
	registerRender(plantRing);
	registerRender(woodRing);
}

private static void registerRender(Item item){
//	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(dryadGem, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(plantRing, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(woodRing, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));

}
}

 

With this File both the Carved and Woven Ring get the Carved Ring Texture, however if i quote out the Carved Ring, then the Woven Ring has the correct Texture. (so i assume my .json Files are correct) I also do not get any Errors in the Console. I'll attach my Item Classes in a Spoiler, just in case:

 

 

ItemWoodRing

package com.fierychocobo.dryad.items;

import com.fierychocobo.dryad.Reference;

import net.minecraft.item.Item;

public class ItemWoodRing extends Item {

public ItemWoodRing() {
	setUnlocalizedName(Reference.DryadItems.WOODRING.getUnlocalizedName());
	setRegistryName(Reference.DryadItems.WOODRING.getRegistryName());
}
}

ItemPlantRing

package com.fierychocobo.dryad.items;

import com.fierychocobo.dryad.Reference;

import net.minecraft.item.Item;

public class ItemPlantRing extends Item {
public ItemPlantRing() {
	setUnlocalizedName(Reference.DryadItems.PLANTRING.getUnlocalizedName());
	setRegistryName(Reference.DryadItems.PLANTRING.getRegistryName());
}

}

Reference

package com.fierychocobo.dryad;

public class Reference {

public static final String MOD_ID = "dryad";
public static final String NAME = "Dryads!";
public static final String VERSION = "Alpha 0.1";

public static final String CLIENT_PROXY_CLASS = "com.fierychocobo.dryad.proxy.ClientProxy";
public static final String SERVER_PROXY_CLASS = "com.fierychocobo.dryad.proxy.ServerProxy";

public static enum DryadItems{
	//DRYADGEM("dryadGem", "ItemDryadGem"),
	WOODRING("woodRing", "ItemWoodRing"),
	PLANTRING("plantRing", "ItemPlantRing");

	private String unlocalizedName;
	private String registryName;

	DryadItems(String unlocalizedName, String registryName){
		this.unlocalizedName = unlocalizedName;
		this.registryName = registryName;
	}

	public String getUnlocalizedName() {
		return unlocalizedName;
	}

	public String getRegistryName() {
		return registryName;
	}
}
}

Dryads

package com.fierychocobo.dryad;

import com.fierychocobo.dryad.init.ModItems;
import com.fierychocobo.dryad.proxy.CommonProxy;

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

@Mod(modid = Dryads.modId, name = Dryads.name, version = Dryads.version, acceptedMinecraftVersions = "[1.10.2]")
public class Dryads {

public static final String modId = Reference.MOD_ID;
public static final String name = Reference.NAME;
public static final String version = Reference.VERSION;

@Mod.Instance(modId)
public static Dryads instance;

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

@EventHandler
public void preInit(FMLPreInitializationEvent event){
	System.out.println("Seed is planting...");

	ModItems.init();
	ModItems.register();
};
@EventHandler
public void init(FMLInitializationEvent event){
	System.out.println("Seed is growing...");

	proxy.init();
};
@EventHandler
public void postInit(FMLPostInitializationEvent event){
	System.out.println("Leaves are getting magyfied...");

};
}

 

 

Link to comment
Share on other sites

Ugh. Mr Crayfish's tutorials are a common go-to for people and really do some terrible, terrible things.

 

1) Don't use an enum for your items, that's just stupid.  Case in point: you only need one string, it needs to be all lower case, and it does not need the word "item" in it. 

myItem.setUnlocalizedName(myItem.getRegistryName());

2) Don't EVER put client-side-only code (register renderers) in a common location

3) Don't use getItemModelMesher(), use ModelLoader.setCustomModelResourceLocation(...)

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.

Link to comment
Share on other sites

I do not.  I haven't used any for 1.10, I've largely used the forums here as my resource.  Also as the Forge team recently changed how they want us to register blocks/items/etc. to a new system (what the motivation was to do this in the middle of a major Minecraft version, rather than waiting for 1.11, I don't know).

 

Ignoring that new system for the moment because I literally haven't written a line of code since it was finally mentioned on the forums how to actually use said system (along with a direct insult to my intelligence about how I managed to not hear about said new system via a non-existent tweet on a virtually dead twitter account, or via Facebook which I don't use, or...) so I haven't had time to update and refactor.

 

I call these methods during Pre Init:

https://github.com/Draco18s/ReasonableRealism/blob/master/src/main/java/com/draco18s/hardlib/EasyRegistry.java

https://github.com/Draco18s/ReasonableRealism/blob/master/src/main/java/com/draco18s/hardlib/client/ClientEasyRegistry.java

 

I basically wrote a wrapper around "all of the things" necessary to create fully functional blocks and items while also using the minimal amount of code in my actual mod (i.e. I create a block as normal, then call EasyRegistry.registerBlock or ...WithItem, or ...withCustomItem, or ...withCustomStatemapper, etc) and as the EasyRegistry classes are the Common/Client proxy of a library mod, that distinction (i.e. where does rendering registration go) is handled for me too.

 

I can crate my blocks and items in any order I need to, don't have to worry about things like "I create all my blocks before all my items, shit shit shit my BlockCropWhatever constructor is passed an instance of my seed item before I created any items" (which is so often true for people following this ModBlocks/ModItems encapsulated pattern, and encounter Null Pointers they can't solve because they say "what do you mean my seed is null, I pass it right here." "No you twat, you haven't created your seed yet, that is a null pointer" "Fine, I'll switch it, you'll see the problem doesn't go away!" and they do, because their seed is passed a reference to the crop block, which is now null).

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.

Link to comment
Share on other sites

You can watch and leave a request on my currently two videos (school has been taking up most of my time).

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

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



×
×
  • Create New...

Important Information

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