Hi guys !
this is my very first post here and i have some diffilcuties to create slab, especially with this :
package mod.jbjoe.dcojoe.init;
import mod.jbjoe.dcojoe.block.BlockTuile;
import mod.jbjoe.dcojoe.block.BlockTuileSlab;
import mod.jbjoe.dcojoe.block.BlockTuileStairs;
import mod.jbjoe.dcojoe.reference.Names;
import mod.jbjoe.dcojoe.reference.Reference;
import mod.jbjoe.dcojoe.reference.Settings;
import net.minecraftforge.fml.common.registry.GameRegistry;
@GameRegistry.ObjectHolder(Reference.MOD_ID)
public class ModBlocks
{
public static final BlockTuile block_tuile = new BlockTuile();
public static final BlockTuileSlab block_tuile_slab = new BlockTuileSlab();
public static final BlockTuileStairs block_tuile_stairs = new BlockTuileStairs();
public static void init()
{
if (Settings.General.enableModBlocks)
{
GameRegistry.registerBlock(block_tuile, Names.Blocks.TUILE);
GameRegistry.registerBlock(block_tuile_slab, Names.Blocks.TUILE_SLAB);
GameRegistry.registerBlock(block_tuile_stairs, Names.Blocks.TUILE_STAIRS);
}
}
}
I got the error at new BlockTuileSlab
public static final BlockTuileSlab block_tuile_slab = new BlockTuileSlab();
eclispe says "Cannot instantiate the type BlockTuileSlab"
here is the code of the class of the slab :
package mod.jbjoe.dcojoe.block;
import java.util.List;
import java.util.Random;
import mod.jbjoe.dcojoe.reference.Reference;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSlab;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IStringSerializable;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public abstract class BlockSlabEM extends BlockSlab
{
public static final PropertyEnum HALF_PROP = PropertyEnum.create("half", BlockSlab.EnumBlockHalf.class);
private static final String __OBFID = "CL_00000253";
public BlockSlabEM(Material material)
{
super(material);
}
public BlockSlabEM()
{
this(Material.rock);
}
@Override
public String getUnlocalizedName()
{
return String.format("tile.%s%s", Reference.MOD_ID.toLowerCase() + ":", getUnwrappedUnlocalizedName(super.getUnlocalizedName()));
}
protected String getUnwrappedUnlocalizedName(String unlocalizedName)
{
return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1);
}
}
Here is BlockSlabEM (the extends of the BlockTuileSlab)
package mod.jbjoe.dcojoe.block;
import java.util.List;
import java.util.Random;
import mod.jbjoe.dcojoe.reference.Reference;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSlab;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IStringSerializable;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public abstract class BlockSlabEM extends BlockSlab
{
public static final PropertyEnum HALF_PROP = PropertyEnum.create("half", BlockSlab.EnumBlockHalf.class);
private static final String __OBFID = "CL_00000253";
public BlockSlabEM(Material material)
{
super(material);
}
public BlockSlabEM()
{
this(Material.rock);
}
@Override
public String getUnlocalizedName()
{
return String.format("tile.%s%s", Reference.MOD_ID.toLowerCase() + ":", getUnwrappedUnlocalizedName(super.getUnlocalizedName()));
}
protected String getUnwrappedUnlocalizedName(String unlocalizedName)
{
return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1);
}
}
EDIT : and there is BlockTuileSlab.java
package mod.jbjoe.dcojoe.block;
import mod.jbjoe.dcojoe.creativetab.CreativeTabEM;
import mod.jbjoe.dcojoe.reference.Names;
import net.minecraft.block.BlockSlab;
import net.minecraft.block.material.Material;
public abstract class BlockTuileSlab extends BlockSlabEM
{
public BlockTuileSlab()
{
super(Material.rock);
this.setUnlocalizedName(Names.Blocks.TUILE_SLAB);
this.setCreativeTab(CreativeTabEM.EM_TAB);
this.setHardness(4.0F);
this.setResistance(3.0F);
this.setStepSound(soundTypePiston);
this.setHarvestLevel("pickaxe", 0);
}
}
i don't know where is the miss,
so all your help will be appreciated !
(and if you feel to help more, i would like to have some details about adding a stairs )
thanks you for all the help !