Posted May 15, 201411 yr 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");
May 15, 201411 yr 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.
May 15, 201411 yr Author 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;
May 15, 201411 yr Author 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.
May 16, 201411 yr Author Does anybody have a sample code for a simple half slab? I could use it to figure out whats wrong with mine.
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.