Jump to content

UN-TEXTURED UN-NAMED BLOCK. SIMPLE QUESTION?


Cookie160

Recommended Posts

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 :P

Thank you

Link to comment
Share on other sites

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.

 

Did I help? Gimme a thanks!

Link to comment
Share on other sites

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

Did I help? Gimme a thanks!

Link to comment
Share on other sites

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");
}

Did I help? Gimme a thanks!

Link to comment
Share on other sites

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

 

Did I help? Gimme a thanks!

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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");
        }
}

Link to comment
Share on other sites

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");
       }

Link to comment
Share on other sites

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.

Did I help? Gimme a thanks!

Link to comment
Share on other sites

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")
            

 

 

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Baba  Serege [[+27-73 590 8989]] has experience of 27 years in helping and guiding many people from all over the world. His psychic abilities may help you answer and resolve many unanswered questions. He specialize in helping women and men from all walks of life.. 1) – Bring back lost lover. even if lost for a long time. 2) – My lover is abusing alcohol, partying and cheating on me I urgently need help” 3) – Divorce or court issues. 4) – Is your love falling apart? 5) – Do you want your love to grow stronger? 6) – Is your partner losing interest in you? 7) – Do you want to catch your partner cheating on you? – We help to keep your partner faithful and loyal to you. 9) – We recover love and happiness when relationship breaks down. 10) – Making your partner loves you alone. 11) – We create loyalty and everlasting love between couples. 12) – Get a divorce settlement quickly from your ex-partner. 13) – We create everlasting love between couples. 14) – We help you look for the best suitable partner. 15) – We bring back lost lover even if lost for a long time. 16) – We strengthen bonds in all love relationship and marriages 17) – Are you an herbalist who wants to get more powers? 18) – Buy a house or car of your dream. 19) – Unfinished jobs by other doctors come to me. 20) – I help those seeking employment. 21) – Pensioners free treatment. 22) – Win business tenders and contracts. 23) – Do you need to recover your lost property? 24) – Promotion at work and better pay. 25) – Do you want to be protected from bad spirits and nightmares? 26) – Financial problems. 27) – Why you can’t keep money or lovers? 28) – Why you have a lot of enemies? 29) – Why you are fired regularly on jobs? 30) – Speed up money claim spell, delayed payments, pension and accident funds 31) – I help students pass their exams/interviews. 33) – Removal of bad luck and debts. 34) – Are struggling to sleep because of a spiritual wife or husband. 35- ) Recover stolen property
    • OLXTOTO adalah situs bandar togel online resmi terbesar dan terpercaya di Indonesia. Bergabunglah dengan OLXTOTO dan nikmati pengalaman bermain togel yang aman dan terjamin. Koleksi toto 4D dan togel toto terlengkap di OLXTOTO membuat para member memiliki pilihan taruhan yang lebih banyak. Sebagai situs togel terpercaya, OLXTOTO menjaga keamanan dan kenyamanan para membernya dengan sistem keamanan terbaik dan enkripsi data. Transaksi yang cepat, aman, dan terpercaya merupakan jaminan dari OLXTOTO. Nikmati layanan situs toto terbaik dari OLXTOTO dengan tampilan yang user-friendly dan mudah digunakan. Layanan pelanggan tersedia 24/7 untuk membantu para member. Bergabunglah dengan OLXTOTO sekarang untuk merasakan pengalaman bermain togel yang menyenangkan dan menguntungkan.
    • Baba  Serege [[+27-73 590 8989]] has experience of 27 years in helping and guiding many people from all over the world. His psychic abilities may help you answer and resolve many unanswered questions. He specialize in helping women and men from all walks of life.. 1) – Bring back lost lover. even if lost for a long time. 2) – My lover is abusing alcohol, partying and cheating on me I urgently need help” 3) – Divorce or court issues. 4) – Is your love falling apart? 5) – Do you want your love to grow stronger? 6) – Is your partner losing interest in you? 7) – Do you want to catch your partner cheating on you? – We help to keep your partner faithful and loyal to you. 9) – We recover love and happiness when relationship breaks down. 10) – Making your partner loves you alone. 11) – We create loyalty and everlasting love between couples. 12) – Get a divorce settlement quickly from your ex-partner. 13) – We create everlasting love between couples. 14) – We help you look for the best suitable partner. 15) – We bring back lost lover even if lost for a long time. 16) – We strengthen bonds in all love relationship and marriages 17) – Are you an herbalist who wants to get more powers? 18) – Buy a house or car of your dream. 19) – Unfinished jobs by other doctors come to me. 20) – I help those seeking employment. 21) – Pensioners free treatment. 22) – Win business tenders and contracts. 23) – Do you need to recover your lost property? 24) – Promotion at work and better pay. 25) – Do you want to be protected from bad spirits and nightmares? 26) – Financial problems. 27) – Why you can’t keep money or lovers? 28) – Why you have a lot of enemies? 29) – Why you are fired regularly on jobs? 30) – Speed up money claim spell, delayed payments, pension and accident funds 31) – I help students pass their exams/interviews. 33) – Removal of bad luck and debts. 34) – Are struggling to sleep because of a spiritual wife or husband. 35- ) Recover stolen property
    • BD303 merupakan salah satu situs slot mudah scatter paling populer dan digemari oleh kalangan slot online di tahun 2024 mainkan sekarang dengan kesempatan yang mudah menang jackpot jutaan rupiah.
  • Topics

×
×
  • Create New...

Important Information

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