Jump to content

Recommended Posts

Posted

Hi there,

 

I'm developing a Mod (in Minecraft Version 1.5.2) which adds very much items and at least more that 1000 Images. It add most of the Elements existing in RL, each one has got it's pickaxe, axe, ore,... Because of that, I'm not very pleased drawing every Image for itself and it's laborious!

 

My source is actually like this:

public void updateIcons(IconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon("ModID:ItemName");
}

 

But I expect something like this:

 

public void updateIcons(IconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIconFromImage(new BufferedImage(CreateImage(name, color)));
}

 

The reason, why the method with the Strings (actual way of doing it) isn't that good for me, because I'm not pleased to draw 1000 Images as I said before; my function CreateImage does the work for me. It colores e.g. the wedge of the axe (like spawneggs, the colorcode is given), combines this result with the rod of the axe and returnes the final image.

 

I hope you understand what I mean :)

 

MFG LordJuli

 

Additional Code:

 

Element.java

public class Element {

public Element(int ID, String name, String symbol, int num, int smeltK, int boilK, boolean hofbrincl, int electronegativity, int harvestLevel, int maxUses, float efficiencyOnProperMaterial, int damageVsEntity, int enchantability) //some parameters are used later on 
{
	EnumToolMaterial etm = EnumToolMaterial.XXX;
	(new ToolMaterial()).setup(etm, harvestLevel, maxUses, efficiencyOnProperMaterial, damageVsEntity, enchantability);
	BlockOre Ore;
	BlockBlock Block;
	ItemIngot Ingot;
	ItemEBucket Bucket;
	ItemGasBottle GasBottle;
	ToolAxe Axe;
	ToolShovel Shovel;
	ToolSword Sword;
	ToolHoe Hoe;
	ToolBow Bow;
	ToolPickaxe Pickaxe;
	boolean radioactive = false;
	if (num > 83)
	{
		radioactive = true;
	}
	Ore = new BlockOre(199 + 2 * (ID - 1) + 1, name);
	Block = new BlockBlock(199 + 2 * (ID - 1) + 2, name);

	Ingot = new ItemIngot(999 + 6 * (ID - 1) + 1, name);

	Pickaxe = new ToolPickaxe(999 + 9 * (ID - 1) + 2, etm, name);
	Axe = new ToolAxe(999 + 9 * (ID - 1) + 3, etm, name);
	Sword = new ToolSword(999 + 9 * (ID - 1) + 4, etm, name);
	Shovel = new ToolShovel(999 + 9 * (ID - 1) + 5, etm, name);
	Hoe = new ToolHoe(999 + 9 * (ID - 1) + 6, etm, name);
	Bow = new ToolBow(999 + 9 * (ID - 1) + 7, etm, name);
	GasBottle = new ItemGasBottle(999 + 9 * (ID - 1) + 8, name);
	Bucket = new ItemEBucket(999 + 9 * (ID - 1) + 9, etm, name);

	GameRegistry.registerBlock(Ore, name + "ore (" + num + " " + symbol + ")");
	GameRegistry.registerBlock(Block, name + "block (" + num + " " + symbol + ")");

	GameRegistry.registerItem(Ingot, name + "ingot (" + num + " " + symbol + ")");

	GameRegistry.registerItem(Pickaxe, name + "pickaxe (" + num + " " + symbol + ")");
	GameRegistry.registerItem(Axe, name + "axe (" + num + " " + symbol + ")");
	GameRegistry.registerItem(Sword, name + "sword (" + num + " " + symbol + ")");
	GameRegistry.registerItem(Shovel, name + "shovel (" + num + " " + symbol + ")");
	GameRegistry.registerItem(Hoe, name + "hoe (" + num + " " + symbol + ")");
	GameRegistry.registerItem(Bow, name + "bow (" + num + " " + symbol + ")");

	GameRegistry.addSmelting(Ore.blockID, new ItemStack(Ingot), 0.45F);

	GameRegistry.addRecipe(new ItemStack(Pickaxe), new Object[] {"HHH"," I "," I ", 'H', Ingot ,'I', Item.stick });
	GameRegistry.addRecipe(new ItemStack(Axe), new Object[] {"HH ","HI "," I ", 'H', Ingot ,'I', Item.stick });
	GameRegistry.addRecipe(new ItemStack(Sword), new Object[] {" H "," H "," I ", 'H', Ingot ,'I', Item.stick });
	GameRegistry.addRecipe(new ItemStack(Shovel), new Object[] {" H "," I "," I ", 'H', Ingot ,'I', Item.stick });
	GameRegistry.addRecipe(new ItemStack(Hoe), new Object[] {"HH "," I "," I ", 'H', Ingot ,'I', Item.stick });
	GameRegistry.addRecipe(new ItemStack(Bow), new Object[] {"H I","H I","HI ", 'H', Ingot ,'I', Item.stick });
	GameRegistry.addRecipe(new ItemStack(Bow), new Object[] {" IH","I H"," IH", 'H', Ingot ,'I', Item.stick });

	LanguageRegistry.addName(Ore, name + "ore (" + num + " " + symbol + ")");
	LanguageRegistry.addName(Block, name + "block (" + num + " " + symbol + ")");

	LanguageRegistry.addName(Ingot, name + "ingot (" + num + " " + symbol + ")");

	LanguageRegistry.addName(Pickaxe, name + "pickaxe (" + num + " " + symbol + ")");
	LanguageRegistry.addName(Axe, name + "axe (" + num + " " + symbol + ")");
	LanguageRegistry.addName(Sword, name + "sword (" + num + " " + symbol + ")");
	LanguageRegistry.addName(Shovel, name + "shovel (" + num + " " + symbol + ")");
	LanguageRegistry.addName(Hoe, name + "hoe (" + num + " " + symbol + ")");
	LanguageRegistry.addName(Bow, name + "bow (" + num + " " + symbol + ")");
}
}

 

ToolPickaxe.java

public class ToolPickaxe extends ItemPickaxe{

String name;
public ToolPickaxe(int par1, EnumToolMaterial par2EnumToolMaterial, String name) {
	super(par1, par2EnumToolMaterial);
	this.setUnlocalizedName(name + "pickaxe");
	this.name = name;
}

@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister reg)
{
	this.itemIcon = reg.registerIcon("AdvancedMinecraft:tool_" + name.toLowerCase() + "_pickaxe"); //Image as Input expected!
}

}

Posted

I forgot, because it's so much, it's pointless extracting the function...

 

The class Element is initialized like:

 

Oxygen = new Element(16, "Oxygen", "O2", ...)

Posted

You can register your own AtlastTextures and do w/e you want in it.

However, for The texture packer's sake. I advise either generating your images at release time once, or making a standard format to allow the texture pack artists to design them.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted
  Quote
AtlastTextures

What is this?

 

  Quote
However, for The texture packer's sake. I advise either generating your images at release time once, or making a standard format to allow the texture pack artists to design them.

As I mentioned, the core images, like the axe rod and wegde given; just look @ the generation of the spawneggs!

 

  Quote
...allow the texture pack artists to design them.

You can design as much, as you can design the spawneggs. Think of it like colring the spawnegg and paining a border around it and calling it a new item ;)

 

MFG LordJuli

 

P.S. Thanks for you fast answer

Posted

Its a class in minecraft, look it up.

Go try to understand whats actually happening when you register an icon -.-

Now that you bring up spawn eggs. There is a perfect example of what you want.

It's a multi-passs system that renders the default base on bottom.

Then renders the second layer with a tint.

 

Why arnt you using that system?

'I want to do the same thing eggs do but instead of researching how they do it I wanna change minecrafts render engine'

Seems... overkill...

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

I don't get it :(

But thanks for your help :)

Maybe I fix it myself

 

Thanks for your help, advice and time spent on my questions :D

 

MFG LordJuli

Posted
  On 7/22/2013 at 5:57 PM, LexManos said:

Go try to understand whats actually happening when you register an icon -.-

It's only an Interface(-method) and additionally, I've already searched a lot, but no result.

Sorry for being a fool ;)

Posted

Something has to IMPLEMENT that interface.. that's how programming works.

Eclipse has tools to tell you what implements it.

Go forth and do research!

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

I've got an idea: the people who write their programs know their use best, so isn't it useful if you create the function, which can register a BufferedImage, because you know how MinecraftForge works, you know what is standing for what and you know what object has which sense... Just an idea^^

 

MFG LordJuli

 

P.S. I accept a yes and a no, but I think it's easier for you than for me ;)

Posted

That sentence didn't even make sense.

But i'm locking this because it's not needed and it undermines how the new system is designed.

Use the new system how it's designed and you'll be fine.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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