You need to override the appropriate methods in your Block class that give you the metadata and/or World and position as arguments.
For explosion resistance, override Block#getExplosionResistance(Entity, World, int, int, int, double, double, double). For hardness, override Block#getBlockHardness. For light values, override Block#getLightValue(IBlockAccess, int, int, int).
Side note: 1.7.10 is extremely outdated and no longer supported by Forge. You should update to 1.10.2.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
public float getExplosionResistance(Entity p_149638_1_, int meta, World world, int x, int y, int z, double d1, double d2, double d3) //use the meta to control the resistance for each block?
{
return this.blockResistance / 5.0F;
}
EDIT: Sorry if this seems really bad, but I am not the best with manipulating meta.
public float getExplosionResistance(Entity p_149638_1_, int meta, World world, int x, int y, int z, double d1, double d2, double d3) //use the meta to control the resistance for each block?
{
return this.blockResistance / 5.0F;
}
EDIT: Sorry if this seems really bad, but I am not the best with manipulating meta.
That return statement doesn't even use the metadata.
There are several ways you can do this: you could make a float[] of resistance values per metadata, and return the float at index [meta]
You could also use a switch statement.
I suppose it depends on how many metadata values you plan to have, and which would be easier for you to alter later.
Rollback Post to RevisionRollBack
Click this banner for a list of illegal mod distributors -- only download from legal sites!
I made dimensions which uses both custom ores and mc ores in its world gen, the only problem is they all have the same things across them, i.e, harvest level req, tool req, blast resist, etc. This is problematic when diamond ore can be mined with stone, haha
It is a full meta block, meaning 0-15 values.
And the first method seems sound. I'll try that and get back to this thread.
How can I make different metadata blocks have different resistances, light values, etc.?
NULL
You need to override the appropriate methods in your Block class that give you the metadata and/or World and position as arguments.
For explosion resistance, override Block#getExplosionResistance(Entity, World, int, int, int, double, double, double). For hardness, override Block#getBlockHardness. For light values, override Block#getLightValue(IBlockAccess, int, int, int).
Side note: 1.7.10 is extremely outdated and no longer supported by Forge. You should update to 1.10.2.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
-snip-
NULL
So, would it be something like:
public float getExplosionResistance(Entity p_149638_1_, int meta, World world, int x, int y, int z, double d1, double d2, double d3) //use the meta to control the resistance for each block?
{
return this.blockResistance / 5.0F;
}
EDIT: Sorry if this seems really bad, but I am not the best with manipulating meta.
NULL
That return statement doesn't even use the metadata.
There are several ways you can do this: you could make a float[] of resistance values per metadata, and return the float at index [meta]
You could also use a switch statement.
I suppose it depends on how many metadata values you plan to have, and which would be easier for you to alter later.
Well, I am using metadata for ores.
I made dimensions which uses both custom ores and mc ores in its world gen, the only problem is they all have the same things across them, i.e, harvest level req, tool req, blast resist, etc. This is problematic when diamond ore can be mined with stone, haha
It is a full meta block, meaning 0-15 values.
And the first method seems sound. I'll try that and get back to this thread.
NULL