This is the Item.class that we made. and is where we set the creative tab for our item and the texture for it.
package mods.obsidian;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
public class obsidianIngot extends Item{
public obsidianIngot(int par1) {
super(par1);
// TODO Auto-generated constructor stub
this.setCreativeTab(CreativeTabs.tabMaterials);}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister) {
this.itemIcon = iconRegister.registerIcon("tutorial.obsidian.mod:obsidianIngot");
}
}
This is telling forge where to get the item's texture from.
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister) {
this.itemIcon = iconRegister.registerIcon("tutorial.obsidian.mod:obsidianIngot");
3.Creating Blocks
[media][media][/media[/media]]
Telling Forge we are creating this block.
//Blocks
public static Block obsidianBrick;
Defining the block.
obsidianBrick = new obsidianBrick(1000, Material.rock).setHardness(1.5F).setResistance(2000.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("obsidianBrick");
Finally we need to change the ID's of the items and blocks we added to the integers so that when we change the ID's in the configuration file it will change the ID of the block/item.
//Declaring Init
@Init
public void load(FMLInitializationEvent event){
this.InitConfiguration(event);
// define items/blocks
//Item
obsidianIngot = new obsidianIngot(this.obsidianIngotID).setUnlocalizedName("obsidianIngot");
//Block
obsidianBrick = new obsidianBrick(this.obsidianBrickID, Material.rock).setHardness(1.5F).setResistance(2000.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("obsidianBrick");
5. Creating a metadata Block
[media][media][/media[/media]]
First we need to create the block file.
package mods.obsidian;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
public class obsidianBrick extends Block
{
public static final String[] STONE_BRICK_TYPES = new String[] {"default", "carved"};
public static final String[] field_94407_b = new String[] {null, "carved"};
@SideOnly(Side.CLIENT)
private Icon[] field_94408_c;
public obsidianBrick(int par1)
{
super(par1, Material.rock);
this.setCreativeTab(CreativeTabs.tabBlocks);
}
@SideOnly(Side.CLIENT)
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
*/
public Icon getIcon(int par1, int par2)
{
if (par2 < 0 || par2 >= field_94407_b.length)
{
par2 = 0;
}
return this.field_94408_c[par2];
}
/**
* Determines the damage on the item the block drops. Used in cloth and wood.
*/
public int damageDropped(int par1)
{
return par1;
}
@SideOnly(Side.CLIENT)
/**
* returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
*/
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
for (int j = 0; j < 2; ++j)
{
par3List.add(new ItemStack(par1, 1, j));
}
}
@SideOnly(Side.CLIENT)
/**
* When this method is called, your block should register all the icons it needs with the given IconRegister. This
* is the only chance you get to register icons.
*/
public void registerIcons(IconRegister par1IconRegister)
{
this.field_94408_c = new Icon[field_94407_b.length];
for (int i = 0; i < this.field_94408_c.length; ++i)
{
String s = this.func_111023_E();
if (field_94407_b[i] != null)
{
s = s + "_" + field_94407_b[i];
}
this.field_94408_c[i] = par1IconRegister.registerIcon(s);
}
}
}
This tells forge the different blocks that are using this ID.
public static final String[] STONE_BRICK_TYPES = new String[] {"default", "carved"};
This tells forge what the texture file's name is.
public static final String[] field_94407_b = new String[] {null, "carved"};
This tells forge how many metadata blocks we are creating.
@SideOnly(Side.CLIENT)
/**
* returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
*/
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
for (int j = 0; j < 2; ++j)
{
par3List.add(new ItemStack(par1, 1, j));
}
}
This tells forge where to grab the block texture(ie: tutorial.obsidian.mod/textures/blocks/obsidianbrick_carved.png).
@SideOnly(Side.CLIENT)
/**
* When this method is called, your block should register all the icons it needs with the given IconRegister. This
* is the only chance you get to register icons.
*/
public void registerIcons(IconRegister par1IconRegister)
{
this.field_94408_c = new Icon[field_94407_b.length];
for (int i = 0; i < this.field_94408_c.length; ++i)
{
String s = this.func_111023_E();
if (field_94407_b[i] != null)
{
s = s + "_" + field_94407_b[i];
}
this.field_94408_c[i] = par1IconRegister.registerIcon(s);
}
}
}
Next we need to go into our main mod file and tell forge that we are using metadata and what the different block names are
Add this under where you define your blocks and before where you add the names to your items. This is saying that this block is a multitextured block, basically a block using metadata.
@cpw.mods.fml.common.Mod.PostInit
public void PostInit(FMLPostInitializationEvent event)
{
Item.itemsList[obsidianBrick.blockID] = (new ItemMultiTextureTile(obsidianBrick.blockID - 256, obsidianBrick, BlockObsidianBrick.STONE_BRICK_TYPES)).setUnlocalizedName("obsidianbricks");
This is telling forge the names of the metadata blocks, because at the moment forge named our blocks tile.Obsidian:obsidianbricks.default.name and tile.Obsidian:obsidianbricks.carved.name.
After that we need to add this bit of line to the same place we added the line that defined about obsidian brick being a metadata block. Except this line is defining that we are able to "stack" the halfslabs, thus making them a double slab.
@cpw.mods.fml.common.Mod.PostInit
public void PostInit(FMLPostInitializationEvent event)
{
Item.itemsList[obsidianBrick.blockID] = (new ItemMultiTextureTile(obsidianBrick.blockID - 256, obsidianBrick, BlockObsidianBrick.STONE_BRICK_TYPES)).setUnlocalizedName("obsidianbricks");
Item.itemsList[obsidianBrickSingle.blockID] = (new ItemSlab(obsidianBrickSingle.blockID - 256, (BlockHalfSlab)obsidianBrickSingle, (BlockHalfSlab)obsidianBrickDouble, false));
And now we need to add a name to our new half slab so the name shows up in our inventory and creative tab.
can you please tell me what to use instead of this in Minecraft 1.7.2?
in 1.7.2 everything that had to do with block id's changed to just block. for instance, if you were to call a block using mod.block.blockId, you'd change it to mod.block for 1.7.2, so basically anything that has to do with id's needs to be getting the block itself instead.
From my research the constructor for block has changed from block(int, material) to just block(material)
So where one does new block(id, material) you instead do new block(material)
The change comes from the fact that blocks no longer have IDs in 1.7 and later.
so new myblock(1347, material.dirt) becomes just new myblock(material.dirt)
If you want to know how to modify your block class look at block.java in net.minecraft
Also nice job on the tutorials but it seems more a reference format then a tutorial.
I been looking in the Block class, BlockSlab class, BlockStoneSlab class and about 100 other mods but all of them is doing it to do about a million(exaggeration here) different types of half slabs I am just trying to keep it simple and have 1 class to make a obsidian slab and have it stack on top of each other and when middle clicked it returns a obsidian slab and when mined it returns 2 slabs instead of the doubleslab block.
I am setting up my own website for this tutorial. what do you guys think? it will be hopefully be ready soon. ill show how to code for 1.6, 1.7, and 1.8. what do you guys think?
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
-
View User Profile
-
View Posts
-
Send Message
Curse Premium1. Setting up MCP and Eclipse
[media][media][/media[/media]]
Forge Download
package mods.obsidian; import net.minecraft.block.Block; import net.minecraft.block.BlockCake; import net.minecraft.block.BlockCauldron; import net.minecraft.block.BlockFence; import net.minecraft.block.BlockHalfSlab; import net.minecraft.block.BlockLog; import net.minecraft.block.BlockStoneBrick; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.entity.Render; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityEggInfo; import net.minecraft.entity.EntityList; import net.minecraft.entity.EnumCreatureType; import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemMultiTextureTile; import net.minecraft.item.ItemReed; import net.minecraft.item.ItemSlab; import net.minecraft.item.ItemStack; import net.minecraft.src.ModLoader; import net.minecraft.util.ResourceLocation; import net.minecraft.world.biome.BiomeGenBase; import net.minecraftforge.common.EnumHelper; import net.minecraftforge.common.MinecraftForge; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; /* * Basic needed forge stuff */ @Mod(modid="tutorial.obsidian.mod",name="Obsidian Mod",version="v1") @NetworkMod(clientSideRequired=true,serverSideRequired=false) public class ObsidianMod { /* * ToolMaterial */ //Telling forge that we are creating these //Items //Blocks //Slabs //Mobs //CreativeTab //Declaring Init @Init public void load(FMLInitializationEvent event){ // define items/blocks } }This is used to tell forge that we are creating a mod. It tells forge the name of our mod and the version.
2. Creating Items
[media][media][/media[/media]]
package mods.obsidian; import net.minecraft.block.Block; import net.minecraft.block.BlockCake; import net.minecraft.block.BlockCauldron; import net.minecraft.block.BlockFence; import net.minecraft.block.BlockHalfSlab; import net.minecraft.block.BlockLog; import net.minecraft.block.BlockStoneBrick; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.entity.Render; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityEggInfo; import net.minecraft.entity.EntityList; import net.minecraft.entity.EnumCreatureType; import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemMultiTextureTile; import net.minecraft.item.ItemReed; import net.minecraft.item.ItemSlab; import net.minecraft.item.ItemStack; import net.minecraft.src.ModLoader; import net.minecraft.util.ResourceLocation; import net.minecraft.world.biome.BiomeGenBase; import net.minecraftforge.common.EnumHelper; import net.minecraftforge.common.MinecraftForge; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; /* * Basic needed forge stuff */ @Mod(modid="tutorial.obsidian.mod",name="Obsidian Mod",version="v1") @NetworkMod(clientSideRequired=true,serverSideRequired=false) public class ObsidianMod { /* * ToolMaterial */ //Telling forge that we are creating these //Items public static Item obsidianIngot; //Blocks //Slabs //Mobs //CreativeTab //Declaring Init @Init public void load(FMLInitializationEvent event){ // define items/blocks //Item obsidianIngot = new obsidianIngot(2000).setUnlocalizedName("obsidianIngot"); //Register Names LanguageRegistry.addName(obsidianIngot, "Obsidian Ingot"); } }This is telling forge that we are creating this item
This is defining the item that we created, telling forge the item ID and whether or not it is a food.
//Declaring Init @Init public void load(FMLInitializationEvent event){ // define items/blocks //Item obsidianIngot = new obsidianIngot(2000).setUnlocalizedName("obsidianIngot");This is making it so the name of our item shows up when its in our inventory. basically its adding the name for it.
This is the Item.class that we made. and is where we set the creative tab for our item and the texture for it.
package mods.obsidian; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; public class obsidianIngot extends Item{ public obsidianIngot(int par1) { super(par1); // TODO Auto-generated constructor stub this.setCreativeTab(CreativeTabs.tabMaterials);} @Override @SideOnly(Side.CLIENT) public void registerIcons(IconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("tutorial.obsidian.mod:obsidianIngot"); } }This is telling forge where to get the item's texture from.
@Override @SideOnly(Side.CLIENT) public void registerIcons(IconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("tutorial.obsidian.mod:obsidianIngot");3.Creating Blocks
[media][media][/media[/media]]
Telling Forge we are creating this block.
Defining the block.
obsidianBrick = new obsidianBrick(1000, Material.rock).setHardness(1.5F).setResistance(2000.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("obsidianBrick");Registering the block to the game.
Adding a name to the block.
This is going to be our block.class.
package mods.obsidian; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; public class obsidianBrick extends Block{ public obsidianBrick(int par1, Material par2Material) { super(par1, par2Material); // TODO Auto-generated constructor stub this.setCreativeTab(CreativeTabs.tabBlock);} @Override @SideOnly(Side.CLIENT) public void registerIcons(IconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon("tutorial.obsidian.mod:obsidianbrick"); } }This tells forge where to get the texture for our block from.
@Override @SideOnly(Side.CLIENT) public void registerIcons(IconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon("tutorial.obsidian.mod:obsidianbrick");4. Creating a Config File
[media][media][/media[/media]]
First we need to tell forge that we are making new integers.
Next we need to define the integers for the configuration file and tell forge where to create the configuration file.
public void InitConfiguration(FMLInitializationEvent event){ Configuration Config = new Configuration(new File("config/ObsidianMod.cfg")); Config.load(); obsidianIngotID = Config.get("Items", "Obsidian Ingot", 2000).getInt(); obsidianBrickID = Config.get("Blocks", Obsidian Brick", 1000).getInt(); Config.save();Finally we need to change the ID's of the items and blocks we added to the integers so that when we change the ID's in the configuration file it will change the ID of the block/item.
//Declaring Init @Init public void load(FMLInitializationEvent event){ this.InitConfiguration(event); // define items/blocks //Item obsidianIngot = new obsidianIngot(this.obsidianIngotID).setUnlocalizedName("obsidianIngot"); //Block obsidianBrick = new obsidianBrick(this.obsidianBrickID, Material.rock).setHardness(1.5F).setResistance(2000.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("obsidianBrick");5. Creating a metadata Block
[media][media][/media[/media]]
First we need to create the block file.
package mods.obsidian; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; import net.minecraft.util.Icon; public class obsidianBrick extends Block { public static final String[] STONE_BRICK_TYPES = new String[] {"default", "carved"}; public static final String[] field_94407_b = new String[] {null, "carved"}; @SideOnly(Side.CLIENT) private Icon[] field_94408_c; public obsidianBrick(int par1) { super(par1, Material.rock); this.setCreativeTab(CreativeTabs.tabBlocks); } @SideOnly(Side.CLIENT) /** * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata */ public Icon getIcon(int par1, int par2) { if (par2 < 0 || par2 >= field_94407_b.length) { par2 = 0; } return this.field_94408_c[par2]; } /** * Determines the damage on the item the block drops. Used in cloth and wood. */ public int damageDropped(int par1) { return par1; } @SideOnly(Side.CLIENT) /** * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) */ public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) { for (int j = 0; j < 2; ++j) { par3List.add(new ItemStack(par1, 1, j)); } } @SideOnly(Side.CLIENT) /** * When this method is called, your block should register all the icons it needs with the given IconRegister. This * is the only chance you get to register icons. */ public void registerIcons(IconRegister par1IconRegister) { this.field_94408_c = new Icon[field_94407_b.length]; for (int i = 0; i < this.field_94408_c.length; ++i) { String s = this.func_111023_E(); if (field_94407_b[i] != null) { s = s + "_" + field_94407_b[i]; } this.field_94408_c[i] = par1IconRegister.registerIcon(s); } } }This tells forge the different blocks that are using this ID.
public static final String[] STONE_BRICK_TYPES = new String[] {"default", "carved"};This tells forge what the texture file's name is.
public static final String[] field_94407_b = new String[] {null, "carved"};This tells forge how many metadata blocks we are creating.
@SideOnly(Side.CLIENT) /** * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) */ public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) { for (int j = 0; j < 2; ++j) { par3List.add(new ItemStack(par1, 1, j)); } }This tells forge where to grab the block texture(ie: tutorial.obsidian.mod/textures/blocks/obsidianbrick_carved.png).
@SideOnly(Side.CLIENT) /** * When this method is called, your block should register all the icons it needs with the given IconRegister. This * is the only chance you get to register icons. */ public void registerIcons(IconRegister par1IconRegister) { this.field_94408_c = new Icon[field_94407_b.length]; for (int i = 0; i < this.field_94408_c.length; ++i) { String s = this.func_111023_E(); if (field_94407_b[i] != null) { s = s + "_" + field_94407_b[i]; } this.field_94408_c[i] = par1IconRegister.registerIcon(s); } } }Next we need to go into our main mod file and tell forge that we are using metadata and what the different block names are
Add this under where you define your blocks and before where you add the names to your items. This is saying that this block is a multitextured block, basically a block using metadata.
@cpw.mods.fml.common.Mod.PostInit public void PostInit(FMLPostInitializationEvent event) { Item.itemsList[obsidianBrick.blockID] = (new ItemMultiTextureTile(obsidianBrick.blockID - 256, obsidianBrick, BlockObsidianBrick.STONE_BRICK_TYPES)).setUnlocalizedName("obsidianbricks");This is telling forge the names of the metadata blocks, because at the moment forge named our blocks tile.Obsidian:obsidianbricks.default.name and tile.Obsidian:obsidianbricks.carved.name.
LanguageRegistry.instance().addStringLocalization("tile.obsidianBrick.default.name", "en_US", "Obsidian Brick"); LanguageRegistry.instance().addStringLocalization("tile.obsidianBrick.carved.name", "en_US", "Carved Obsidian Brick");You also need to add this little bit of code at the end of where you defined your block.
.func_111022_d("tutorial.obsidian.mod:obsidianbrick");And that is all that is need to create a metadata block.
6. Creating half slabs
First what we need to do is tell forge that we are making two blocks, a single and double slab.
Next we need to have the new blocks register in the config file so when people use our mod they will be able to change both block ID's.
public void InitConfiguration(FMLInitializationEvent event){ Configuration Config = new Configuration(new File("config/ObsidianMod.cfg")); Config.load(); obsidianIngotID = Config.get("Items", "Obsidian Ingot", 2000).getInt(); obsidianBrickID = Config.get("Blocks", "Obsidian Brick", 1000).getInt(); obsidianBrickSingleID = Config.get("Blocks", "Obsidian Brick Single", 1001).getInt(); obsidianBrickDoubleID = Config.get("Blocks", "Obsidian Brick Double", 1002).getInt(); Config.save(); }Next we have to define both halfslabs(this is just like creating your normal block, with a couple changes).
obsidianBrickDouble = (BlockHalfSlab)(new BlockObsidianBrickSlab(this.obsidianBrickDoubleID, true)).setHardness(1.6F).setResistance(7.5F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("obsidianbrickslab");; obsidianBrickSingle = (BlockHalfSlab)(new BlockObsidianBrickSlab(this.obsidianBrickSingleID, false)).setHardness(1.6F).setResistance(7.5F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("obsidianbrickslab").setCreativeTab(CreativeTabs.tabBlocks); GameRegistry.registerBlock(obsidianBrickDouble, "obsidianBrickDoubleSlab"); GameRegistry.registerBlock(obsidianBrickSingle, "obsidianBrickSingleSlab"); }After that we need to add this bit of line to the same place we added the line that defined about obsidian brick being a metadata block. Except this line is defining that we are able to "stack" the halfslabs, thus making them a double slab.
@cpw.mods.fml.common.Mod.PostInit public void PostInit(FMLPostInitializationEvent event) { Item.itemsList[obsidianBrick.blockID] = (new ItemMultiTextureTile(obsidianBrick.blockID - 256, obsidianBrick, BlockObsidianBrick.STONE_BRICK_TYPES)).setUnlocalizedName("obsidianbricks"); Item.itemsList[obsidianBrickSingle.blockID] = (new ItemSlab(obsidianBrickSingle.blockID - 256, (BlockHalfSlab)obsidianBrickSingle, (BlockHalfSlab)obsidianBrickDouble, false));And now we need to add a name to our new half slab so the name shows up in our inventory and creative tab.
LanguageRegistry.instance().addStringLocalization("tile.obsidianbrickslab.obsidianBrick.name", "en_US", "Obsidian Brick Slab");And now we need to create the block file for the half slabs.
package mods.obsidian; import java.util.List; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockHalfSlab; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLiving; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class BlockObsidianBrickSlab extends BlockHalfSlab { public static final String[] woodType = { "obsidianBrick" }; public BlockObsidianBrickSlab(int par1, boolean par2) { super(par1, par2, Material.rock); useNeighborBrightness[this.blockID] = true; } public void registerIcons(IconRegister par1IconRegister) { this.blockIcon = par1IconRegister.registerIcon("tutorial.obsidian.mod:obsidianbrick"); } public int idDropped(int par1, Random par2Random, int par3) { return ObsidianMod.obsidianBrickSingle.blockID; } public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving) { if(par1World.getBlockId(par2, par3 - 1, par4) == ObsidianMod.obsidianBrickSingle.blockID) { par1World.setBlock(par2, par3, par4, 0); par1World.setBlock(par2, par3 - 1, par4, ObsidianMod.obsidianBrickDouble.blockID); } if(par1World.getBlockId(par2, par3 + 1, par4) == ObsidianMod.obsidianBrickSingle.blockID) { par1World.setBlock(par2, par3, par4, 0); par1World.setBlock(par2, par3 + 1, par4, ObsidianMod.obsidianBrickDouble.blockID); } } protected ItemStack createStackedBlock(int par1) { return new ItemStack(ObsidianMod.obsidianBrickSingle.blockID, 2, par1 & 7); } public String getFullSlabName(int par1) { if ((par1 < 0) || (par1 >= woodType.length)) { par1 = 0; } return super.getUnlocalizedName() + "." + woodType[par1]; } public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) { if (par1 != ObsidianMod.obsidianBrickDouble.blockID) { par3List.add(new ItemStack(par1, 1, 0)); } } }in 1.7.2 everything that had to do with block id's changed to just block. for instance, if you were to call a block using mod.block.blockId, you'd change it to mod.block for 1.7.2, so basically anything that has to do with id's needs to be getting the block itself instead.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumSorry, i wish i could. im currently updating my own mod to 1.7.2 as well. when i do and if it works ill tell you how to fix this.
Have you figured out how to do this in 1.7 yet?
I been looking in the Block class, BlockSlab class, BlockStoneSlab class and about 100 other mods but all of them is doing it to do about a million(exaggeration here) different types of half slabs I am just trying to keep it simple and have 1 class to make a obsidian slab and have it stack on top of each other and when middle clicked it returns a obsidian slab and when mined it returns 2 slabs instead of the doubleslab block.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumI am setting up my own website for this tutorial. what do you guys think? it will be hopefully be ready soon. ill show how to code for 1.6, 1.7, and 1.8. what do you guys think?