Jump to content

[1.8]Issue while modding a Slab


JbJoe

Recommended Posts

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 ! :D

Link to comment
Share on other sites

Please include BlockTuileSlab.java

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.