As the long title suggests I have a question about a few things. Recently I started attempting to learn how to mod minecraft, I am currently at the "oh its that function, string, variable.." "**** YOU SEMI COLON" stage , a pretty basic level right now. That aside I wanted to add the ability to craft stained glass panes.
To do so I assumed I would do something along the line of BlockGlasspane and with in that have the various information needed to have it place in the world properly. Then in the mod register each block, give it a block id, where to find each unqiue colored texture. That seems like it would be ineffecient to do, so I tried to look at wool for an example. That was a rabbit hole.
BlockCloth is as follows
package net.minecraft.src;
public class BlockCloth extends Block
{
public BlockCloth()
{
super(35, 64, Material.cloth);
}
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
*/
public int getBlockTextureFromSideAndMetadata(int par1, int par2)
{
if (par2 == 0)
{
return blockIndexInTexture;
}
else
{
par2 = ~(par2 & 0xf);
return 113 + ((par2 & 8) >> 3) + (par2 & 7) * 16;
}
}
/**
* Determines the damage on the item the block drops. Used in cloth and wood.
*/
protected int damageDropped(int par1)
{
return par1;
}
/**
* Takes a dye damage value and returns the block damage value to match
*/
public static int getBlockFromDye(int par0)
{
return ~par0 & 0xf;
}
/**
* Takes a block damage value and returns the dye damage value to match
*/
public static int getDyeFromBlock(int par0)
{
return ~par0 & 0xf;
}
}
After realizing that its colors were determined entirely by the dyes I looked at the ItemDye file and found the colors. My guess is it is the Dye damage value and black damage value determine color, but I am not sure. So my question is, where exactly are the colors being determined and would it be more efficient to use the established colors and reference the ItemDye.java, instead of creating 9+ new blocks.
If it is against the rules to post original MC code I will gladly delete it/have it deleted. I did not see anything about it in the rules.
Rollback Post to RevisionRollBack
They can QQ me a river to go rafting on. It'll be awesome
- RStriker69
To do so I assumed I would do something along the line of BlockGlasspane and with in that have the various information needed to have it place in the world properly. Then in the mod register each block, give it a block id, where to find each unqiue colored texture. That seems like it would be ineffecient to do, so I tried to look at wool for an example. That was a rabbit hole.
BlockCloth is as follows
public class BlockCloth extends Block
{
public BlockCloth()
{
super(35, 64, Material.cloth);
}
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
*/
public int getBlockTextureFromSideAndMetadata(int par1, int par2)
{
if (par2 == 0)
{
return blockIndexInTexture;
}
else
{
par2 = ~(par2 & 0xf);
return 113 + ((par2 & 8) >> 3) + (par2 & 7) * 16;
}
}
/**
* Determines the damage on the item the block drops. Used in cloth and wood.
*/
protected int damageDropped(int par1)
{
return par1;
}
/**
* Takes a dye damage value and returns the block damage value to match
*/
public static int getBlockFromDye(int par0)
{
return ~par0 & 0xf;
}
/**
* Takes a block damage value and returns the dye damage value to match
*/
public static int getDyeFromBlock(int par0)
{
return ~par0 & 0xf;
}
}
If it is against the rules to post original MC code I will gladly delete it/have it deleted. I did not see anything about it in the rules.
- RStriker69