Jump to content

Recommended Posts

Posted

Hi so far I have this :

MissingBlocks.java

 

package rtester.missingblocks;

import net.minecraft.item.Item;
import net.minecraft.item.ItemSlab;
import rtester.missingblocks.blocks.ModBlocks;
import rtester.missingblocks.blocks.ObsidianHalfSlab;
import rtester.missingblocks.lib.Constants;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;

@Mod(modid = Constants.MODID, name = Constants.MODNAME, version = Constants.VERSION)

public class MissingBlocks {

    @Mod.EventHandler
    public void preInit(FMLPreInitializationEvent event) {
    	
    	ModBlocks.init();

    }

    @Mod.EventHandler
    public void init(FMLInitializationEvent event) {

    }

    @Mod.EventHandler
    public void postInit(FMLPostInitializationEvent event) {
    	
    	Item.itemsList [ModBlocks.obsidianHalfSlab.blockID] = (new ItemSlab(
    			ModBlocks.obsidianHalfSlab.blockID - 256, (ObsidianHalfSlab) ModBlocks.obsidianHalfSlab,
    			(ObsidianHalfSlab) ModBlocks.obsidianDoubleSlab, false)); 
    }

}

 

 

ModBlocks.java

 

package rtester.missingblocks.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import rtester.missingblocks.lib.Constants;
import cpw.mods.fml.common.registry.GameRegistry;

public final class ModBlocks {

public static Block obsidianHalfSlab;
public static Block obsidianDoubleSlab;
public static Block obsidianStair;
public static Block obsidianWall;
public static Block obsidianFence;


public static void init(){

	//Slabs
	obsidianHalfSlab = new ObsidianHalfSlab(false, Material.rock).setBlockName(Constants.MODID + "_" + ObsidianHalfSlab.name).setBlockTextureName("obsidian").setCreativeTab(CreativeTabs.tabBlock);
	obsidianDoubleSlab = new ObsidianHalfSlab(true, Material.rock).setBlockName(Constants.MODID + "_" + ObsidianHalfSlab.name1).setBlockTextureName("obsidian");

	//Stairs
	obsidianStair = new ObsidianStair();

	//Walls
	obsidianWall = new ObsidianWall();

	//Fences
	obsidianFence = new ObsidianFence();


	//GameRegistry.registerBlock(this, name);
	GameRegistry.registerBlock(obsidianHalfSlab, ObsidianHalfSlab.name);
	GameRegistry.registerBlock(obsidianDoubleSlab, ObsidianHalfSlab.name1);
}
}

 

ObsidianHalfSlab

 

package rtester.missingblocks.blocks;


import net.minecraft.block.Block;
import net.minecraft.block.BlockSlab;
import net.minecraft.block.material.Material;
import rtester.missingblocks.lib.Constants;

public class ObsidianHalfSlab extends BlockSlab{

public static String name = "obsidianHalfSlab";
public static String name1 = "obsidianDoubleSlab";

public ObsidianHalfSlab(boolean isAfullBlock, Material mat){

	super(isAfullBlock, mat);

	this.setStepSound(soundTypePiston);
	this.setHardness(50.0F);
	this.setResistance(2000.0F);
	this.setHarvestLevel("pickaxe", 3);
	this.useNeighborBrightness = true;

}


@Override
public String func_150002_b(int p_150002_1_) {
	// TODO Auto-generated method stub
	return super.getUnlocalizedName();
}

}

 

 

Constants.java

 

package rtester.missingblocks.lib;

public class Constants {
    public static final String MODID = "missingblocks";
    public static final String MODNAME = "Missing Blocks";
    public static final String VERSION = "0.0.1";
}

 

 

 

I see several 1.6 example showing how to make slabs stack and they all use the Item.itemsList but I think in 1.7 they do not use ItemsList anymore because I cannot get it to resolve and it wants to use an int but I do not think blocks have id's anymore.

 

So I guess what my question is How do I change this to work in 1.7.10

 @Mod.EventHandler
    public void postInit(FMLPostInitializationEvent event) {
    	
    	Item.itemsList [ModBlocks.obsidianHalfSlab.blockID] = (new ItemSlab(
    			ModBlocks.obsidianHalfSlab.blockID - 256, (ObsidianHalfSlab) ModBlocks.obsidianHalfSlab,
    			(ObsidianHalfSlab) ModBlocks.obsidianDoubleSlab, false)); 
    }

 

This was the original example I seen

Item.itemsList[XoriteSlab.blockID] = (new ItemSlab(
XoriteSlab.blockID - 256, (BlockHalfSlab) XoriteSlab,
(BlockHalfSlab) XoriteSlabDouble, false));

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.