Jump to content

1.8 - Need help - How to improve/shorten item registering code


SuperGeniusZeb

Recommended Posts

So I'm pretty new to modding, and I'm working on my first mod, which will add 70 monocolored blocks to the game. (14 colors with 5 shades stored in metadata and blockstates.) The blocks are made out items called "color essences" and you'll be able to craft combinations of essences to get the different colors and shades. I'm trying to shorten the code for all the registering and adding in of items, and I've run into a problem. I can't figure out how to do it. I've been trying to use arrays and maps and sets and all sorts of things to prevent from having to call the same method 14 times.

 

Here are some of my classes:

 

(main class) Colore.java

package com.supergeniuszeb.colore;

import net.minecraft.item.ItemStack;
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;
import net.minecraftforge.fml.common.registry.GameRegistry;

import com.supergeniuszeb.colore.init.ModBlocks;
import com.supergeniuszeb.colore.init.ModItems;
import com.supergeniuszeb.colore.init.ModRecipes;
import com.supergeniuszeb.colore.init.ModTools;
import com.supergeniuszeb.colore.proxy.CommonProxy;

@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION)
public class Colore {

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

public static final ModCreativeTabs tab1 = new ModCreativeTabs("tab1");

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
	//Initializes and registers blocks & items.
	ModBlocks.init();
	ModBlocks.register();
	ModItems.init();
	ModItems.register();
	ModTools.init();
	ModTools.register();

	//Runs the ore generation code. See ModGeneration.java.
	GameRegistry.registerWorldGenerator(new ModGeneration(), 0);
}

@EventHandler
public void init(FMLInitializationEvent event) {
	proxy.registerRenders();

	//Adds all crafting & smelting recipes.
	ModRecipes.addRecipes();

}
@EventHandler
public void postInit(FMLPostInitializationEvent event) {

}
}

 

(in package "proxy") ClientProxy.java

package com.supergeniuszeb.colore.proxy;

import com.supergeniuszeb.colore.init.ModBlocks;
import com.supergeniuszeb.colore.init.ModItems;
import com.supergeniuszeb.colore.init.ModTools;

//Everything in here is done client-side.
//This class and CommonProxy.java are used to keep server-side and client-side stuff separate.
public class ClientProxy extends CommonProxy {
@Override
public void registerRenders() {
	ModBlocks.registerRenders();
	ModItems.registerRenders();
	ModTools.registerRenders();
}
}

 

(in package "proxy") CommonProxy.java

package com.supergeniuszeb.colore.proxy;
//Everything in here is done server-side.
//This class and ClientProxy.java are used to keep server-side and client-side stuff separate.
public class CommonProxy {
public void registerRenders() {

}
}

 

 

(in package "init") ModItems.java

package com.supergeniuszeb.colore.init;

import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;

import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.fml.common.registry.GameRegistry;

import com.supergeniuszeb.colore.Colore;
import com.supergeniuszeb.colore.Reference;

public class ModItems extends Item {

public static Item essence_of_red;
public static Item essence_of_reddish_orange;
public static Item essence_of_orange;
public static Item essence_of_orangish_yellow;
public static Item essence_of_yellow;
public static Item essence_of_yellowish_green;

public static Set<Item> colorSet = new LinkedHashSet<>(); //The empty "<>" will only work in Java 7+

{ //IMPORTANT! Methods MUST be called within this main class' methods or in curly braces.
	colorSet.add(essence_of_red);
	colorSet.add(essence_of_orange);
}

public static String[] essenceList = {
	"essence_of_red", "essence_of_orange"
};

public static Object[] colorArray = colorSet.toArray();
//refined essences


//unrefined essences
public static Item unrefined_red;

public static void init() {

	int i = 0;
	for (Object color : colorArray) {
		color = new Item().setUnlocalizedName(essenceList[i]).setCreativeTab(Colore.tab1);
		i++;
	}


	//refined essences
	//essence_of_red = new Item().setUnlocalizedName("essence_of_red").setCreativeTab(Colore.tab1);


	//unrefined essences
	unrefined_red = new Item().setUnlocalizedName("unrefined_red").setCreativeTab(Colore.tab1);

}

public static void register() {

	for (Item color : colorSet) {
		GameRegistry.registerItem(color, color.getUnlocalizedName().substring(5));
	}

	//refined essences
	//GameRegistry.registerItem(essence_of_red, essence_of_red.getUnlocalizedName().substring(5));


	//unrefined essences
	GameRegistry.registerItem(unrefined_red, unrefined_red.getUnlocalizedName().substring(5));

}

public static void registerRenders() {

	for (Item color : colorSet) {
		registerRender(color);
	}

	//refined essences
	//registerRender(essence_of_red);


	//unrefined essences
	registerRender(unrefined_red);

}

//This method is called by the registerRenders method every time it adds an item.
public static void registerRender(Item item) {
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
}
}

 

I've based a lot of my code on the

, in case you're wondering why my code is written in this way. If you need to see any more of my classes just let me know. I've tried looking at other modding tutorials but a lot of them set up the proxies and items and stuff in a different way, and I haven't got a clue as to what the most modular, efficient, and wisest solution is. Any suggestions? I keep getting errors when it tries to register the recipes for the blocks, which I assume is due to improper Item registering. I apologize for my somewhat messy code. I've commented out a lot of things during testing and I'm trying to focus on getting just one or 2 items working so I can duplicate it for all the others, rather than have to make changes to several different variables and methods and such.

Colore - The mod that adds monochrome blocks in every color of the rainbow!

http://www.minecraftforge.net/forum/index.php?topic=35149

 

If you're looking to learn how to make mods for 1.9.4, I wrote a helpful article with links to a lot of useful resources for learning Minecraft 1.9.4 modding!

 

http://supergeniuszeb.com/mods/a-helpful-list-of-minecraft-1-9-4-modding-resources/

Link to comment
Share on other sites

While it may seem clever or interesting to do such things in an algorithmic, compressed way, there is nothing wrong with cutting and pasting same code multiple times.

 

You need to ask yourself why you were doing this, and I expect you'd say you thought it would save time. Yet, obviously you've already spent more time trying to save time than you would have saved and you're not even done yet! So what's the point?

 

I'd also propose that the simpler your code is logically, the less likely it is to have bugs. So it is better to cut and paste 14 sections of code that you know work than to try some sort of iteration through a map and such.

 

Of course if you're a high-level programmer, then you can get the map right on the first try and might as well do that. But there is no shame at all in simply having cut and paste code.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

When you have a lot of items that are exactly the same, use item subtypes and handle that in your Item class directly.

 

Don't store meta information such as colorSets outside of the class that uses it - encapsulation is your friend. If you find you are storing a lot of 'meta' type information, you should probably reevaluate your design.

 

If you want to simplify registration, you can easily do so with Reflection.

 

// call this method AFTER you have initialized all items
private static void registerItems() {
try {
	for (Field f : YourItems.class.getFields()) { // get all declared fields in your Items class
		if (Item.class.isAssignableFrom(f.getType())) { // if a field is an item, fetch it and register it
			Item item = (Item) f.get(null);
			if (item != null) {
				// while the unlocalized name is not intended for this purpose and some may object to its use
				// like this, I see no harm in it as it is a convenient way to automate registration
				String name = item.getUnlocalizedName();
				GameRegistry.registerItem(item, name.substring(name.lastIndexOf(".") + 1));
			}
		}
	}
} catch(Exception e) {
	// catch so you don't crash, but log so you can still find and fix the issue
	e.printStackTrace();
}
}

 

While you do still have to initialize every item individually, if you use item subtypes correctly you will have far fewer to register, and, using a few custom interfaces, you can set up a similar system to automate registration of item variants and model resource locations.

 

That said, Jabelar's point still stands: if you are not strong in Java, the time you spend trying to automate things will far outweigh the time it would have taken you to just get it working, so it's probably not worth trying until you have more experience.

Link to comment
Share on other sites

Hi

Check this out. Its really simple, yet you only need one line of code when registering items not counting the item field:

public class ItemRegistry
{

    public static ItemBase YOUR_ITEM;

    public static void registerItems()
    {
        ItemRegistry.YOUR_ITEM = new ItemBase(64, "youritem");
    }

}

public class ItemBase extends Item
{
    
    public ItemBase(int maxStackSize, String unlocalizedName)
    {
        this.setUnlocalizedName(unlocalizedName);
        this.setMaxStackSize(maxStackSize);
        GameRegistry.registerItem(this, unlocalizedName);
    }

}

 

You may add extra parameters to your ItemBase constructor such as a CreativeTab if you would like. So simple, yet effective. If you need to add methods to your item such as onItemRightClick for example, use this code in your ItemRegistry class instead:

public static ItemBase YOUR_ITEM;

public static void registerItems()
{
    ItemRegistry.YOUR_ITEM = new YourItem();
}

 

In your YourItem.class, do this:

public class YourItem extends ItemBase //must include specific constructor
{
    
    public YourItem() //No parameters, call super here
    {
        super(64, "youritem"); //@Param: int maxStackSize, String name
    }

    //Now you have a class to include regular item methods

}

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

Link to comment
Share on other sites

@coolAlias and EverythingGames: Thanks! I tried your suggestions and they worked? I've created a new class/.java file for my items called ItemEssence and pretty much deprecated the older ModItems.java file (in other words I've commented out most of the references to it in the mian code and in the proxies so it isn't in use but can still be accessed for the time being in case I need to borrow any code from it or something.) I tried starting up the test client and it works! Here's what is in the new ItemEssence.java file:

package com.supergeniuszeb.colore.init;

import java.lang.reflect.Field;

import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.fml.common.registry.GameRegistry;

import com.supergeniuszeb.colore.ModCreativeTabs;
import com.supergeniuszeb.colore.Reference;

//Special thanks to coolAlias and EverythingGames, users from the Forge forums, for helping
//me with figuring out how to optimize my item-and-block-registering code.

public class ItemEssence extends Item {

public ItemEssence(String unlocalizedName) {
	this.setUnlocalizedName(unlocalizedName);
	this.setMaxStackSize(64);
	this.setCreativeTab(ModCreativeTabs.itemTab);
}

public static class ItemRegistry {

	//refined essences
	public static ItemEssence essence_of_red = new ItemEssence("essence_of_red");
	public static ItemEssence essence_of_reddish_orange = new ItemEssence("essence_of_reddish_orange");
	public static ItemEssence essence_of_orange = new ItemEssence("essence_of_orange");
	public static ItemEssence essence_of_orangish_yellow = new ItemEssence("essence_of_orangish_yellow");
	public static ItemEssence essence_of_yellow = new ItemEssence("essence_of_yellow");
	public static ItemEssence essence_of_yellowish_green = new ItemEssence("essence_of_yellowish_green");
	public static ItemEssence essence_of_green = new ItemEssence("essence_of_green");
	public static ItemEssence essence_of_cyan = new ItemEssence("essence_of_cyan");
	public static ItemEssence essence_of_blue = new ItemEssence("essence_of_blue");
	public static ItemEssence essence_of_indigo = new ItemEssence("essence_of_indigo");
	public static ItemEssence essence_of_purple = new ItemEssence("essence_of_purple");
	public static ItemEssence essence_of_magenta = new ItemEssence("essence_of_magenta");
	public static ItemEssence essence_of_brown = new ItemEssence("essence_of_brown");
	public static ItemEssence essence_of_grayscale = new ItemEssence("essence_of_grayscale");
	public static ItemEssence rainbow_essence = new ItemEssence("rainbow_essence");

	//unrefined essences
	public static ItemEssence unrefined_red = new ItemEssence("unrefined_red");
	public static ItemEssence unrefined_orange = new ItemEssence("unrefined_orange");
	public static ItemEssence unrefined_yellow = new ItemEssence("unrefined_yellow");
	public static ItemEssence unrefined_green = new ItemEssence("unrefined_green");
	public static ItemEssence unrefined_blue = new ItemEssence("unrefined_blue");
	public static ItemEssence unrefined_purple = new ItemEssence("unrefined_purple");
	public static ItemEssence unrefined_brown = new ItemEssence("unrefined_brown");
	public static ItemEssence unrefined_white = new ItemEssence("unrefined_white");
	public static ItemEssence unrefined_black = new ItemEssence("unrefined_black");

	public static void registerItems() {
		try {
			for (Field f : ItemRegistry.class.getFields()) { // get all declared fields in the ItemRegistry class
				if (Item.class.isAssignableFrom(f.getType())) { // if a field is an item, fetch it and register it
					Item item = (Item) f.get(null);
					if (item != null) {
						String name = item.getUnlocalizedName();
						GameRegistry.registerItem(item, name.substring(name.lastIndexOf(".") + 1));
					}
				}
			}
		} catch(Exception e) {
			// catch so game won't crash, but log so issue can still be found and fixed
			e.printStackTrace();
		}
	}

	public static void registerRenders() {

		try {
			for (Field f : ItemRegistry.class.getFields()) { // get all declared fields in the ItemRegistry class
				if (Item.class.isAssignableFrom(f.getType())) { // if a field is an item, fetch it and register its renders
					Item item = (Item) f.get(null);
					if (item != null) {
						registerRender(item);
					}
				}
			}
		} catch(Exception e) {
			// catch so game won't crash, but log so issue can still be found and fixed
			e.printStackTrace();
		}

	}

	//This method is called by the registerRenders method every time it adds an item.
	public static void registerRender(Item item) {
		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
	}
}
}

 

What do you think? Any other improvements I could make? Now that I have the item code working it should be fairly easy for me to duplicate this for the blocks and other things I'm adding in my mod.

Colore - The mod that adds monochrome blocks in every color of the rainbow!

http://www.minecraftforge.net/forum/index.php?topic=35149

 

If you're looking to learn how to make mods for 1.9.4, I wrote a helpful article with links to a lot of useful resources for learning Minecraft 1.9.4 modding!

 

http://supergeniuszeb.com/mods/a-helpful-list-of-minecraft-1-9-4-modding-resources/

Link to comment
Share on other sites

I wouldn't nest those classes and methods inside of an Item class - just make one giant class that contains all of your Item references and you should be fine.

 

The advantage of using Reflection vs. a simpler solution such as @EverythingGames proposed is that you can do other things with your Items at the time of registration, such as making calls based on implemented interfaces or whatever else. Pretty handy, but you may not need it.

 

It's much more difficult to provide a similar system for Blocks because Block registration is far more complicated than Item registration. You may have to provide custom ItemBlocks for each block, and those may take custom arguments, plus the registerBlock method might require additional arguments, not to mention registering TileEntities if needed.

 

Unless you really just have cookie-cutter blocks, I wouldn't advise a similar system.

Link to comment
Share on other sites

It's more complicated with blocks, as @coolAlias said, but its basically the same as the item code I provided, just a little more code in the base block class. This class includes more features such as block sound, material, hardness, resistance, tool harvest, random generation, etc. Really handy when creating many blocks and items if I should say so myself.

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

Link to comment
Share on other sites

I wouldn't nest those classes and methods inside of an Item class - just make one giant class that contains all of your Item references and you should be fine.

~snip~

Unless you really just have cookie-cutter blocks, I wouldn't advise a similar system.

Luckily, my whole mod is about blocks and items that are identical aside from their color.

 

Anyway, literally right after posting my previous post I noticed something. I had set up my packages and classes like so:

 

 

 

blocks

>>ModBlock.java (used in place of the official Block class which is private)

>>ModBlockOre.java (an ore version of the above class)

 

init

>>ModItems.java (the item classes, and initializing & registering methods were all located here - now deprecated)

>>ModBlocks.java (similar to the above, but using the already-defined ModBlock & ModBlockOre classes)

>>ModTools.java (tool initialization & registration)

>>ModRecipes.java (registration of all recipes)

>>ModArmor.java (empty/WIP)

>>ModMetaItems(unused test class that I was testing meta blocks in)

>>ItemEssence.java (my new item class for holding all item classes and initialization and registration of items)

 

items

>>ModAxe.java (axe class)

>>ModHoe.java (hoe class)

>>ModPickaxe.java (pickaxe class)

>>ModShovel.java (shovel class)

>>ModSword.java (sword class)

 

proxy

>>ClientProxy.java

>>CommonProxy.java

 

(and then there were some other classes located in the main Colore package such as ModCreativeTabs.java and Reference.java)

 

 

 

I realized that if I have an items package and a blocks package, then wouldn't it make more sense to put the base item/block classes in there and have the init package contain the registration classes? So I began doing some heavy refactoring and changed my code structure to this:

 

 

blocks

>>BlockColore.java (used in place of the official Block class which is private)

>>BlockColoreOre.java (an ore version of the above class)

 

init

(ModItems.java and ModBlocks.java were deleted)

>>ItemRegistry.java (I extracted the ItemRegistry class from ItemEssence.java)

>>BlockRegistry.java (block initialization & registration)

>>ToolRegistry.java (tool initialization & registration)

>>ModRecipes.java (recipe initialization & registration)

>>ModArmor.java (still empty - will probably rename to ArmorRegistry once I start working on my mod's armor)

>>ModMetaItems(still unused - will probably delete)

 

items

>>ItemEssence.java (now contains only ItemEssence base class & constructor)

>>ModAxe.java (axe class)

>>ModHoe.java (hoe class)

>>ModPickaxe.java (pickaxe class)

>>ModShovel.java (shovel class)

>>ModSword.java (sword class)

 

proxy

>>ClientProxy.java

>>CommonProxy.java

 

 

 

So I've tested everything and it all works fine, aside from some missing textures which are missing because I haven't made them yet. (:P) I've basically separated the base item/block classes from the initialization/registration of the items/blocks that use them, which I think helps with making my code more modular and organized. What do you think? For reference, here are the new classes:

 

 

 

(from blocks package) BlockColore.java

package com.supergeniuszeb.colore.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;

import com.supergeniuszeb.colore.ModCreativeTabs;

public class BlockColore extends Block {

public BlockColore(String unlocalizedName) {
	super(Material.rock);
	this.setHardness(1.5f);
	this.setHarvestLevel("pickaxe", 0);
	this.setResistance(10.0f);
	this.setUnlocalizedName(unlocalizedName);
	this.setCreativeTab(ModCreativeTabs.blockTab);
}
}

 

BlockColoreOre.java

package com.supergeniuszeb.colore.blocks;

import java.util.Random;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.Item;

import com.supergeniuszeb.colore.ModCreativeTabs;
import com.supergeniuszeb.colore.init.BlockRegistry;
import com.supergeniuszeb.colore.init.ItemRegistry;

public class BlockColoreOre extends Block {
public BlockColoreOre(String unlocalizedName) {
	super(Material.rock);
	this.setHardness(1.5f);
	this.setHarvestLevel("pickaxe", 0);
	this.setResistance(10.0f);
	this.setUnlocalizedName(unlocalizedName);
	this.setCreativeTab(ModCreativeTabs.blockTab);
}

@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune){
	if (this == BlockRegistry.red_ore){
		return ItemRegistry.unrefined_red;
	}
	if (this == BlockRegistry.orange_ore){
		return ItemRegistry.unrefined_orange;
	}
	if (this == BlockRegistry.yellow_ore){
		return ItemRegistry.unrefined_yellow;
	}
	if (this == BlockRegistry.green_ore){
		return ItemRegistry.unrefined_green;
	}
	if (this == BlockRegistry.blue_ore){
		return ItemRegistry.unrefined_blue;
	}
	if (this == BlockRegistry.purple_ore){
		return ItemRegistry.unrefined_purple;
	}
	if (this == BlockRegistry.brown_ore){
		return ItemRegistry.unrefined_brown;
	}
	if (this == BlockRegistry.white_ore){
		return ItemRegistry.unrefined_white;
	}
	if (this == BlockRegistry.black_ore){
		return ItemRegistry.unrefined_black;
	}
	return null;
}

@Override
public int quantityDropped(Random rand){
	return 4 + rand.nextInt(3);
}
}

 

(items package) ItemEssence.java

package com.supergeniuszeb.colore.items;

import net.minecraft.item.Item;

import com.supergeniuszeb.colore.ModCreativeTabs;

//Special thanks to coolAlias and EverythingGames, users from the Forge forums, for helping
//me with figuring out how to optimize my item-and-block-registering code.

public class ItemEssence extends Item {

public ItemEssence(String unlocalizedName) {
	this.setUnlocalizedName(unlocalizedName);
	this.setMaxStackSize(64);
	this.setCreativeTab(ModCreativeTabs.itemTab);
}
}

 

(init package) ItemRegistry.java

package com.supergeniuszeb.colore.init;

import java.lang.reflect.Field;

import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.fml.common.registry.GameRegistry;

import com.supergeniuszeb.colore.Reference;
import com.supergeniuszeb.colore.items.ItemEssence;
//is static needed?
public class ItemRegistry {

//refined essences
public static ItemEssence essence_of_red = new ItemEssence("essence_of_red");
public static ItemEssence essence_of_reddish_orange = new ItemEssence("essence_of_reddish_orange");
public static ItemEssence essence_of_orange = new ItemEssence("essence_of_orange");
public static ItemEssence essence_of_orangish_yellow = new ItemEssence("essence_of_orangish_yellow");
public static ItemEssence essence_of_yellow = new ItemEssence("essence_of_yellow");
public static ItemEssence essence_of_yellowish_green = new ItemEssence("essence_of_yellowish_green");
public static ItemEssence essence_of_green = new ItemEssence("essence_of_green");
public static ItemEssence essence_of_cyan = new ItemEssence("essence_of_cyan");
public static ItemEssence essence_of_blue = new ItemEssence("essence_of_blue");
public static ItemEssence essence_of_indigo = new ItemEssence("essence_of_indigo");
public static ItemEssence essence_of_purple = new ItemEssence("essence_of_purple");
public static ItemEssence essence_of_magenta = new ItemEssence("essence_of_magenta");
public static ItemEssence essence_of_brown = new ItemEssence("essence_of_brown");
public static ItemEssence essence_of_grayscale = new ItemEssence("essence_of_grayscale");
public static ItemEssence rainbow_essence = new ItemEssence("rainbow_essence");

//unrefined essences
public static ItemEssence unrefined_red = new ItemEssence("unrefined_red");
public static ItemEssence unrefined_orange = new ItemEssence("unrefined_orange");
public static ItemEssence unrefined_yellow = new ItemEssence("unrefined_yellow");
public static ItemEssence unrefined_green = new ItemEssence("unrefined_green");
public static ItemEssence unrefined_blue = new ItemEssence("unrefined_blue");
public static ItemEssence unrefined_purple = new ItemEssence("unrefined_purple");
public static ItemEssence unrefined_brown = new ItemEssence("unrefined_brown");
public static ItemEssence unrefined_white = new ItemEssence("unrefined_white");
public static ItemEssence unrefined_black = new ItemEssence("unrefined_black");

public static void registerItems() {
	try {
		for (Field f : ItemRegistry.class.getFields()) { // get all declared fields in the ItemRegistry class
			if (Item.class.isAssignableFrom(f.getType())) { // if a field is an item, fetch it and register it
				Item item = (Item) f.get(null);
				if (item != null) {
					String name = item.getUnlocalizedName();
					GameRegistry.registerItem(item, name.substring(name.lastIndexOf(".") + 1));
				}
			}
		}
	} catch(Exception e) {
		// catch so game won't crash, but log so issue can still be found and fixed
		e.printStackTrace();
	}
}

public static void registerRenders() {

	try {
		for (Field f : ItemRegistry.class.getFields()) { // get all declared fields in the ItemRegistry class
			if (Item.class.isAssignableFrom(f.getType())) { // if a field is an item, fetch it and register its renders
				Item item = (Item) f.get(null);
				if (item != null) {
					registerRender(item);
				}
			}
		}
	} catch(Exception e) {
		// catch so game won't crash, but log so issue can still be found and fixed
		e.printStackTrace();
	}

}

//This method is called by the registerRenders method every time it adds an item.
public static void registerRender(Item item) {
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
}

}

 

BlockRegistry.java

package com.supergeniuszeb.colore.init;

import java.lang.reflect.Field;

import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.fml.common.registry.GameRegistry;

import com.supergeniuszeb.colore.Reference;
import com.supergeniuszeb.colore.blocks.BlockColore;
import com.supergeniuszeb.colore.blocks.BlockColoreOre;

//Special thanks to coolAlias and EverythingGames, users from the Forge forums, for helping
//me with figuring out how to optimize my item-and-block-registering code.

public class BlockRegistry {

//pure blocks
public static BlockColore block_of_red = new BlockColore("block_of_red");
public static BlockColore block_of_reddish_orange = new BlockColore("block_of_reddish_orange");
public static BlockColore block_of_orange = new BlockColore("block_of_orange");
public static BlockColore block_of_orangish_yellow = new BlockColore("block_of_orangish_yellow");
public static BlockColore block_of_yellow = new BlockColore("block_of_yellow");
public static BlockColore block_of_yellowish_green = new BlockColore("block_of_yellowish_green");
public static BlockColore block_of_green = new BlockColore("block_of_green");
public static BlockColore block_of_cyan = new BlockColore("block_of_cyan");
public static BlockColore block_of_blue = new BlockColore("block_of_blue");
public static BlockColore block_of_indigo = new BlockColore("block_of_indigo");
public static BlockColore block_of_purple = new BlockColore("block_of_purple");
public static BlockColore block_of_magenta = new BlockColore("block_of_magenta");
public static BlockColore block_of_brown = new BlockColore("block_of_brown");
public static BlockColore block_of_grayscale = new BlockColore("block_of_grayscale");
public static BlockColore rainbow_block = new BlockColore("rainbow_block");

//ore blocks
public static BlockColoreOre red_ore = new BlockColoreOre("red_ore");
public static BlockColoreOre orange_ore = new BlockColoreOre("orange_ore");
public static BlockColoreOre yellow_ore = new BlockColoreOre("yellow_ore");
public static BlockColoreOre green_ore = new BlockColoreOre("green_ore");
public static BlockColoreOre blue_ore = new BlockColoreOre("blue_ore");
public static BlockColoreOre purple_ore = new BlockColoreOre("purple_ore");
public static BlockColoreOre brown_ore = new BlockColoreOre("brown_ore");
public static BlockColoreOre white_ore = new BlockColoreOre("white_ore");
public static BlockColoreOre black_ore = new BlockColoreOre("black_ore");

public static void registerBlocks() {
	try {
		for (Field f : BlockRegistry.class.getFields()) { // get all declared fields in the BlockRegistry class
			if (Block.class.isAssignableFrom(f.getType())) { // if a field is a block, fetch it and register it
				Block block = (Block) f.get(null);
				if (block != null) {
					String name = block.getUnlocalizedName();
					GameRegistry.registerBlock(block, name.substring(name.lastIndexOf(".") + 1));
				}
			}
		}
	} catch(Exception e) {
		// catch so game won't crash, but log so issue can still be found and fixed
		e.printStackTrace();
	}
}

public static void registerRenders() {

	try {
		for (Field f : BlockRegistry.class.getFields()) { // get all declared fields in the BlockRegistry class
			if (Block.class.isAssignableFrom(f.getType())) { // if a field is a block, fetch it and register its renders
				Block block = (Block) f.get(null);
				if (block != null) {
					registerRender(block);
				}
			}
		}
	} catch(Exception e) {
		// catch so game won't crash, but log so issue can still be found and fixed
		e.printStackTrace();
	}

}

//This method is called by the registerRenders method every time it adds an item.
public static void registerRender(Block block) {
	Item item = Item.getItemFromBlock(block);
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
}
}

 

ToolRegistry.java

package com.supergeniuszeb.colore.init;

import java.lang.reflect.Field;

import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.fml.common.registry.GameRegistry;

import com.supergeniuszeb.colore.ModCreativeTabs;
import com.supergeniuszeb.colore.Reference;
import com.supergeniuszeb.colore.items.ModAxe;
import com.supergeniuszeb.colore.items.ModHoe;
import com.supergeniuszeb.colore.items.ModPickaxe;
import com.supergeniuszeb.colore.items.ModShovel;
import com.supergeniuszeb.colore.items.ModSword;

public class ToolRegistry {
public static final Item.ToolMaterial coloreMaterial = EnumHelper.addToolMaterial("coloreMaterial", 2, 175, 9.0f, 7.0f, 15);

// swords
public static Item red_sword = new ModSword(coloreMaterial).setUnlocalizedName("red_sword").setCreativeTab(ModCreativeTabs.toolTab);
public static Item reddish_orange_sword = new ModSword(coloreMaterial).setUnlocalizedName("reddish_orange_sword").setCreativeTab(ModCreativeTabs.toolTab);
public static Item orangish_yellow_sword = new ModSword(coloreMaterial).setUnlocalizedName("orangish_yellow_sword").setCreativeTab(ModCreativeTabs.toolTab);
public static Item yellow_sword = new ModSword(coloreMaterial).setUnlocalizedName("yellow_sword").setCreativeTab(ModCreativeTabs.toolTab);
public static Item yellowish_green_sword = new ModSword(coloreMaterial).setUnlocalizedName("yellowish_green_sword").setCreativeTab(ModCreativeTabs.toolTab);
public static Item green_sword = new ModSword(coloreMaterial).setUnlocalizedName("green_sword").setCreativeTab(ModCreativeTabs.toolTab);
public static Item cyan_sword = new ModSword(coloreMaterial).setUnlocalizedName("cyan_sword").setCreativeTab(ModCreativeTabs.toolTab);
public static Item blue_sword = new ModSword(coloreMaterial).setUnlocalizedName("blue_sword").setCreativeTab(ModCreativeTabs.toolTab);
public static Item indigo_sword = new ModSword(coloreMaterial).setUnlocalizedName("indigo_sword").setCreativeTab(ModCreativeTabs.toolTab);
public static Item purple_sword = new ModSword(coloreMaterial).setUnlocalizedName("purple_sword").setCreativeTab(ModCreativeTabs.toolTab);
public static Item brown_sword = new ModSword(coloreMaterial).setUnlocalizedName("brown_sword").setCreativeTab(ModCreativeTabs.toolTab);
public static Item white_sword = new ModSword(coloreMaterial).setUnlocalizedName("white_sword").setCreativeTab(ModCreativeTabs.toolTab);
public static Item gray_sword = new ModSword(coloreMaterial).setUnlocalizedName("gray_sword").setCreativeTab(ModCreativeTabs.toolTab);
public static Item black_sword = new ModSword(coloreMaterial).setUnlocalizedName("black_sword").setCreativeTab(ModCreativeTabs.toolTab);
public static Item rainbow_sword = new ModSword(coloreMaterial).setUnlocalizedName("rainbow_sword").setCreativeTab(ModCreativeTabs.toolTab);

// pickaxes
public static Item red_pickaxe = new ModPickaxe(coloreMaterial).setUnlocalizedName("red_pickaxe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item reddish_orange_pickaxe = new ModPickaxe(coloreMaterial).setUnlocalizedName("reddish_orange_pickaxe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item orangish_yellow_pickaxe = new ModPickaxe(coloreMaterial).setUnlocalizedName("orangish_yellow_pickaxe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item yellow_pickaxe = new ModPickaxe(coloreMaterial).setUnlocalizedName("yellow_pickaxe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item yellowish_green_pickaxe = new ModPickaxe(coloreMaterial).setUnlocalizedName("yellowish_green_pickaxe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item green_pickaxe = new ModPickaxe(coloreMaterial).setUnlocalizedName("green_pickaxe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item cyan_pickaxe = new ModPickaxe(coloreMaterial).setUnlocalizedName("cyan_pickaxe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item blue_pickaxe = new ModPickaxe(coloreMaterial).setUnlocalizedName("blue_pickaxe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item indigo_pickaxe = new ModPickaxe(coloreMaterial).setUnlocalizedName("indigo_pickaxe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item purple_pickaxe = new ModPickaxe(coloreMaterial).setUnlocalizedName("purple_pickaxe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item brown_pickaxe = new ModPickaxe(coloreMaterial).setUnlocalizedName("brown_pickaxe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item white_pickaxe = new ModPickaxe(coloreMaterial).setUnlocalizedName("white_pickaxe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item gray_pickaxe = new ModPickaxe(coloreMaterial).setUnlocalizedName("gray_pickaxe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item black_pickaxe = new ModPickaxe(coloreMaterial).setUnlocalizedName("black_pickaxe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item rainbow_pickaxe = new ModPickaxe(coloreMaterial).setUnlocalizedName("rainbow_pickaxe").setCreativeTab(ModCreativeTabs.toolTab);

// axes
public static Item red_axe = new ModAxe(coloreMaterial).setUnlocalizedName("red_axe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item reddish_orange_axe = new ModAxe(coloreMaterial).setUnlocalizedName("reddish_orange_axe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item orangish_yellow_axe = new ModAxe(coloreMaterial).setUnlocalizedName("orangish_yellow_axe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item yellow_axe = new ModAxe(coloreMaterial).setUnlocalizedName("yellow_axe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item yellowish_green_axe = new ModAxe(coloreMaterial).setUnlocalizedName("yellowish_green_axe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item green_axe = new ModAxe(coloreMaterial).setUnlocalizedName("green_axe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item cyan_axe = new ModAxe(coloreMaterial).setUnlocalizedName("cyan_axe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item blue_axe = new ModAxe(coloreMaterial).setUnlocalizedName("blue_axe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item indigo_axe = new ModAxe(coloreMaterial).setUnlocalizedName("indigo_axe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item purple_axe = new ModAxe(coloreMaterial).setUnlocalizedName("purple_axe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item brown_axe = new ModAxe(coloreMaterial).setUnlocalizedName("brown_axe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item white_axe = new ModAxe(coloreMaterial).setUnlocalizedName("white_axe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item gray_axe = new ModAxe(coloreMaterial).setUnlocalizedName("gray_axe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item black_axe = new ModAxe(coloreMaterial).setUnlocalizedName("black_axe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item rainbow_axe = new ModAxe(coloreMaterial).setUnlocalizedName("rainbow_axe").setCreativeTab(ModCreativeTabs.toolTab);

// shovels
public static Item red_shovel = new ModShovel(coloreMaterial).setUnlocalizedName("red_shovel").setCreativeTab(ModCreativeTabs.toolTab);
public static Item reddish_orange_shovel = new ModShovel(coloreMaterial).setUnlocalizedName("reddish_orange_shovel").setCreativeTab(ModCreativeTabs.toolTab);
public static Item orangish_yellow_shovel = new ModShovel(coloreMaterial).setUnlocalizedName("orangish_yellow_shovel").setCreativeTab(ModCreativeTabs.toolTab);
public static Item yellow_shovel = new ModShovel(coloreMaterial).setUnlocalizedName("yellow_shovel").setCreativeTab(ModCreativeTabs.toolTab);
public static Item yellowish_green_shovel = new ModShovel(coloreMaterial).setUnlocalizedName("yellowish_green_shovel").setCreativeTab(ModCreativeTabs.toolTab);
public static Item green_shovel = new ModShovel(coloreMaterial).setUnlocalizedName("green_shovel").setCreativeTab(ModCreativeTabs.toolTab);
public static Item cyan_shovel = new ModShovel(coloreMaterial).setUnlocalizedName("cyan_shovel").setCreativeTab(ModCreativeTabs.toolTab);
public static Item blue_shovel = new ModShovel(coloreMaterial).setUnlocalizedName("blue_shovel").setCreativeTab(ModCreativeTabs.toolTab);
public static Item indigo_shovel = new ModShovel(coloreMaterial).setUnlocalizedName("indigo_shovel").setCreativeTab(ModCreativeTabs.toolTab);
public static Item purple_shovel = new ModShovel(coloreMaterial).setUnlocalizedName("purple_shovel").setCreativeTab(ModCreativeTabs.toolTab);
public static Item brown_shovel = new ModShovel(coloreMaterial).setUnlocalizedName("brown_shovel").setCreativeTab(ModCreativeTabs.toolTab);
public static Item white_shovel = new ModShovel(coloreMaterial).setUnlocalizedName("white_shovel").setCreativeTab(ModCreativeTabs.toolTab);
public static Item gray_shovel = new ModShovel(coloreMaterial).setUnlocalizedName("gray_shovel").setCreativeTab(ModCreativeTabs.toolTab);
public static Item black_shovel = new ModShovel(coloreMaterial).setUnlocalizedName("black_shovel").setCreativeTab(ModCreativeTabs.toolTab);
public static Item rainbow_shovel = new ModShovel(coloreMaterial).setUnlocalizedName("rainbow_shovel").setCreativeTab(ModCreativeTabs.toolTab);

// hoes
public static Item red_hoe = new ModHoe(coloreMaterial).setUnlocalizedName("red_hoe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item reddish_orange_hoe = new ModHoe(coloreMaterial).setUnlocalizedName("reddish_orange_hoe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item orangish_yellow_hoe = new ModHoe(coloreMaterial).setUnlocalizedName("orangish_yellow_hoe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item yellow_hoe = new ModHoe(coloreMaterial).setUnlocalizedName("yellow_hoe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item yellowish_green_hoe = new ModHoe(coloreMaterial).setUnlocalizedName("yellowish_green_hoe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item green_hoe = new ModHoe(coloreMaterial).setUnlocalizedName("green_hoe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item cyan_hoe = new ModHoe(coloreMaterial).setUnlocalizedName("cyan_hoe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item blue_hoe = new ModHoe(coloreMaterial).setUnlocalizedName("blue_hoe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item indigo_hoe = new ModHoe(coloreMaterial).setUnlocalizedName("indigo_hoe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item purple_hoe = new ModHoe(coloreMaterial).setUnlocalizedName("purple_hoe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item brown_hoe = new ModHoe(coloreMaterial).setUnlocalizedName("brown_hoe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item white_hoe = new ModHoe(coloreMaterial).setUnlocalizedName("white_hoe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item gray_hoe = new ModHoe(coloreMaterial).setUnlocalizedName("gray_hoe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item black_hoe = new ModHoe(coloreMaterial).setUnlocalizedName("black_hoe").setCreativeTab(ModCreativeTabs.toolTab);
public static Item rainbow_hoe = new ModHoe(coloreMaterial).setUnlocalizedName("rainbow_hoe").setCreativeTab(ModCreativeTabs.toolTab);


public static void registerItems() {
	try {
		for (Field f : ToolRegistry.class.getFields()) { // get all declared fields in the ItemRegistry class
			if (Item.class.isAssignableFrom(f.getType())) { // if a field is an item, fetch it and register it
				Item item = (Item) f.get(null);
				if (item != null) {
					String name = item.getUnlocalizedName();
					GameRegistry.registerItem(item, name.substring(name.lastIndexOf(".") + 1));
				}
			}
		}
	} catch(Exception e) {
		// catch so game won't crash, but log so issue can still be found and fixed
		e.printStackTrace();
	}
}

public static void registerRenders() {

	try {
		for (Field f : ToolRegistry.class.getFields()) { // get all declared fields in the ItemRegistry class
			if (Item.class.isAssignableFrom(f.getType())) { // if a field is an item, fetch it and register its renders
				Item item = (Item) f.get(null);
				if (item != null) {
					registerRender(item);
				}
			}
		}
	} catch(Exception e) {
		// catch so game won't crash, but log so issue can still be found and fixed
		e.printStackTrace();
	}

}

//This method is called by the registerRenders method every time it adds an item.
public static void registerRender(Item item) {
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
}
}

 

 

Colore - The mod that adds monochrome blocks in every color of the rainbow!

http://www.minecraftforge.net/forum/index.php?topic=35149

 

If you're looking to learn how to make mods for 1.9.4, I wrote a helpful article with links to a lot of useful resources for learning Minecraft 1.9.4 modding!

 

http://supergeniuszeb.com/mods/a-helpful-list-of-minecraft-1-9-4-modding-resources/

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • [13abr.2024 23:04:08.876] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher running: args [--username, thehappiestdeus, --version, 1.20.1-forge-47.2.23, --gameDir, C:\Users\********\AppData\Roaming\.minecraft, --assetsDir, C:\Users\********\AppData\Roaming\.minecraft\assets, --assetIndex, 5, --uuid, 6947100bd693327a9d73af48e609bc8e, --accessToken, ????????, --clientId, 0, --xuid, 0, --userType, msa, --versionType, release, --width, 854, --height, 480, --launchTarget, forgeclient, --fml.forgeVersion, 47.2.23, --fml.mcVersion, 1.20.1, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20230612.114412] [13abr.2024 23:04:08.900] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher 10.0.9 10.0.9 main.dcd20f30 starting: java version 17.0.8 by Microsoft; OS Windows 11 arch amd64 version 10.0 [13abr.2024 23:04:12.324] [main/INFO] [net.minecraftforge.fml.loading.ImmediateWindowHandler/]: Loading ImmediateWindowProvider fmlearlywindow [13abr.2024 23:04:12.626] [main/INFO] [EARLYDISPLAY/]: Trying GL version 4.6 [13abr.2024 23:04:15.807] [main/INFO] [EARLYDISPLAY/]: Requested GL version 4.6 got version 4.6 [13abr.2024 23:04:16.706] [pool-4-thread-1/INFO] [EARLYDISPLAY/]: GL info: NVIDIA GeForce GTX 1050/PCIe/SSE2 GL version 4.6.0 NVIDIA 551.61, NVIDIA Corporation [13abr.2024 23:04:18.403] [main/WARN] [gg.essential.loader.stage1.EssentialLoaderBase/]: Found newer Essential Loader (stage2) version 1.6.0 [stable], skipping at user request [13abr.2024 23:04:18.405] [main/INFO] [gg.essential.loader.stage1.EssentialLoaderBase/]: Starting Essential Loader (stage2) version 1.4.1 (4b3b87be87d34916028dffa85460d085) [stable] [13abr.2024 23:04:18.631] [main/INFO] [mixin/]: SpongePowered MIXIN Subsystem Version=0.8.5 Source=union:/C:/Users/********/AppData/Roaming/.minecraft/libraries/org/spongepowered/mixin/0.8.5/mixin-0.8.5.jar#100!/ Service=ModLauncher Env=CLIENT [13abr.2024 23:04:18.982] [main/WARN] [gg.essential.loader.stage2.EssentialLoaderBase/]: Found newer Essential version 1.3.1.3 [stable], skipping at user request [13abr.2024 23:04:20.965] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\********\AppData\Roaming\.minecraft\libraries\net\minecraftforge\fmlcore\1.20.1-47.2.23\fmlcore-1.20.1-47.2.23.jar is missing mods.toml file [13abr.2024 23:04:20.974] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\********\AppData\Roaming\.minecraft\libraries\net\minecraftforge\javafmllanguage\1.20.1-47.2.23\javafmllanguage-1.20.1-47.2.23.jar is missing mods.toml file [13abr.2024 23:04:20.981] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\********\AppData\Roaming\.minecraft\libraries\net\minecraftforge\lowcodelanguage\1.20.1-47.2.23\lowcodelanguage-1.20.1-47.2.23.jar is missing mods.toml file [13abr.2024 23:04:20.991] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\********\AppData\Roaming\.minecraft\libraries\net\minecraftforge\mclanguage\1.20.1-47.2.23\mclanguage-1.20.1-47.2.23.jar is missing mods.toml file [13abr.2024 23:04:22.047] [main/WARN] [net.minecraftforge.jarjar.selection.JarSelector/]: Attempted to select two dependency jars from JarJar which have the same identification: Mod File: and Mod File: . Using Mod File: [13abr.2024 23:04:22.056] [main/WARN] [net.minecraftforge.jarjar.selection.JarSelector/]: Attempted to select a dependency jar for JarJar which was passed in as source: curios. Using Mod File: C:\Users\********\AppData\Roaming\.minecraft\mods\curios-forge-5.7.2 1.20.1.jar [13abr.2024 23:04:22.056] [main/WARN] [net.minecraftforge.jarjar.selection.JarSelector/]: Attempted to select a dependency jar for JarJar which was passed in as source: resourcefullib. Using Mod File: C:\Users\********\AppData\Roaming\.minecraft\mods\resourcefullib-forge-1.20.1-2.1.24.jar [13abr.2024 23:04:22.058] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.JarInJarDependencyLocator/]: Found 22 dependencies adding them to mods collection [13abr.2024 23:04:31.937] [main/INFO] [mixin/]: Compatibility level set to JAVA_17 [13abr.2024 23:04:31.989] [main/ERROR] [mixin/]: Mixin config firstperson.mixins.json does not specify "minVersion" property [13abr.2024 23:04:32.169] [main/ERROR] [mixin/]: Mixin config entity_model_features.mixins.json does not specify "minVersion" property [13abr.2024 23:04:33.081] [main/INFO] [mixin/]: Successfully loaded Mixin Connector [com.sonicether.soundphysics.MixinConnector] [13abr.2024 23:04:33.089] [main/INFO] [cpw.mods.modlauncher.LaunchServiceHandler/MODLAUNCHER]: Launching target 'forgeclient' with arguments [--version, 1.20.1-forge-47.2.23, --gameDir, C:\Users\********\AppData\Roaming\.minecraft, --assetsDir, C:\Users\********\AppData\Roaming\.minecraft\assets, --uuid, 6947100bd693327a9d73af48e609bc8e, --username, thehappiestdeus, --assetIndex, 5, --accessToken, ????????, --clientId, 0, --xuid, 0, --userType, msa, --versionType, release, --width, 854, --height, 480] [13abr.2024 23:04:33.497] [main/INFO] [ModernFix/]: Loaded configuration file for ModernFix 5.15.0 mc1.20.1: 77 options available, 0 override(s) found [13abr.2024 23:04:33.500] [main/INFO] [ModernFix/]: Applying Nashorn fix [13abr.2024 23:04:33.544] [main/INFO] [ModernFix/]: Applied Forge config corruption patch [13abr.2024 23:04:33.869] [main/INFO] [Embeddium/]: Loaded configuration file for Embeddium: 172 options available, 3 override(s) found [13abr.2024 23:04:33.873] [main/INFO] [Embeddium-GraphicsAdapterProbe/]: Searching for graphics cards... [13abr.2024 23:04:34.631] [main/INFO] [Embeddium-GraphicsAdapterProbe/]: Found graphics card: GraphicsAdapterInfo[vendor=NVIDIA, name=NVIDIA GeForce GTX 1050, version=DriverVersion=31.0.15.5161] [13abr.2024 23:04:34.632] [main/INFO] [Embeddium-GraphicsAdapterProbe/]: Found graphics card: GraphicsAdapterInfo[vendor=INTEL, name=Intel(R) UHD Graphics 630, version=DriverVersion=31.0.101.2111] [13abr.2024 23:04:34.644] [main/WARN] [Embeddium-Workarounds/]: Sodium has applied one or more workarounds to prevent crashes or other issues on your system: [NVIDIA_THREADED_OPTIMIZATIONS] [13abr.2024 23:04:34.645] [main/WARN] [Embeddium-Workarounds/]: This is not necessarily an issue, but it may result in certain features or optimizations being disabled. You can sometimes fix these issues by upgrading your graphics driver. [13abr.2024 23:04:34.668] [main/WARN] [mixin/]: Reference map 'entity_model_features_forge_1.20.1-forge-refmap.json' for entity_model_features.mixins.json could not be read. If this is a development environment you can ignore this message [13abr.2024 23:04:34.868] [main/WARN] [mixin/]: Reference map 'yungsextras.refmap.json' for yungsextras.mixins.json could not be read. If this is a development environment you can ignore this message [13abr.2024 23:04:34.879] [main/WARN] [mixin/]: Reference map 'yungsextras.refmap.json' for yungsextras_forge.mixins.json could not be read. If this is a development environment you can ignore this message [13abr.2024 23:04:35.002] [main/WARN] [mixin/]: Reference map 'nitrogen_internals.refmap.json' for nitrogen_internals.mixins.json could not be read. If this is a development environment you can ignore this message [13abr.2024 23:04:35.135] [main/INFO] [Radium Config/]: Loaded configuration file for Radium: 125 options available, 1 override(s) found [13abr.2024 23:04:35.152] [main/WARN] [mixin/]: Reference map 'trashslot.refmap.json' for trashslot.mixins.json could not be read. If this is a development environment you can ignore this message [13abr.2024 23:04:35.360] [main/WARN] [mixin/]: Reference map '${refmap_target}refmap.json' for corgilib.forge.mixins.json could not be read. If this is a development environment you can ignore this message [13abr.2024 23:04:35.404] [main/WARN] [mixin/]: Reference map 'coroutil.refmap.json' for coroutil.mixins.json could not be read. If this is a development environment you can ignore this message [13abr.2024 23:04:35.599] [main/WARN] [mixin/]: Reference map 'chiselsandbits.refmap.json' for chisels-and-bits.mixins.json could not be read. If this is a development environment you can ignore this message [13abr.2024 23:04:35.634] [main/WARN] [mixin/]: Reference map 'cristellib-forge-refmap.json' for cristellib.mixins.json could not be read. If this is a development environment you can ignore this message [13abr.2024 23:04:35.822] [main/INFO] [Essential Logger - Plugin/]: Starting Essential v1.3.1.1 (#3a090c5c88) [stable] [13abr.2024 23:04:40.482] [main/WARN] [mixin/]: Error loading class: dev/tr7zw/skinlayers/render/CustomizableModelPart (java.lang.ClassNotFoundException: dev.tr7zw.skinlayers.render.CustomizableModelPart) [13abr.2024 23:04:42.465] [main/WARN] [Radium Config/]: Force-disabling mixin 'alloc.blockstate.StateMixin' as option 'mixin.alloc.blockstate' (added by mods [ferritecore]) disables it and children [13abr.2024 23:04:43.118] [main/WARN] [mixin/]: Error loading class: vectorwing/farmersdelight/client/renderer/HangingCanvasSignRenderer (java.lang.ClassNotFoundException: vectorwing.farmersdelight.client.renderer.HangingCanvasSignRenderer) [13abr.2024 23:04:43.129] [main/WARN] [mixin/]: Error loading class: vectorwing/farmersdelight/client/renderer/CanvasSignRenderer (java.lang.ClassNotFoundException: vectorwing.farmersdelight.client.renderer.CanvasSignRenderer) [13abr.2024 23:04:45.276] [main/WARN] [Embeddium/]: Force-disabling mixin 'features.render.world.sky.WorldRendererMixin' as rule 'mixin.features.render.world.sky' (added by mods [oculus]) disables it and children [13abr.2024 23:04:45.277] [main/WARN] [Embeddium/]: Force-disabling mixin 'features.render.world.sky.ClientWorldMixin' as rule 'mixin.features.render.world.sky' (added by mods [oculus]) disables it and children [13abr.2024 23:04:45.278] [main/WARN] [Embeddium/]: Force-disabling mixin 'features.render.world.sky.BackgroundRendererMixin' as rule 'mixin.features.render.world.sky' (added by mods [oculus]) disables it and children [13abr.2024 23:04:45.285] [main/WARN] [Embeddium/]: Force-disabling mixin 'features.render.gui.font.GlyphRendererMixin' as rule 'mixin.features.render.gui.font' (added by mods [oculus]) disables it and children [13abr.2024 23:04:45.285] [main/WARN] [Embeddium/]: Force-disabling mixin 'features.render.gui.font.FontSetMixin' as rule 'mixin.features.render.gui.font' (added by mods [oculus]) disables it and children [13abr.2024 23:04:45.286] [main/WARN] [Embeddium/]: Force-disabling mixin 'features.render.entity.shadows.EntityRenderDispatcherMixin' as rule 'mixin.features.render.entity' (added by mods [oculus]) disables it and children [13abr.2024 23:04:45.286] [main/WARN] [Embeddium/]: Force-disabling mixin 'features.render.entity.fast_render.ModelPartMixin' as rule 'mixin.features.render.entity' (added by mods [oculus]) disables it and children [13abr.2024 23:04:45.288] [main/WARN] [Embeddium/]: Force-disabling mixin 'features.render.entity.fast_render.CuboidMixin' as rule 'mixin.features.render.entity' (added by mods [oculus]) disables it and children [13abr.2024 23:04:45.291] [main/WARN] [Embeddium/]: Force-disabling mixin 'features.render.entity.cull.EntityRendererMixin' as rule 'mixin.features.render.entity' (added by mods [oculus]) disables it and children [13abr.2024 23:04:46.387] [main/INFO] [MixinExtras|Service/]: Initializing MixinExtras via com.llamalad7.mixinextras.service.MixinExtrasServiceImpl(version=0.3.5). [13abr.2024 23:04:51.658] [pool-6-thread-1/INFO] [net.minecraft.server.Bootstrap/]: ModernFix reached bootstrap stage (53.35 s after launch) [13abr.2024 23:04:52.021] [pool-6-thread-1/WARN] [mixin/]: @Final field delegatesByName:Ljava/util/Map; in modernfix-forge.mixins.json:perf.forge_registry_alloc.ForgeRegistryMixin should be final [13abr.2024 23:04:52.023] [pool-6-thread-1/WARN] [mixin/]: @Final field delegatesByValue:Ljava/util/Map; in modernfix-forge.mixins.json:perf.forge_registry_alloc.ForgeRegistryMixin should be final [13abr.2024 23:04:52.518] [pool-6-thread-1/INFO] [ModernFix/]: Injecting BlockStateBase cache population hook into getNeighborPathNodeType from me.jellysquid.mods.lithium.mixin.ai.pathing.AbstractBlockStateMixin [13abr.2024 23:04:52.519] [pool-6-thread-1/INFO] [ModernFix/]: Injecting BlockStateBase cache population hook into getPathNodeType from me.jellysquid.mods.lithium.mixin.ai.pathing.AbstractBlockStateMixin [13abr.2024 23:04:52.520] [pool-6-thread-1/INFO] [ModernFix/]: Injecting BlockStateBase cache population hook into getAllFlags from me.jellysquid.mods.lithium.mixin.util.block_tracking.AbstractBlockStateMixin [13abr.2024 23:04:57.799] [pool-6-thread-1/INFO] [net.minecraft.server.Bootstrap/]: Vanilla bootstrap took 6125 milliseconds  
    • k i opened rit and luanched. no matter what launcher i use, it always says 2 mods loaded, but it has 0 mdos loaded. i tried several times with multiMC
    • i downloaded it. what do i do next? how do i open the luancher
    • It happened suddenly to me and a friend and we don't know how to fix it Blocks like the lava, the "UGH" sound, the door sound, etc.
  • Topics

×
×
  • Create New...

Important Information

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