Jump to content

StoneWall


Ischta

Recommended Posts

package net.my.compilation;

import net.minecraft.block.BlockWall;
import net.minecraft.creativetab.CreativeTabs;

public class StoneWall extends BlockWall {

public StoneWall(Block p_i45435_1_) {
	super(p_i45435_1_);
}

@Override
public boolean isOpaqueCube() {
	return false;
}

}

 

and

 

sandstonewall = (StoneWall) new StoneWall().setBlockName("sandstonewall").setCreativeTab(tabNewBlocks).setResistance(5.0F);

 

 

Question ... what means "p_i45435_1_" and what must passt to BlockWall class ??

 

i will try to get a new wall block to set with new textures like sandstone or something else ...

Link to comment
Share on other sites

every time i got a "java.lang.NullPointerException" -.-

 

i would like to create only a new wallblock with sandstone texture ... and if its possible with one classs to set diffrenet blocks with different textures ... the multi-texture blocks are very simple ... but the stonewall is horrible

 

 

Link to comment
Share on other sites

package net.kaldarin.compilation;

import java.util.List;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockWall;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;

public class StoneWall extends BlockWall {

public StoneWall(Block block) {
	super(Blocks.sandstone);
}


@SideOnly(Side.CLIENT)
    public IIcon getIcon(int p_149691_1_, int p_149691_2_)
    {
        return Blocks.sandstone.getBlockTextureFromSide(p_149691_1_);
    }

 @SideOnly(Side.CLIENT)
    public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List p_149666_3_)
    {
        p_149666_3_.add(new ItemStack(p_149666_1_, 1, 0));
    }
}

 

ok, it works, but not so i'd like it. I had delete the subID from stonewall and set the sandstone. So fare so good.

 

but how can i make a multiclass for different wall block textures. I know i must use for "Blocks.sandstone" a placeholder variable to manage different textures ... but how ? ... 

Link to comment
Share on other sites

package net.kaldarin.compilation;

import java.util.List;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockWall;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;

public class StoneWall extends BlockWall {

public StoneWall(Block block) {
	super(Blocks.sandstone);
}


@SideOnly(Side.CLIENT)
    public IIcon getIcon(int p_149691_1_, int p_149691_2_)
    {
        return Blocks.sandstone.getBlockTextureFromSide(p_149691_1_);
    }

 @SideOnly(Side.CLIENT)
    public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List p_149666_3_)
    {
        p_149666_3_.add(new ItemStack(p_149666_1_, 1, 0));
    }
}

 

ok, it works, but not so i'd like it. I had delete the subID from stonewall and set the sandstone. So fare so good.

 

but how can i make a multiclass for different wall block textures. I know i must use for "Blocks.sandstone" a placeholder variable to manage different textures ... but how ? ...

 

This is pretty simple, as it's pretty basic java, and I sincerely hope you won't just copy and paste this code:

package keeperofmee.drugmod.blocks;

import java.util.List;

import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockWall;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;


public class BlockCustomWall extends BlockWall
{
/**
 * This variable is what we use to get the texture from the local variable specified in the constructor
 * **/
private Block textureBlock;

/**
 * The Blocks constructor
 * **/
public BlockCustomWall(Block block, String name, CreativeTabs tab) {
	super(block);
	/**
	 * Tells minecraft that the variable "textureBlock" is the same as the local variable "block"
	 * **/
	textureBlock = block;
	/**
	 * Automatically registers our block with the name in the String name
	 * **/
	GameRegistry.registerBlock(this, name);
	/**
	 * Sets the Blockname to the "name" variable
	 * **/
	this.setBlockName(name);
	/**
	 * Sets the creative tab to the creative tab we specify when we define the block
	 * **/
	this.setCreativeTab(tab);
}

/**
 * This takes the texture from the block specified in the variable "textureBlock"
 * **/
    @SideOnly(Side.CLIENT)
    public IIcon getIcon(int side, int meta)
    {
        return textureBlock.getBlockTextureFromSide(side);
    }
    
    /**
     * This simply overrides the code with that in vanilla
     * **/
    @SideOnly(Side.CLIENT)
    public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List p_149666_3_)
    {
        p_149666_3_.add(new ItemStack(p_149666_1_, 1, 0));
    }

}

and then to make a new block simply do:

		m.sandStoneWall = new BlockCustomWall(Blocks.sandstone, "sandStoneWall", m.drugTab);
	m.furnaceWall = new BlockCustomWall(Blocks.furnace, "furnaceWall", m.drugTab);
	m.dirtWall = new BlockCustomWall(Blocks.dirt, "dirtWall", m.drugTab);

That's 3 wall blocks, in 3 lines with the correct properties, simple isn't it!

If I helped please press the Thank You button.

Link to comment
Share on other sites

Thanks for hint :)

 

in last step i had to replace "getBlockTextureFromSide(side)" with "getIcon(side,meta)" and now i can catch textures form metablocks and all works fine ...

 

 

greetings

 

 

 

/closed

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



×
×
  • Create New...

Important Information

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