Cookie160 Posted January 1, 2014 Share Posted January 1, 2014 After watching multiple outdated videos on making blocks, I managed to get myself and un-textured unnamed block. When I try using the updated format, it crashes with NullPointerException (I know what that means) despite the fact that almost nothing changed. I was wondering if someone could tell me the proper way to have the "int id, int texture, Material" thing in 1.6.4. I presume this isn't too complicatated, but is yet too much for a noob like me Thank you Quote Link to comment Share on other sites More sharing options...
drmrlego Posted January 1, 2014 Share Posted January 1, 2014 Can I see your code please? Quote Did I help? Gimme a thanks! Link to comment Share on other sites More sharing options...
Cookie160 Posted January 1, 2014 Author Share Posted January 1, 2014 https://www.dropbox.com/s/chb3dnw1a998p70/Mod.zip Thank you! Quote Link to comment Share on other sites More sharing options...
Cookie160 Posted January 1, 2014 Author Share Posted January 1, 2014 Will do! Quote Link to comment Share on other sites More sharing options...
Cookie160 Posted January 1, 2014 Author Share Posted January 1, 2014 http://pastebin.com/BaZaZ6yS Beware, code for all of my files are present in this paste bin! Thank you Quote Link to comment Share on other sites More sharing options...
drmrlego Posted January 2, 2014 Share Posted January 2, 2014 public class BlockCompressedCobblestone extends Block{ public BlockCompressedCobblestone(int id, Material par2Material) { super(id, par2Material); this.setCreativeTab(furniturecraft.FCTab); } @SideOnly(Side.CLIENT) public void registerIcons(IconRegister icon){ this.blockIcon = icon.registerIcon(furniturecraft.modid + ":" + "CompressedCobblestone"); } } That is my block code for my mod, and it is 1.6.4, and... public Block setBlockName(String string) { // TODO Auto-generated method stub return null; } ...indeed, it should not be there. Quote Did I help? Gimme a thanks! Link to comment Share on other sites More sharing options...
Cookie160 Posted January 2, 2014 Author Share Posted January 2, 2014 I uploaded a better version: http://pastebin.com/xJByzQHD Quote Link to comment Share on other sites More sharing options...
drmrlego Posted January 2, 2014 Share Posted January 2, 2014 This is for 1.6.4? Then, first off... public void gameRegisters(){ GameRegistry.registerBlock(snowstormBlock);} public void LanguageRegistry(){ LanguageRegistry.addName(snowstormBlock, "Blanket"); } First, get rid of the "public void LanguageRegistry", "public void gameRegistry", "gameRegisters();", and the "languageRegisters();" but keep the "LanguageRegistry.addName(snowstormBlock, "Blanket");" and the "GameRegistry.registerBlock(snowstormBlock);" there. Second, also in your main class file, "@Init" should be "@EventHandler" And third... public BlockSnowstormBlock(int id, int texture, Material mat) { super(texture, Material.cloth); this.setCreativeTab(CreativeTabs.tabBlock); Change that to... public BlockSnowstormBlock(int id, int texture, Material mat) { super(id, texture, Material.cloth); this.setCreativeTab(CreativeTabs.tabBlock); Hope I helped Quote Did I help? Gimme a thanks! Link to comment Share on other sites More sharing options...
Cookie160 Posted January 2, 2014 Author Share Posted January 2, 2014 Thanks! That solved soooooo many problems! But when I run it it, it crashes Error: http://pastebin.com/A7iyurLx Quote Link to comment Share on other sites More sharing options...
drmrlego Posted January 2, 2014 Share Posted January 2, 2014 That is weird. I'm sorry for asking for so much, but could I see your current code? Sorry if I'm being a pain, and thanks for your patience. Quote Did I help? Gimme a thanks! Link to comment Share on other sites More sharing options...
drmrlego Posted January 2, 2014 Share Posted January 2, 2014 I figured it out(I hope)! Change this... public BlockSnowstormBlock(int id, int texture, Material mat) { super(id, texture, Material.cloth); this.setCreativeTab(CreativeTabs.tabBlock); To this! public BlockSnowstormBlock(int id, int texture, Material mat) { super(id, texture, mat); this.setCreativeTab(CreativeTabs.tabBlock); That should fix it... EDIT: Wait, you should remove the "int texture" and the "texture" inside the "super(id, texture, mat);" Should be like public BlockSnowstormBlock(int id, Material mat) { super(id, mat); this.setCreativeTab(CreativeTabs.tabBlock); You can register textures like @SideOnly(Side.CLIENT) public void registerIcons(IconRegister icon){ this.blockIcon = icon.registerIcon(YourModHere.modid + ":" + "YourBlocksTextureFileNameHere"); } Quote Did I help? Gimme a thanks! Link to comment Share on other sites More sharing options...
Cookie160 Posted January 2, 2014 Author Share Posted January 2, 2014 We're getting there! It's now calling on small mistakes! Error: http://pastebin.com/1frivVqX Updated code: http://pastebin.com/eBBhVqZK Don't worry about being "a pain" I literally have just about nothing to do this week! Quote Link to comment Share on other sites More sharing options...
drmrlego Posted January 2, 2014 Share Posted January 2, 2014 Lets see... you do have a problem here... public void registerIcons(IconRegister icon);{ Remove the ";" And if THAT doesn't work, then I think I know why. I am familiar with forge 916, which is what I use, but you are using 953. EDIT: Almost forgot, public static final String modid = "Snowstorm"; Put that in your main mod file. Also in your main mod file, Block snowstormBlock; Should be public static Block snowstormBlock; But once again, we are using different forge versions, so I am unsure Quote Did I help? Gimme a thanks! Link to comment Share on other sites More sharing options...
Cookie160 Posted January 2, 2014 Author Share Posted January 2, 2014 Thank you so much! If all else fails, I'll get that version of forge. Quote Link to comment Share on other sites More sharing options...
Cookie160 Posted January 3, 2014 Author Share Posted January 3, 2014 So, after applying your suggestions, I fooled around with the code, and got it down to one problem. Error: Caused by: java.lang.Error: Unresolved compilation problems: 2014-01-03 11:06:22 [iNFO] [sTDOUT] Syntax error on token "registerIcon", VariableDeclarator expected after this token 2014-01-03 11:06:22 [iNFO] [sTDOUT] registerIcon cannot be resolved to a type 2014-01-03 11:06:22 [iNFO] [sTDOUT] Illegal modifier for parameter $missing$; only final is permitted 2014-01-03 11:06:22 [iNFO] [sTDOUT] Changed Code: package snowstorm; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.util.Icon; import snowstorm.Snowstorm; import snowstorm.ClientProxySnowstorm; public class BlockSnowstormBlock<registerIcons> extends Block{ public BlockSnowstormBlock(int id, Material mat) { super(id, mat); this.setCreativeTab(CreativeTabs.tabBlock); public registerIcon;IconRegister icon;{ this.blockIcon = icon.registerIcon("Snowstorm:blanket"); } } } Thanks! Quote Link to comment Share on other sites More sharing options...
luisc99 Posted January 3, 2014 Share Posted January 3, 2014 public registerIcon;IconRegister icon;{ this.blockIcon = icon.registerIcon("Snowstorm:blanket"); @Override public void registerIcons(IconRegister icon) { this.blockIcon = icon.registerIcon("snowstorm:blanket"); } Should have come up with an error in eclipse... Quote Link to comment Share on other sites More sharing options...
Cookie160 Posted January 3, 2014 Author Share Posted January 3, 2014 public registerIcon;IconRegister icon;{ this.blockIcon = icon.registerIcon("Snowstorm:blanket"); Should have come up with an error in eclipse... It did. It still didn't work Quote Link to comment Share on other sites More sharing options...
CJLetsGame Posted January 3, 2014 Share Posted January 3, 2014 same error or different? Quote Link to comment Share on other sites More sharing options...
Cookie160 Posted January 3, 2014 Author Share Posted January 3, 2014 same error Quote Link to comment Share on other sites More sharing options...
CJLetsGame Posted January 3, 2014 Share Posted January 3, 2014 The following should work public class BlockSnowstormBlock extends Block{ public BlockSnowstormBlock(int id, Material mat) { super(id, mat); this.setCreativeTab(CreativeTabs.tabBlock); } public registerIcon (IconRegister icon){ this.blockIcon = icon.registerIcon("Snowstorm:blanket"); } } Quote Link to comment Share on other sites More sharing options...
Cookie160 Posted January 4, 2014 Author Share Posted January 4, 2014 Well, it doesn't crash, but I can't find my block... Quote Link to comment Share on other sites More sharing options...
CJLetsGame Posted January 4, 2014 Share Posted January 4, 2014 Change your registers to: GameRegistry.registerBlock(snowstormBlock, "snowstormBlock"); LanguageRegistry.addName(snowstormBlock, "Blanket"); You should also give the block a unlocalized name public BlockSnowstormBlock(int id, Material mat) { super(id, mat); this.setCreativeTab(CreativeTabs.tabBlock); this.setUnlocalizedName("snowtormBlock"); } Quote Link to comment Share on other sites More sharing options...
drmrlego Posted January 4, 2014 Share Posted January 4, 2014 Change your registers to: GameRegistry.registerBlock(snowstormBlock, "snowstormBlock"); LanguageRegistry.addName(snowstormBlock, "Blanket"); You should also give the block a unlocalized name public BlockSnowstormBlock(int id, Material mat) { super(id, mat); this.setCreativeTab(CreativeTabs.tabBlock); this.setUnlocalizedName("snowtormBlock"); } Yeah, that should work... But if it doesn't, then idk the problem. Quote Did I help? Gimme a thanks! Link to comment Share on other sites More sharing options...
Cookie160 Posted January 5, 2014 Author Share Posted January 5, 2014 Change your registers to: GameRegistry.registerBlock(snowstormBlock, "snowstormBlock"); LanguageRegistry.addName(snowstormBlock, "Blanket"); You should also give the block a unlocalized name public BlockSnowstormBlock(int id, Material mat) { super(id, mat); this.setCreativeTab(CreativeTabs.tabBlock); this.setUnlocalizedName("snowtormBlock"); } Haha!!! It works!!! One last thing, though, is that it doesn't show up in the creative menu, I have to use /give Player*** 500. Thank you sooooooooo much for all of everyone's support! Current code: package snowstorm; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.util.Icon; import snowstorm.Snowstorm; import snowstorm.ClientProxySnowstorm; @BlockSnowstormBlock({id, Material, { this,(id. mat) this.setCreativeTab(CreativeTabs.tabBlock) this.setUnlocalizedName("blanket") public class BlockSnowstormBlock (IconRegister) thisblockIcon =icon.registerIcon("Snowstorm:blanket") Quote Link to comment Share on other sites More sharing options...
Cookie160 Posted January 5, 2014 Author Share Posted January 5, 2014 Never mind, I figured it out!!! It works!!! Thank you sooooo much to everyone, for every post helped me out. I cannot stress how important this is to me! This probably won't be the last you hear of me (hopefully in a good way!). Thank you!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.