Jump to content

Recommended Posts

Posted

Hi,

 

Im new to making mods and i'm making progress in creating my own mod. There is one thing which I can't figure out though.

How to make half slabs.

 

I got this piece of code from the minecraftforums, but i dont know how to register it and if it even works.

package com.additionalblocks.main;

import net.minecraft.block.Block;
import net.minecraft.block.BlockSlab;
import net.minecraft.item.Item;
import net.minecraft.item.ItemSlab;
import com.additionalblocks.main.*;

public class blockSlab extends ItemSlab {

public blockSlab(Block block) {
	super(block, (BlockSlab) AdditionalBlocks.blockHalfboneslab,(BlockSlab) AdditionalBlocks.blockDoubleboneslab, false);
	this.setMaxDamage(0);
	this.setHasSubtypes(true);
}
}

I got this in de main class:


	blockHalfboneslab = new blockSlab(blockHalfboneslab);
	blockDoubleboneslab = new blockSlab(blockDoubleboneslab);

                GameRegistry.registerBlock(blockHalfboneslab, "blockHalfboneslab");
	GameRegistry.registerBlock(blockDoubleboneslab, "blockDoubleboneslab");

Posted

ItemSlab isn't a Block, so no, this isn't going to work.

 

blockHalfboneslab = new blockSlab(blockHalfboneslab);

You should also get a compiler warning from that kind of stuff. Guess why ?

 

You need to use

GameRegistry.registerBlock(block,  itemClass, name);

or equivalent.

Posted

Thx I changed it now.

 

I got this now:

GameRegistry.registerBlock(blockHalfboneslab, blockSlab.class ,"blockHalfboneslab");
GameRegistry.registerBlock(blockDoubleboneslab, blockSlab.class ,"blockDoubleboneslab");

 

but still i got an error right here

Type mismatch cannot convert from blockSlab to Block

 

blockHalfboneslab = new blockSlab(blockHalfboneslab);
blockDoubleboneslab = new blockSlab(blockDoubleboneslab);

 

 

btw i made the variables like this:

 

public static Block blockHalfboneslab;
public static Block blockDoubleboneslab;

Posted

I changed it to this.

 

package com.additionalblocks.main;

import net.minecraft.block.Block;
import net.minecraft.block.BlockSlab;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;
import net.minecraft.item.ItemSlab;

import com.additionalblocks.main.*;

public abstract class blockSlab extends BlockSlab {

public blockSlab(boolean bool, Material material) {
	super(bool, material);
	// TODO Auto-generated constructor stub
}

}

 

and this

public static BlockSlab blockHalfboneslab;
public static BlockSlab blockDoubleboneslab;

 

Still not working.

 

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.