I am getting in Minecraft Modding and I am creating a simple mod. Earlier today, I had a problem where the name item method wasn't defined, but I used setUnlocalizedName instead, which seemed to work. Now I am adding textures, and in the class, I have written:
Yet it says that setBlockTextureName (in the Compressed Stone Class) is undefined. I also tried this with an item, and I got the undefined error again. Can someone please help me resolve why all of these methods are "undefined"?
I also tried using the quick fix that Eclipse suggests, which is just:
What you said I should write, the way I am reading it, seems to be what I have already written. If it is not what you mean, could you please make it a little bit clearer? I notice in the console that it says when I run the game that I am missing the model for the items. Also, does the image need to be in PNG, JPEG, or JPG?
I have found that when I am typing the code, when I write the word "set", certain things are suggested like setHarvestLevel. However, setBlockTextureName and setBlockName are not suggested.
Since no one seems to have noticed, this thread has a 1.8 tag. There is no setBlockName or setBlockTextureName method in 1.8. Defining textures for blocks and items are done differently now. See this thread about updating to 1.8 on the minecraftforge forums. http://www.minecraftforge.net/forum/index.php/topic,24263.0.html
I hope this well help you get your blocks to work, I know for me it took a few days to figure it out. Good luck.
Thanks for taking the time to help me with this. I am aware that in setHarvestLevel, 0 = wood, and so forth. I have set it to pickaxe level 1, however I am still able to mine the block with a wood pickaxe.
I downloaded one of the programs it suggested, and I still seem to be having some problems loading the textures. It shows in the console that it is missing model from: "graysull:item/item.ComStone" Not sure what's going on?
public class Rock extends net.minecraft.block.Block{
public final boolean isStoneEquivalent;
public Rock(boolean isStoneEquivalent,float hardness,float blastResistance,int toolHardnessLevel,SoundType sound) {
super(Material.rock);
this.isStoneEquivalent = isStoneEquivalent;
this.setHardness((float)hardness); // dirt is 0.5, grass is 0.6, stone is 1.5,iron ore is 3, obsidian is 50
this.setResistance((float)blastResistance); // dirt is 0, iron ore is 5, stone is 10, obsidian is 2000
this.setStepSound(Block.soundTypePiston); // sound for stone
this.setHarvestLevel("pickaxe", toolHardnessLevel);
}
@Override public boolean isReplaceable(World world, BlockPos coord)
{
return Blocks.stone.isReplaceable(world, coord);
}
Note that textures and models are not handled by code anymore. Instead, they are specified by your resource pack (by a large variety of .json files). Basically, Minecraft looks for XXX.json files, where XXX is teh unlocalized name. Extract the assets folder from Vanilla Minecraft and you'll see what that looks like. See also my post here.
My mods: Base Metals, Power Advantage, Steam Advantage, Electric Advantage, Minecraft Mineralogy, Dr. Cyano's Lootable Bodies, Dr. Cyano's Wonderful Wands & Wizarding Robes
Minecraft looks for XXX.json files, where XXX is teh unlocalized name. Extract the assets folder from Vanilla Minecraft and you'll see what that looks like. See also my post here.
XXX is actually the name you set when registering the Block/Item which is usually not the Unlocalized Name.
XX is actually the name you set when registering the Block/Item which is usually not the Unlocalized Name.
Thanks for the correction.
Rollback Post to RevisionRollBack
My mods: Base Metals, Power Advantage, Steam Advantage, Electric Advantage, Minecraft Mineralogy, Dr. Cyano's Lootable Bodies, Dr. Cyano's Wonderful Wands & Wizarding Robes
I am aware that setBlockTextureName is no longer used, I have forgot to rename the thread. I have created all three json files named correctly (I believe) in the correct spots (I believe), however it still is not working. I have one in Models/Block, one in Models/Stone, one in Textures/Blocks, and one in Blockstates. The block image is a 16x16 PNG file located in the textures/blocks folder. The json files are named the same as the PNG and the unlocalized name of the block. Help?
I would like the block to only be able to be mined with the stone pick and above. I have the material set to rock currently. Also, do you how if there is a way to control which item the block drops and how many items the block drops?
Also, I am trying to add generation of this block. Has 1.8 changed generation from "generateOverworld"? If not, there seems to be a problem. I am assuming it has changed it to a different method, as I have heard a lot about changes in world generation in the 1.8 snapshots.
For the textures and models, look through the master branch here. As for mining with a stone pick and above, there's a few different ways you can go about it. setHarvestLevel() should be the easiest.
public YOURBLOCK() {
super(MATERIAL);
setHarvestLevel("pickaxe", 3);
}
If that doesn't work for you, you could try the BreakEvent, however that might be a bit tricky to hammer out the compatibility issues.
@SubscribeEvent
public void onBlockBreak(BlockEvent.BreakEvent event) {
if (event.block instanceof YOURBLOCK) {
// Do stuff
}
}
As for world generation, check the link above again.
I have imported the files from the download and changed the quisquelapis to match my ComStone. Eclipse shows no errors, however, the texture still does not seem to be loading in. Also, it seems that the world generation has not worked either. I am probably doing something wrong, as I am new to modding.
I am getting in Minecraft Modding and I am creating a simple mod. Earlier today, I had a problem where the name item method wasn't defined, but I used setUnlocalizedName instead, which seemed to work. Now I am adding textures, and in the class, I have written:
http://pastebin.com/jKfVQrfJ
Yet it says that setBlockTextureName (in the Compressed Stone Class) is undefined. I also tried this with an item, and I got the undefined error again. Can someone please help me resolve why all of these methods are "undefined"?
I also tried using the quick fix that Eclipse suggests, which is just:
private static void setBlockTextureName(String string) {
}
but when I do that, it will run but it won't show the textures.
Help?
1: Create a texture named the what ever the item is called
2: Move it to the texture file from the TUT
3: Write something like this in Initializeblock method
[size=13.33px][size=13.33px][/size]
Also make it so the texture is 16 x 16 pixels.
-Adobe Photoshop
-paint.net
What you said I should write, the way I am reading it, seems to be what I have already written. If it is not what you mean, could you please make it a little bit clearer? I notice in the console that it says when I run the game that I am missing the model for the items. Also, does the image need to be in PNG, JPEG, or JPG?
Thanks
I have found that when I am typing the code, when I write the word "set", certain things are suggested like setHarvestLevel. However, setBlockTextureName and setBlockName are not suggested.
I hope this well help you get your blocks to work, I know for me it took a few days to figure it out. Good luck.
Thanks for taking the time to help me with this. I am aware that in setHarvestLevel, 0 = wood, and so forth. I have set it to pickaxe level 1, however I am still able to mine the block with a wood pickaxe.
Thanks
I downloaded one of the programs it suggested, and I still seem to be having some problems loading the textures. It shows in the console that it is missing model from: "graysull:item/item.ComStone" Not sure what's going on?
Note that textures and models are not handled by code anymore. Instead, they are specified by your resource pack (by a large variety of .json files). Basically, Minecraft looks for XXX.json files, where XXX is teh unlocalized name. Extract the assets folder from Vanilla Minecraft and you'll see what that looks like. See also my post here.
My mods:
Base Metals, Power Advantage, Steam Advantage, Electric Advantage, Minecraft Mineralogy, Dr. Cyano's Lootable Bodies, Dr. Cyano's Wonderful Wands & Wizarding Robes
XXX is actually the name you set when registering the Block/Item which is usually not the Unlocalized Name.
Where XXX is NAME.
Thanks for the correction.
My mods:
Base Metals, Power Advantage, Steam Advantage, Electric Advantage, Minecraft Mineralogy, Dr. Cyano's Lootable Bodies, Dr. Cyano's Wonderful Wands & Wizarding Robes
I am aware that setBlockTextureName is no longer used, I have forgot to rename the thread. I have created all three json files named correctly (I believe) in the correct spots (I believe), however it still is not working. I have one in Models/Block, one in Models/Stone, one in Textures/Blocks, and one in Blockstates. The block image is a 16x16 PNG file located in the textures/blocks folder. The json files are named the same as the PNG and the unlocalized name of the block. Help?
I would like the block to only be able to be mined with the stone pick and above. I have the material set to rock currently. Also, do you how if there is a way to control which item the block drops and how many items the block drops?
Thanks
If that doesn't work for you, you could try the BreakEvent, however that might be a bit tricky to hammer out the compatibility issues.
As for world generation, check the link above again.
I have imported the files from the download and changed the quisquelapis to match my ComStone. Eclipse shows no errors, however, the texture still does not seem to be loading in. Also, it seems that the world generation has not worked either. I am probably doing something wrong, as I am new to modding.
Thanks