Jump to content

BlockID Resolution and registry.


xeed

Recommended Posts

Hello there,

I have trouble with understanding how the GameRegistry works in regards of blockID's etc.

I'm currently trying to extract the id and metadata of a given location. I stumbled upon the metadatasplitting of wood logs or leaves for example:

 

public int damageDropped(int par1)
{
  return par1 & 3;
}

 

This uses the first 2 bits for subblock identification of the BlockLeaves, which has 4 different types. In order to work with all (unknown) types of blocks, I would need a method to resolve the block class by the blockId. I couldn't find such a method by now. This led me to the GameRegistry. I'm aiming for working with vanilla blocks aswell as foreign modded blocks.

 

In the GameRegistry you can resolve a block by its modid and name (which is ok). How would I get the name of a given id?

 

In addition to this I used BiomesOPlenty as a reference and found this (https://github.com/Glitchfiend/BiomesOPlenty/blob/BOP-1.7.10-2.1.x/src/main/java/biomesoplenty/common/blocks/BOPBlock.java):

 

public abstract class BOPBlock extends Block
{
protected BOPBlock(Material material)
{
	super(material);

	this.setCreativeTab(BiomesOPlenty.tabBiomesOPlenty);
}
}

 

which obviously differs from my mc block implementation in a critical way:

 

public Block(int blockID, Material par2Material) {
...
}

 

So BOP seems to use another Block implementation, which does not require an id to be set. I don't even know what to ask here. I just can't understand how the blockID is determined. So i dont know blockID->Block, blockID->blockName, in mods i don't even know Block->blockID.

 

Im working with forge-1.6.4-9.11.1.964. BOP seems to use 1.6.2. The questions are a bit vague. But feel free to elaborate how the id management is supposed to work or point to sth, i couldn't find.

 

 

 

 

Link to comment
Share on other sites

Im working with forge-1.6.4-9.11.1.964

In addition to this I used BiomesOPlenty as a reference and found this (https://github.com/Glitchfiend/BiomesOPlenty/blob/BOP-1.7.10-2.1.x/src/main/java/biomesoplenty/common/blocks/BOPBlock.java)

 

And also, why are you working on 1.6.4?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


×
×
  • Create New...

Important Information

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