Jump to content

Recommended Posts

Posted

Hey guys, so in a discontinued mod of mine I made stairs using this code:

And this seemed to work in 1.4, 1.5 and 1.6

 

 

package assests.jordsta95;

 

import net.minecraft.block.Block;

import net.minecraft.block.BlockStairs;

import net.minecraft.block.material.Material;

 

public class BasaltStairs extends BlockStairs{

 

protected BasaltStairs(int par1, Block par2Block, int par3) {

super(par1, par2Block, par3);

}

 

public BasaltStairs(int i, String string) {

super(i, Everything_and_More_Mod.Basalt, i);

setCreativeTab(Everything_and_More_Mod.EEMTab);

}

 

 

}

 

 

 

 

However when I added it to my new 1.7 mod using this code:

 

 

package com.jordsta95.mifu;

 

import net.minecraft.block.Block;

import net.minecraft.block.BlockStairs;

import net.minecraft.block.material.Material;

import net.minecraft.creativetab.CreativeTabs;

 

public class DirtStairs extends BlockStairs{

 

protected DirtStairs(int par1, Block par2Block, int par3) {

super(par1, par2Block, par3);

}

 

public DirtStairs(int i, String string) {

super(i, Block.dirt, i);

setCreativeTab(CreativeTabs.tabMisc);

}

 

}

 

 

 

 

It doesn't work.

The main class looks like this:

 

 

package com.jordsta95.mifu;

 

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.init.Blocks;

import net.minecraft.item.Item;

 

import com.jordsta95.mifu.lib.ProxyCommon;

import com.jordsta95.mifu.lib.References;

 

import cpw.mods.fml.common.Mod;

import cpw.mods.fml.common.Mod.EventHandler;

import cpw.mods.fml.common.SidedProxy;

import cpw.mods.fml.common.event.FMLInitializationEvent;

import cpw.mods.fml.common.registry.GameRegistry;

import cpw.mods.fml.common.registry.LanguageRegistry;

 

@Mod(modid = References.MODID, version = References.VERSION)

public class MainClass

{

@SidedProxy(clientSide = References.Client, serverSide = References.Common)

public static ProxyCommon proxy;

 

//items

    public static Item Lovite;

 

   

   

    //blocks

    public static Block DirtStairs;

    public static Block Dirt;

 

   

   

   

 

    @EventHandler

    public void init(FMLInitializationEvent event)

    {

DefineMaterials();

DefineBlocksandItems();

AddNames();

AddCraftingRecipe();

 

    }

    private void AddCraftingRecipe() {

//crating recipes

 

}

private void AddNames() {

//language registry

 

    LanguageRegistry.addName(Lovite, "Lovite");

    LanguageRegistry.addName(DirtStairs, "DirtStairs");

}

private void DefineBlocksandItems() {

//items

Lovite = new Lovite(4198).setUnlocalizedName("Lovite");

   

 

 

//Blocks

GameRegistry.registerBlock(DirtStairs, "DirtStairs");

 

DirtStairs = new DirtStairs(2201, "DirtStairs").setUnlocalizedName("DirtStairs").setHardness(0.5F).setStepSound(Block.soundStoneFootstep).setResistance(10.0F);

GameRegistry.registerBlock(DirtStairs, "DirtStairs");

 

 

}

private void DefineMaterials() {

// TODO Auto-generated method stub

 

}

@EventHandler

    public void load(FMLInitializationEvent event){

    proxy.registerRenderInformation();

    }

   

    public MainClass(){

    //item registry 

    //Game registry

 

   

   

    //Language registry

 

 

    }

   

}

 

 

 

*I am in the process of cleaning it up, don't worry...

 

But I can't seem to get it to work :(

Also, it doesn't seem to recognize Block.dirt (Trying to make it use the minecraft dirt texture) which is also an issue. But seeing as I get errors almost everywhere, I can't really test out why it doesn't work :/

Why bother?

Posted

Here's my code(which works perfectly):

Main file:

        public static BlockStairs CbBlackStair;

        	CbBlackStair = new CbColorStair(CbBlack, 0, "Black", 2);

BlockStair:

package colorblocks.blocks;

import colorblocks.ColorBlocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockStairs;

public class CbColorStair extends BlockStairs{

private Block block;

public CbColorStair(Block block, int extender,String string, int tab) {
	super(block, 1);
	this.block = block;
	this.setBlockName("Cb" + string + "Stair");
	setResistance(50F);
	setHardness(0.1F);
	setStepSound(Block.soundTypeStone);
	setLightLevel(1F);
	this.damageDropped(0);
	if(tab == 0)
	this.setCreativeTab(ColorBlocks.BlueTab);
	if(tab == 1)
		this.setCreativeTab(ColorBlocks.BrownTab);
	if(tab == 2)
		this.setCreativeTab(ColorBlocks.GrayTab);
	if(tab == 3)
		this.setCreativeTab(ColorBlocks.GreenTab);
	if(tab == 4)
		this.setCreativeTab(ColorBlocks.PinkTab);
	if(tab == 5)
		this.setCreativeTab(ColorBlocks.YellowTab);
	if(tab == 6)
		this.setCreativeTab(ColorBlocks.RedTab);
}

}

 

 

If I helped please press the Thank You button.

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.