Jump to content

Recommended Posts

Posted

Hi everybody! Here's is my question: i want to provide a power from a slab only if its metadata is 2 or 3. I have 8 half slabs wich have the same id but different metadata and i want that if this metadata value is 2 or 3 than the slab can provide power, else it can't...

I don't know how to do this beacuse in the "canProvidePower" method i don't know how to get the block metadata...

Here are the BlockOreSlab file and the (modded) BlockHalfSlab file

 

BlockOreSlab

package mod.mineworld.blocks.mod_ores;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

import java.util.List;
import java.util.Random;

import mod.mineworld.mod_ores;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.Facing;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

public abstract class BlockOreSlab extends Block
{
    protected final boolean field_150004_a;
    private static final String __OBFID = "CL_00000253";
    private static boolean power = false;
    private static int power_level;
    private static int metadata;

    public BlockOreSlab(boolean p_i45410_1_, Material p_i45410_2_)
    {
        super(p_i45410_2_);
        this.field_150004_a = p_i45410_1_;

        if (p_i45410_1_)
        {
            this.opaque = true;
        }
        else
        {
            this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
        }

        this.setLightOpacity(0);
    }

    /**
     * Updates the blocks bounds based on its current state. Args: world, x, y, z
     */
    public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_)
    {
        if (this.field_150004_a)
        {
            this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
        }
        else
        {
            boolean flag = (p_149719_1_.getBlockMetadata(p_149719_2_, p_149719_3_, p_149719_4_) &  != 0;

            if (flag)
            {
                this.setBlockBounds(0.0F, 0.5F, 0.0F, 1.0F, 1.0F, 1.0F);
            }
            else
            {
                this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
            }
        }
    }

    /**
     * Sets the block's bounds for rendering it as an item
     */
    public void setBlockBoundsForItemRender()
    {
        if (this.field_150004_a)
        {
            this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
        }
        else
        {
            this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
        }
    }

    /**
     * Adds all intersecting collision boxes to a list. (Be sure to only add boxes to the list if they intersect the
     * mask.) Parameters: World, X, Y, Z, mask, list, colliding entity
     */
    public void addCollisionBoxesToList(World p_149743_1_, int p_149743_2_, int p_149743_3_, int p_149743_4_, AxisAlignedBB p_149743_5_, List p_149743_6_, Entity p_149743_7_)
    {
        this.setBlockBoundsBasedOnState(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_);
        super.addCollisionBoxesToList(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_, p_149743_5_, p_149743_6_, p_149743_7_);
    }

    /**
     * Is this block (a) opaque and (b) a full 1m cube?  This determines whether or not to render the shared face of two
     * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
     */
    public boolean isOpaqueCube()
    {
        return this.field_150004_a;
    }

    /**
     * Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY, hitZ, block metadata
     */
    public int onBlockPlaced(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_)
    {
        metadata = p_149660_9_;
    	return this.field_150004_a ? p_149660_9_ : (p_149660_5_ != 0 && (p_149660_5_ == 1 || (double)p_149660_7_ <= 0.5D) ? p_149660_9_ : p_149660_9_ | ;
    }

    /**
     * Returns the quantity of items to drop on block destruction.
     */
    public int quantityDropped(Random p_149745_1_)
    {
        return this.field_150004_a ? 2 : 1;
    }

    /**
     * Determines the damage on the item the block drops. Used in cloth and wood.
     */
    public int damageDropped(int p_149692_1_)
    {
        return p_149692_1_ & 7;
    }

    /**
     * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
     */
    public boolean renderAsNormalBlock()
    {
        return this.field_150004_a;
    }

    /**
     * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given
     * coordinates.  Args: blockAccess, x, y, z, side
     */
    @SideOnly(Side.CLIENT)
    public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_)
    {
        if (this.field_150004_a)
        {
            return super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
        }
        else if (p_149646_5_ != 1 && p_149646_5_ != 0 && !super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_))
        {
            return false;
        }
        else
        {
            int i1 = p_149646_2_ + Facing.offsetsXForSide[Facing.oppositeSide[p_149646_5_]];
            int j1 = p_149646_3_ + Facing.offsetsYForSide[Facing.oppositeSide[p_149646_5_]];
            int k1 = p_149646_4_ + Facing.offsetsZForSide[Facing.oppositeSide[p_149646_5_]];
            boolean flag = (p_149646_1_.getBlockMetadata(i1, j1, k1) &  != 0;
            return flag ? (p_149646_5_ == 0 ? true : (p_149646_5_ == 1 && super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_) ? true : !func_150003_a(p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_)) || (p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_, p_149646_4_) &  == 0)) : (p_149646_5_ == 1 ? true : (p_149646_5_ == 0 && super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_) ? true : !func_150003_a(p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_)) || (p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_, p_149646_4_) &  != 0));
        }
    }

    @SideOnly(Side.CLIENT)
    private static boolean func_150003_a(Block p_150003_0_)
    {
        return p_150003_0_ == mod_ores.ore_single_slab;
    }

    public abstract String func_150002_b(int var1);

    /**
     * Get the block's damage value (for use with pick block).
     */
    public int getDamageValue(World p_149643_1_, int p_149643_2_, int p_149643_3_, int p_149643_4_)
    {
    	
    	return super.getDamageValue(p_149643_1_, p_149643_2_, p_149643_3_, p_149643_4_) & 7;
    }

    /**
     * Gets an item for the block being called on. Args: world, x, y, z
     */
    @SideOnly(Side.CLIENT)
    public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_)
    {
    	return Item.getItemFromBlock(mod_ores.ore_single_slab);
    }
    
    /**
     * Can this block provide power. Only wire currently seems to have this change based on its state.
     */
    public boolean canProvidePower()
    {        
    	//this.func_150002_b(metadata) gets the full slab name (see BlockHalfSlab)
    	if(this.func_150002_b(metadata).equals("tile.oreSingleSlab.copper"))
        	{
    		power = true;
        	power_level = 10;
        	return power;}
        else if (this.func_150002_b(metadata).equals("tile.oreSingleSlab.bronze"))
    	{power = true;
    	power_level = 5;
    	return power;}
        else {power = false;
        power_level = 0;
        return power;
        }
        
    }
/**
     * Returns true if the block is emitting indirect/weak redstone power on the specified side. If isBlockNormalCube
     * returns true, standard redstone propagation rules will apply instead and this will not be called. Args: World, X,
     * Y, Z, side. Note that the side is reversed - eg it is 1 (up) when checking the bottom of the block.
     */

    @Override
    public int isProvidingWeakPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
    {
    	return power_level;
    }
}

 

BlockHalfSlab

package mod.mineworld.blocks.mod_ores;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

import java.util.List;
import java.util.Random;

import mod.mineworld.MineWorld;
import mod.mineworld.mod_ores;
import mod.mineworld.mod_tabs;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
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.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

public class BlockHalfSlab extends BlockOreSlab
{
    public static final String[] field_150006_b = new String[] {"ruby", "sapphire", "copper", "bronze", "silver", "aluminium", "whiteMarble", "pinkMarble"};
    @SideOnly(Side.CLIENT)
    private IIcon field_150007_M;
    private static final String __OBFID = "CL_00000320";
    private int power;

    public BlockHalfSlab(boolean p_i45431_1_)
    {
        super(p_i45431_1_, Material.rock);
        this.setCreativeTab(mod_tabs.tabOreBlock);
    }

    /**
     * Gets the block's texture. Args: side, meta
     */
    @SideOnly(Side.CLIENT)
    public IIcon getIcon(int p_149691_1_, int p_149691_2_)
    {
        int k = p_149691_2_ & 7;

        if (this.field_150004_a && (p_149691_2_ &  != 0)
        {
            p_149691_1_ = 1;
        }

        return k == 0 ? (p_149691_1_ != 1 && p_149691_1_ != 0 ? mod_ores.block_ruby.getBlockTextureFromSide(p_149691_1_) : mod_ores.block_ruby.getBlockTextureFromSide(p_149691_1_)) : (k == 1 ? mod_ores.block_sapphire.getBlockTextureFromSide(p_149691_1_) : (k == 2 ? mod_ores.block_copper.getBlockTextureFromSide(p_149691_1_) : (k == 3 ? mod_ores.block_bronze.getBlockTextureFromSide(p_149691_1_) : (k == 4 ? mod_ores.block_silver.getBlockTextureFromSide(p_149691_1_) : (k == 5 ? mod_ores.block_aluminium.getIcon(p_149691_1_, 0) : (k == 6 ? mod_ores.ore_marble.getBlockTextureFromSide(1) :  this.blockIcon))))));
    }

    @SideOnly(Side.CLIENT)
    public void registerBlockIcons(IIconRegister p_149651_1_)
    {
        this.blockIcon = p_149651_1_.registerIcon(MineWorld.MODID + ":mod_ores/" + "oreMarble_pink");
        this.field_150007_M = p_149651_1_.registerIcon(MineWorld.MODID + ":mod_ores/" + "oreMarble_pink");
    }

    public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
    {
        return Item.getItemFromBlock(mod_ores.ore_single_slab);
    }

    /**
     * Returns an item stack containing a single instance of the current block type. 'i' is the block's subtype/damage
     * and is ignored for blocks which do not support subtypes. Blocks which cannot be harvested should return null.
     */
    protected ItemStack createStackedBlock(int p_149644_1_)
    {
        return new ItemStack(Item.getItemFromBlock(mod_ores.ore_single_slab), 2, p_149644_1_ & 7);
    }

    public String func_150002_b(int p_150002_1_)
    {
        if (p_150002_1_ < 0 || p_150002_1_ >= field_150006_b.length)
        {
            p_150002_1_ = 0;
        }

        return super.getUnlocalizedName() + "." + field_150006_b[p_150002_1_];
    }

    /**
     * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
     */
    @SideOnly(Side.CLIENT)
    public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List p_149666_3_)
    {
        if (p_149666_1_ != Item.getItemFromBlock(mod_ores.ore_double_slab))
        {
            for (int i = 0; i <= 7; ++i)
            {
                    p_149666_3_.add(new ItemStack(p_149666_1_, 1, i));
                
            }
        }
    }
    
    
}

 

Actually it works but if i place another block that is "power-allowed" it gives power to blocks who is not allowed too :/

 

Here is a video to better explain what i'm saying

https://www.youtube.com/watch?v=KZWkWKck-FI&feature=youtu.be

 

Thanks in advice for all who will help me :D

Don't blame me if i always ask for your help. I just want to learn to be better :)

Posted

Here is the "new" code:

 

BlockOreSlab:

package mod.mineworld.blocks.mod_ores;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

import java.util.List;
import java.util.Random;

import mod.mineworld.mod_ores;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.Facing;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

public abstract class BlockOreSlab extends Block
{
    protected final boolean isDoubleSlab;
    private static final String __OBFID = "CL_00000253";
    private static boolean power = false;
    private static int power_level;
    private static int metadata;

    public BlockOreSlab(boolean par1, Material par2)
    {
        super(par2);
        this.isDoubleSlab = par1;

        if (par1)
        {
            this.opaque = true;
        }
        else
        {
            this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
        }

        this.setLightOpacity(0);
    }

    /**
     * Updates the blocks bounds based on its current state. Args: world, x, y, z
     */
    public void setBlockBoundsBasedOnState(IBlockAccess par1, int par2, int par3, int par4)
    {
        if (this.isDoubleSlab)
        {
            this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
        }
        else
        {
            boolean flag = (par1.getBlockMetadata(par2, par3, par4) &  != 0;

            if (flag)
            {
                this.setBlockBounds(0.0F, 0.5F, 0.0F, 1.0F, 1.0F, 1.0F);
            }
            else
            {
                this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
            }
        }
    }

    /**
     * Sets the block's bounds for rendering it as an item
     */
    public void setBlockBoundsForItemRender()
    {
        if (this.isDoubleSlab)
        {
            this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
        }
        else
        {
            this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
        }
    }

    /**
     * Adds all intersecting collision boxes to a list. (Be sure to only add boxes to the list if they intersect the
     * mask.) Parameters: World, X, Y, Z, mask, list, colliding entity
     */
    public void addCollisionBoxesToList(World par1, int par2, int par3, int par4, AxisAlignedBB par5, List par6, Entity par7)
    {
        this.setBlockBoundsBasedOnState(par1, par2, par3, par4);
        super.addCollisionBoxesToList(par1, par2, par3, par4, par5, par6, par7);
    }

    /**
     * Is this block (a) opaque and (b) a full 1m cube?  This determines whether or not to render the shared face of two
     * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
     */
    public boolean isOpaqueCube()
    {
        return this.isDoubleSlab;
    }

    /**
     * Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY, hitZ, block metadata
     */
    public int onBlockPlaced(World par1, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9)
    {
        metadata = par9;
    	return this.isDoubleSlab ? par9 : (par5 != 0 && (par5 == 1 || (double)par7 <= 0.5D) ? par9 : par9 | ;
    }

    /**
     * Returns the quantity of items to drop on block destruction.
     */
    public int quantityDropped(Random par1)
    {
        return this.isDoubleSlab ? 2 : 1;
    }

    /**
     * Determines the damage on the item the block drops. Used in cloth and wood.
     */
    public int damageDropped(int par1)
    {
        return par1 & 7;
    }

    /**
     * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
     */
    public boolean renderAsNormalBlock()
    {
        return this.isDoubleSlab;
    }

    /**
     * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given
     * coordinates.  Args: blockAccess, x, y, z, side
     */
    @SideOnly(Side.CLIENT)
    public boolean shouldSideBeRendered(IBlockAccess par1, int par2, int par3, int par4, int par5)
    {
        if (this.isDoubleSlab)
        {
            return super.shouldSideBeRendered(par1, par2, par3, par4, par5);
        }
        else if (par5 != 1 && par5 != 0 && !super.shouldSideBeRendered(par1, par2, par3, par4, par5))
        {
            return false;
        }
        else
        {
            int i1 = par2 + Facing.offsetsXForSide[Facing.oppositeSide[par5]];
            int j1 = par3 + Facing.offsetsYForSide[Facing.oppositeSide[par5]];
            int k1 = par4 + Facing.offsetsZForSide[Facing.oppositeSide[par5]];
            boolean flag = (par1.getBlockMetadata(i1, j1, k1) &  != 0;
            return flag ? (par5 == 0 ? true : (par5 == 1 && super.shouldSideBeRendered(par1, par2, par3, par4, par5) ? true : !isBlockSingleSlab(par1.getBlock(par2, par3, par4)) || (par1.getBlockMetadata(par2, par3, par4) &  == 0)) : (par5 == 1 ? true : (par5 == 0 && super.shouldSideBeRendered(par1, par2, par3, par4, par5) ? true : !isBlockSingleSlab(par1.getBlock(par2, par3, par4)) || (par1.getBlockMetadata(par2, par3, par4) &  != 0));
        }
    }

    @SideOnly(Side.CLIENT)
    private static boolean isBlockSingleSlab(Block par1)
    {
        return par1 == mod_ores.ore_single_slab;
    }

    public abstract String getFullSlabName(int var1);

    /**
     * Get the block's damage value (for use with pick block).
     */
    public int getDamageValue(World par1, int par2, int par3, int par4)
    {
    	
    	return super.getDamageValue(par1, par2, par3, par4) & 7;
    }

    /**
     * Gets an item for the block being called on. Args: world, x, y, z
     */
    @SideOnly(Side.CLIENT)
    public Item getItem(World par1, int par2, int par3, int par4)
    {
    	return Item.getItemFromBlock(mod_ores.ore_single_slab);
    }
    
    /**
     * Can this block provide power. Only wire currently seems to have this change based on its state.
     */
    public boolean canProvidePower()
    {        
    	//this.func_150002_b(metadata) gets the full slab name (see BlockHalfSlab)
    	if(this.getFullSlabName(metadata).equals("tile.oreSingleSlab.copper"))
        	{
    		power = true;
        	power_level = 10;
        	return power;}
        else if (this.getFullSlabName(metadata).equals("tile.oreSingleSlab.bronze"))
    	{power = true;
    	power_level = 5;
    	return power;}
        else {power = false;
        power_level = 0;
        return power;
        }
        
    }
/**
     * Returns true if the block is emitting indirect/weak redstone power on the specified side. If isBlockNormalCube
     * returns true, standard redstone propagation rules will apply instead and this will not be called. Args: World, X,
     * Y, Z, side. Note that the side is reversed - eg it is 1 (up) when checking the bottom of the block.
     */

    @Override
    public int isProvidingWeakPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
    {
    	return power_level;
    }
}

 

BlockHalfSlab:

package mod.mineworld.blocks.mod_ores;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

import java.util.List;
import java.util.Random;

import mod.mineworld.MineWorld;
import mod.mineworld.mod_ores;
import mod.mineworld.mod_tabs;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
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.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

public class BlockHalfSlab extends BlockOreSlab
{
    public static final String[] slab_names = new String[] {"ruby", "sapphire", "copper", "bronze", "silver", "aluminium", "whiteMarble", "pinkMarble"};
    @SideOnly(Side.CLIENT)
    private IIcon icon;
    private static final String __OBFID = "CL_00000320";
    private int power;

    public BlockHalfSlab(boolean par1)
    {
        super(par1, Material.rock);
        this.setCreativeTab(mod_tabs.tabOreBlock);
    }

    /**
     * Gets the block's texture. Args: side, meta
     */
    @SideOnly(Side.CLIENT)
    public IIcon getIcon(int par1, int par2)
    {
        int k = par2 & 7;

        if (this.isDoubleSlab && (par2 &  != 0)
        {
            par1 = 1;
        }

        return k == 0 ? (par1 != 1 && par1 != 0 ? mod_ores.block_ruby.getBlockTextureFromSide(par1) : mod_ores.block_ruby.getBlockTextureFromSide(par1)) : (k == 1 ? mod_ores.block_sapphire.getBlockTextureFromSide(par1) : (k == 2 ? mod_ores.block_copper.getBlockTextureFromSide(par1) : (k == 3 ? mod_ores.block_bronze.getBlockTextureFromSide(par1) : (k == 4 ? mod_ores.block_silver.getBlockTextureFromSide(par1) : (k == 5 ? mod_ores.block_aluminium.getIcon(par1, 0) : (k == 6 ? mod_ores.ore_marble.getBlockTextureFromSide(1) :  this.blockIcon))))));
    }

    @SideOnly(Side.CLIENT)
    public void registerBlockIcons(IIconRegister par1)
    {
        this.blockIcon = par1.registerIcon(MineWorld.MODID + ":mod_ores/" + "oreMarble_pink");
        this.icon = par1.registerIcon(MineWorld.MODID + ":mod_ores/" + "oreMarble_pink");
    }

    public Item getItemDropped(int par1, Random par2, int par3)
    {
        return Item.getItemFromBlock(mod_ores.ore_single_slab);
    }

    /**
     * Returns an item stack containing a single instance of the current block type. 'i' is the block's subtype/damage
     * and is ignored for blocks which do not support subtypes. Blocks which cannot be harvested should return null.
     */
    protected ItemStack createStackedBlock(int par1)
    {
        return new ItemStack(Item.getItemFromBlock(mod_ores.ore_single_slab), 2, par1 & 7);
    }

    public String getFullSlabName(int par1)
    {
        if (par1 < 0 || par1 >= slab_names.length)
        {
            par1 = 0;
        }

        return super.getUnlocalizedName() + "." + slab_names[par1];
    }

    /**
     * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
     */
    @SideOnly(Side.CLIENT)
    public void getSubBlocks(Item par1, CreativeTabs par2, List par3)
    {
        if (par1 != Item.getItemFromBlock(mod_ores.ore_double_slab))
        {
            for (int i = 0; i <= 7; ++i)
            {
                    par3.add(new ItemStack(par1, 1, i));
                
            }
        }
    }
    
    
}

 

And the ItemOreSlab file (sorry i was forget it :/)

package mod.mineworld.blocks.mod_ores;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import mod.mineworld.mod_ores;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSlab;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

public class ItemOreSlab extends ItemBlock
{
    private final boolean isDoubleSlab;
    private final BlockOreSlab single_slab;
    private final BlockOreSlab double_slab;
    private static final String __OBFID = "CL_00000071";

    public ItemOreSlab(Block block)
    {
    	super(block);
    	this.single_slab = mod_ores.ore_single_slab;
    	this.double_slab = mod_ores.ore_double_slab;
    	this.isDoubleSlab = false;
    	this.setHasSubtypes(true);
    	
    }

    /**
     * Gets an icon index based on an item's damage value
     */
    @SideOnly(Side.CLIENT)
    public IIcon getIconFromDamage(int par1)
    {
        return Block.getBlockFromItem(this).getIcon(1, par1);
    }

    /**
     * Returns the metadata of the block which this Item (ItemBlock) can place
     */
    public int getMetadata(int par1)
    {
        return par1;
    }

    /**
     * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have
     * different names based on their damage or NBT.
     */
    public String getUnlocalizedName(ItemStack par1ItemStack)
    {
        return this.single_slab.getFullSlabName(par1ItemStack.getItemDamage());
    }

    /**
     * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
     * True if something happen and false if it don't. This is for ITEMS, not BLOCKS
     */
    public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
    {
        if (this.isDoubleSlab)
        {
            return super.onItemUse(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10);
        }
        else if (par1ItemStack.stackSize == 0)
        {
            return false;
        }
        else if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack))
        {
            return false;
        }
        else
        {
            Block block = par3World.getBlock(par4, par5, par6);
            int i1 = par3World.getBlockMetadata(par4, par5, par6);
            int j1 = i1 & 7;
            boolean flag = (i1 &  != 0;

            if ((par7 == 1 && !flag || par7 == 0 && flag) && block == this.single_slab && j1 == par1ItemStack.getItemDamage())
            {
                if (par3World.checkNoEntityCollision(this.double_slab.getCollisionBoundingBoxFromPool(par3World, par4, par5, par6)) && par3World.setBlock(par4, par5, par6, this.double_slab, j1, 3))
                {
                    par3World.playSoundEffect((double)((float)par4 + 0.5F), (double)((float)par5 + 0.5F), (double)((float)par6 + 0.5F), this.double_slab.stepSound.func_150496_b(), (this.double_slab.stepSound.getVolume() + 1.0F) / 2.0F, this.double_slab.stepSound.getPitch() * 0.8F);
                    --par1ItemStack.stackSize;
                }

                return true;
            }
            else
            {
                return this.func_150946_a(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7) ? true : super.onItemUse(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10);
            }
        }
    }

    @SideOnly(Side.CLIENT)
    public boolean func_150936_a(World par1, int par2, int par3, int par4, int par5, EntityPlayer par6, ItemStack par7)
    {
        int i1 = par2;
        int j1 = par3;
        int k1 = par4;
        Block block = par1.getBlock(par2, par3, par4);
        int l1 = par1.getBlockMetadata(par2, par3, par4);
        int i2 = l1 & 7;
        boolean flag = (l1 &  != 0;

        if ((par5 == 1 && !flag || par5 == 0 && flag) && block == this.single_slab && i2 == par7.getItemDamage())
        {
            return true;
        }
        else
        {
            if (par5 == 0)
            {
                --par3;
            }

            if (par5 == 1)
            {
                ++par3;
            }

            if (par5 == 2)
            {
                --par4;
            }

            if (par5 == 3)
            {
                ++par4;
            }

            if (par5 == 4)
            {
                --par2;
            }

            if (par5 == 5)
            {
                ++par2;
            }

            Block block1 = par1.getBlock(par2, par3, par4);
            int j2 = par1.getBlockMetadata(par2, par3, par4);
            i2 = j2 & 7;
            return block1 == this.single_slab && i2 == par7.getItemDamage() ? true : super.func_150936_a(par1, i1, j1, k1, par5, par6, par7);
        }
    }

    private boolean func_150946_a(ItemStack par1, EntityPlayer par2, World par3, int par4, int par5, int par6, int par7)
    {
        if (par7 == 0)
        {
            --par5;
        }

        if (par7 == 1)
        {
            ++par5;
        }

        if (par7 == 2)
        {
            --par6;
        }

        if (par7 == 3)
        {
            ++par6;
        }

        if (par7 == 4)
        {
            --par4;
        }

        if (par7 == 5)
        {
            ++par4;
        }

        Block block = par3.getBlock(par4, par5, par6);
        int i1 = par3.getBlockMetadata(par4, par5, par6);
        int j1 = i1 & 7;

        if (block == this.single_slab && j1 == par1.getItemDamage())
        {
            if (par3.checkNoEntityCollision(this.double_slab.getCollisionBoundingBoxFromPool(par3, par4, par5, par6)) && par3.setBlock(par4, par5, par6, this.double_slab, j1, 3))
            {
                par3.playSoundEffect((double)((float)par4 + 0.5F), (double)((float)par5 + 0.5F), (double)((float)par6 + 0.5F), this.double_slab.stepSound.func_150496_b(), (this.double_slab.stepSound.getVolume() + 1.0F) / 2.0F, this.double_slab.stepSound.getPitch() * 0.8F);
                --par1.stackSize;
            }

            return true;
        }
        else
        {
            return false;
        }
    }
    
}

Don't blame me if i always ask for your help. I just want to learn to be better :)

Posted

Why do people continually NOT deobf their code? It looks awful! Seriously, rename all your values to something more legible.

That's because they blindly copy-paste code. You can see that by this line: private static final String __OBFID = "CL_00000253"; as that's put in most vanilla class by forge when the code deobfuscated. If you don't remove those lines from your class, it will throw errors when building the mod.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

Ok so now i have:

 

BlockOreSlab:

package mod.mineworld.blocks.mod_ores;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

import java.util.List;
import java.util.Random;

import mod.mineworld.mod_ores;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.Facing;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

public abstract class BlockOreSlab extends Block
{
    protected final boolean isDoubleSlab;
    private static boolean power = false;
    private static int power_level;
    private static int metadata;

    public BlockOreSlab(boolean par1, Material par2)
    {
        super(par2);
        this.isDoubleSlab = par1;

        if (par1)
        {
            this.opaque = true;
        }
        else
        {
            this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
        }

        this.setLightOpacity(0);
    }

    /**
     * Updates the blocks bounds based on its current state. Args: world, x, y, z
     */
    public void setBlockBoundsBasedOnState(IBlockAccess par1, int par2, int par3, int par4)
    {
        if (this.isDoubleSlab)
        {
            this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
        }
        else
        {
            boolean flag = (par1.getBlockMetadata(par2, par3, par4) &  != 0;

            if (flag)
            {
                this.setBlockBounds(0.0F, 0.5F, 0.0F, 1.0F, 1.0F, 1.0F);
            }
            else
            {
                this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
            }
        }
    }

    /**
     * Sets the block's bounds for rendering it as an item
     */
    public void setBlockBoundsForItemRender()
    {
        if (this.isDoubleSlab)
        {
            this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
        }
        else
        {
            this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
        }
    }

    /**
     * Adds all intersecting collision boxes to a list. (Be sure to only add boxes to the list if they intersect the
     * mask.) Parameters: World, X, Y, Z, mask, list, colliding entity
     */
    public void addCollisionBoxesToList(World par1, int par2, int par3, int par4, AxisAlignedBB par5, List par6, Entity par7)
    {
        this.setBlockBoundsBasedOnState(par1, par2, par3, par4);
        super.addCollisionBoxesToList(par1, par2, par3, par4, par5, par6, par7);
    }

    /**
     * Is this block (a) opaque and (b) a full 1m cube?  This determines whether or not to render the shared face of two
     * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
     */
    public boolean isOpaqueCube()
    {
        return this.isDoubleSlab;
    }

    /**
     * Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY, hitZ, block metadata
     */
    public int onBlockPlaced(World par1, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9)
    {
        metadata = par9;
    	return this.isDoubleSlab ? par9 : (par5 != 0 && (par5 == 1 || (double)par7 <= 0.5D) ? par9 : par9 | ;
    }

    /**
     * Returns the quantity of items to drop on block destruction.
     */
    public int quantityDropped(Random par1)
    {
        return this.isDoubleSlab ? 2 : 1;
    }

    /**
     * Determines the damage on the item the block drops. Used in cloth and wood.
     */
    public int damageDropped(int par1)
    {
        return par1 & 7;
    }

    /**
     * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
     */
    public boolean renderAsNormalBlock()
    {
        return this.isDoubleSlab;
    }

    /**
     * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given
     * coordinates.  Args: blockAccess, x, y, z, side
     */
    @SideOnly(Side.CLIENT)
    public boolean shouldSideBeRendered(IBlockAccess par1, int par2, int par3, int par4, int par5)
    {
        if (this.isDoubleSlab)
        {
            return super.shouldSideBeRendered(par1, par2, par3, par4, par5);
        }
        else if (par5 != 1 && par5 != 0 && !super.shouldSideBeRendered(par1, par2, par3, par4, par5))
        {
            return false;
        }
        else
        {
            int i1 = par2 + Facing.offsetsXForSide[Facing.oppositeSide[par5]];
            int j1 = par3 + Facing.offsetsYForSide[Facing.oppositeSide[par5]];
            int k1 = par4 + Facing.offsetsZForSide[Facing.oppositeSide[par5]];
            boolean flag = (par1.getBlockMetadata(i1, j1, k1) &  != 0;
            return flag ? (par5 == 0 ? true : (par5 == 1 && super.shouldSideBeRendered(par1, par2, par3, par4, par5) ? true : !isBlockSingleSlab(par1.getBlock(par2, par3, par4)) || (par1.getBlockMetadata(par2, par3, par4) &  == 0)) : (par5 == 1 ? true : (par5 == 0 && super.shouldSideBeRendered(par1, par2, par3, par4, par5) ? true : !isBlockSingleSlab(par1.getBlock(par2, par3, par4)) || (par1.getBlockMetadata(par2, par3, par4) &  != 0));
        }
    }

    @SideOnly(Side.CLIENT)
    private static boolean isBlockSingleSlab(Block par1)
    {
        return par1 == mod_ores.ore_single_slab;
    }

    public abstract String getFullSlabName(int var1);

    /**
     * Get the block's damage value (for use with pick block).
     */
    public int getDamageValue(World par1, int par2, int par3, int par4)
    {
    	
    	return super.getDamageValue(par1, par2, par3, par4) & 7;
    }

    /**
     * Gets an item for the block being called on. Args: world, x, y, z
     */
    @SideOnly(Side.CLIENT)
    public Item getItem(World par1, int par2, int par3, int par4)
    {
    	return Item.getItemFromBlock(mod_ores.ore_single_slab);
    }
    
    /**
     * Can this block provide power. Only wire currently seems to have this change based on its state.
     */
    public boolean canProvidePower()
    {        
    	//this.func_150002_b(metadata) gets the full slab name (see BlockHalfSlab)
    	if(this.getFullSlabName(metadata).equals("tile.oreSingleSlab.copper"))
        	{
    		power = true;
        	power_level = 10;
        	return power;}
        else if (this.getFullSlabName(metadata).equals("tile.oreSingleSlab.bronze"))
    	{power = true;
    	power_level = 5;
    	return power;}
        else {power = false;
        power_level = 0;
        return power;
        }
        
    }
/**
     * Returns true if the block is emitting indirect/weak redstone power on the specified side. If isBlockNormalCube
     * returns true, standard redstone propagation rules will apply instead and this will not be called. Args: World, X,
     * Y, Z, side. Note that the side is reversed - eg it is 1 (up) when checking the bottom of the block.
     */

    @Override
    public int isProvidingWeakPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
    {
    	return power_level;
    }
}

 

BlockHalfSlab

package mod.mineworld.blocks.mod_ores;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

import java.util.List;
import java.util.Random;

import mod.mineworld.MineWorld;
import mod.mineworld.mod_ores;
import mod.mineworld.mod_tabs;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
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.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

public class BlockHalfSlab extends BlockOreSlab
{
    public static final String[] slab_names = new String[] {"ruby", "sapphire", "copper", "bronze", "silver", "aluminium", "whiteMarble", "pinkMarble"};
    @SideOnly(Side.CLIENT)
    private IIcon icon;
    private int power;

    public BlockHalfSlab(boolean par1)
    {
        super(par1, Material.rock);
        this.setCreativeTab(mod_tabs.tabOreBlock);
    }

    /**
     * Gets the block's texture. Args: side, meta
     */
    @SideOnly(Side.CLIENT)
    public IIcon getIcon(int par1, int par2)
    {
        int k = par2 & 7;

        if (this.isDoubleSlab && (par2 &  != 0)
        {
            par1 = 1;
        }

        return k == 0 ? (par1 != 1 && par1 != 0 ? mod_ores.block_ruby.getBlockTextureFromSide(par1) : mod_ores.block_ruby.getBlockTextureFromSide(par1)) : (k == 1 ? mod_ores.block_sapphire.getBlockTextureFromSide(par1) : (k == 2 ? mod_ores.block_copper.getBlockTextureFromSide(par1) : (k == 3 ? mod_ores.block_bronze.getBlockTextureFromSide(par1) : (k == 4 ? mod_ores.block_silver.getBlockTextureFromSide(par1) : (k == 5 ? mod_ores.block_aluminium.getIcon(par1, 0) : (k == 6 ? mod_ores.ore_marble.getBlockTextureFromSide(1) :  this.blockIcon))))));
    }

    @SideOnly(Side.CLIENT)
    public void registerBlockIcons(IIconRegister par1)
    {
        this.blockIcon = par1.registerIcon(MineWorld.MODID + ":mod_ores/" + "oreMarble_pink");
        this.icon = par1.registerIcon(MineWorld.MODID + ":mod_ores/" + "oreMarble_pink");
    }

    public Item getItemDropped(int par1, Random par2, int par3)
    {
        return Item.getItemFromBlock(mod_ores.ore_single_slab);
    }

    /**
     * Returns an item stack containing a single instance of the current block type. 'i' is the block's subtype/damage
     * and is ignored for blocks which do not support subtypes. Blocks which cannot be harvested should return null.
     */
    protected ItemStack createStackedBlock(int par1)
    {
        return new ItemStack(Item.getItemFromBlock(mod_ores.ore_single_slab), 2, par1 & 7);
    }

    public String getFullSlabName(int par1)
    {
        if (par1 < 0 || par1 >= slab_names.length)
        {
            par1 = 0;
        }

        return super.getUnlocalizedName() + "." + slab_names[par1];
    }

    /**
     * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
     */
    @SideOnly(Side.CLIENT)
    public void getSubBlocks(Item par1, CreativeTabs par2, List par3)
    {
        if (par1 != Item.getItemFromBlock(mod_ores.ore_double_slab))
        {
            for (int i = 0; i <= 7; ++i)
            {
                    par3.add(new ItemStack(par1, 1, i));
                
            }
        }
    }
    
    
}

 

ItemOreSlab

package mod.mineworld.blocks.mod_ores;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import mod.mineworld.mod_ores;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSlab;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

public class ItemOreSlab extends ItemBlock
{
    private final boolean isDoubleSlab;
    private final BlockOreSlab single_slab;
    private final BlockOreSlab double_slab;

    public ItemOreSlab(Block block)
    {
    	super(block);
    	this.single_slab = mod_ores.ore_single_slab;
    	this.double_slab = mod_ores.ore_double_slab;
    	this.isDoubleSlab = false;
    	this.setHasSubtypes(true);
    	
    }

    /**
     * Gets an icon index based on an item's damage value
     */
    @SideOnly(Side.CLIENT)
    public IIcon getIconFromDamage(int par1)
    {
        return Block.getBlockFromItem(this).getIcon(1, par1);
    }

    /**
     * Returns the metadata of the block which this Item (ItemBlock) can place
     */
    public int getMetadata(int par1)
    {
        return par1;
    }

    /**
     * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have
     * different names based on their damage or NBT.
     */
    public String getUnlocalizedName(ItemStack par1ItemStack)
    {
        return this.single_slab.getFullSlabName(par1ItemStack.getItemDamage());
    }

    /**
     * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
     * True if something happen and false if it don't. This is for ITEMS, not BLOCKS
     */
    public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
    {
        if (this.isDoubleSlab)
        {
            return super.onItemUse(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10);
        }
        else if (par1ItemStack.stackSize == 0)
        {
            return false;
        }
        else if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack))
        {
            return false;
        }
        else
        {
            Block block = par3World.getBlock(par4, par5, par6);
            int i1 = par3World.getBlockMetadata(par4, par5, par6);
            int j1 = i1 & 7;
            boolean flag = (i1 &  != 0;

            if ((par7 == 1 && !flag || par7 == 0 && flag) && block == this.single_slab && j1 == par1ItemStack.getItemDamage())
            {
                if (par3World.checkNoEntityCollision(this.double_slab.getCollisionBoundingBoxFromPool(par3World, par4, par5, par6)) && par3World.setBlock(par4, par5, par6, this.double_slab, j1, 3))
                {
                    par3World.playSoundEffect((double)((float)par4 + 0.5F), (double)((float)par5 + 0.5F), (double)((float)par6 + 0.5F), this.double_slab.stepSound.func_150496_b(), (this.double_slab.stepSound.getVolume() + 1.0F) / 2.0F, this.double_slab.stepSound.getPitch() * 0.8F);
                    --par1ItemStack.stackSize;
                }

                return true;
            }
            else
            {
                return this.func_150946_a(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7) ? true : super.onItemUse(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10);
            }
        }
    }

    @SideOnly(Side.CLIENT)
    public boolean func_150936_a(World par1, int par2, int par3, int par4, int par5, EntityPlayer par6, ItemStack par7)
    {
        int i1 = par2;
        int j1 = par3;
        int k1 = par4;
        Block block = par1.getBlock(par2, par3, par4);
        int l1 = par1.getBlockMetadata(par2, par3, par4);
        int i2 = l1 & 7;
        boolean flag = (l1 &  != 0;

        if ((par5 == 1 && !flag || par5 == 0 && flag) && block == this.single_slab && i2 == par7.getItemDamage())
        {
            return true;
        }
        else
        {
            if (par5 == 0)
            {
                --par3;
            }

            if (par5 == 1)
            {
                ++par3;
            }

            if (par5 == 2)
            {
                --par4;
            }

            if (par5 == 3)
            {
                ++par4;
            }

            if (par5 == 4)
            {
                --par2;
            }

            if (par5 == 5)
            {
                ++par2;
            }

            Block block1 = par1.getBlock(par2, par3, par4);
            int j2 = par1.getBlockMetadata(par2, par3, par4);
            i2 = j2 & 7;
            return block1 == this.single_slab && i2 == par7.getItemDamage() ? true : super.func_150936_a(par1, i1, j1, k1, par5, par6, par7);
        }
    }

    private boolean func_150946_a(ItemStack par1, EntityPlayer par2, World par3, int par4, int par5, int par6, int par7)
    {
        if (par7 == 0)
        {
            --par5;
        }

        if (par7 == 1)
        {
            ++par5;
        }

        if (par7 == 2)
        {
            --par6;
        }

        if (par7 == 3)
        {
            ++par6;
        }

        if (par7 == 4)
        {
            --par4;
        }

        if (par7 == 5)
        {
            ++par4;
        }

        Block block = par3.getBlock(par4, par5, par6);
        int i1 = par3.getBlockMetadata(par4, par5, par6);
        int j1 = i1 & 7;

        if (block == this.single_slab && j1 == par1.getItemDamage())
        {
            if (par3.checkNoEntityCollision(this.double_slab.getCollisionBoundingBoxFromPool(par3, par4, par5, par6)) && par3.setBlock(par4, par5, par6, this.double_slab, j1, 3))
            {
                par3.playSoundEffect((double)((float)par4 + 0.5F), (double)((float)par5 + 0.5F), (double)((float)par6 + 0.5F), this.double_slab.stepSound.func_150496_b(), (this.double_slab.stepSound.getVolume() + 1.0F) / 2.0F, this.double_slab.stepSound.getPitch() * 0.8F);
                --par1.stackSize;
            }

            return true;
        }
        else
        {
            return false;
        }
    }
    
}

 

The last two functions in ItemOreSlab has not a simple name because i don't know what they represent so i can't "translate" them :/

Don't blame me if i always ask for your help. I just want to learn to be better :)

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.