GenericWood: add slabs
This commit is contained in:
parent
e32c4228aa
commit
d8288f071f
3 changed files with 79 additions and 11 deletions
|
@ -12,7 +12,6 @@ import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||||
import net.universe_factory.minecraft.test.blocks.*;
|
import net.universe_factory.minecraft.test.blocks.*;
|
||||||
import net.universe_factory.minecraft.test.generic.GenericWood;
|
import net.universe_factory.minecraft.test.generic.GenericWood;
|
||||||
|
|
||||||
|
|
||||||
@Mod(modid = Test.MODID, version = Test.VERSION)
|
@Mod(modid = Test.MODID, version = Test.VERSION)
|
||||||
public class Test {
|
public class Test {
|
||||||
public static final String MODID = "neoraider_test";
|
public static final String MODID = "neoraider_test";
|
||||||
|
@ -27,7 +26,8 @@ public class Test {
|
||||||
@Override
|
@Override
|
||||||
public int getMinTreeHeight() {
|
public int getMinTreeHeight() {
|
||||||
return 4;
|
return 4;
|
||||||
}});
|
}
|
||||||
|
});
|
||||||
|
|
||||||
@Instance(value = MODID)
|
@Instance(value = MODID)
|
||||||
public static Test instance;
|
public static Test instance;
|
||||||
|
|
|
@ -10,11 +10,13 @@ import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockLeaves;
|
import net.minecraft.block.BlockLeaves;
|
||||||
import net.minecraft.block.BlockLog;
|
import net.minecraft.block.BlockLog;
|
||||||
import net.minecraft.block.BlockSapling;
|
import net.minecraft.block.BlockSapling;
|
||||||
|
import net.minecraft.block.BlockSlab;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemSlab;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
@ -31,6 +33,8 @@ public class GenericWood {
|
||||||
public final Block log;
|
public final Block log;
|
||||||
public final BlockLeaves leaves;
|
public final BlockLeaves leaves;
|
||||||
public final BlockSapling sapling;
|
public final BlockSapling sapling;
|
||||||
|
public final BlockSlab slab;
|
||||||
|
public final BlockSlab double_slab;
|
||||||
|
|
||||||
public GenericWood(Info info) {
|
public GenericWood(Info info) {
|
||||||
this.info = info;
|
this.info = info;
|
||||||
|
@ -39,15 +43,24 @@ public class GenericWood {
|
||||||
log = new Log();
|
log = new Log();
|
||||||
leaves = new Leaves();
|
leaves = new Leaves();
|
||||||
sapling = new Sapling();
|
sapling = new Sapling();
|
||||||
|
slab = new Slab(false);
|
||||||
|
double_slab = new Slab(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void register() {
|
public void register() {
|
||||||
GameRegistry.registerBlock(planks, "blockWood" + info.getName());
|
GameRegistry.registerBlock(planks, "wood_" + info.getName().toLowerCase());
|
||||||
GameRegistry.registerBlock(log, "blockLog" + info.getName());
|
GameRegistry.registerBlock(log, "log_" + info.getName().toLowerCase());
|
||||||
GameRegistry.registerBlock(leaves, "blockLeaves" + info.getName());
|
GameRegistry.registerBlock(leaves, "leaves_" + info.getName().toLowerCase());
|
||||||
GameRegistry.registerBlock(sapling, "blockSapling" + info.getName());
|
GameRegistry.registerBlock(sapling, "sapling_" + info.getName().toLowerCase());
|
||||||
|
|
||||||
|
GameRegistry.registerBlock(slab, null, "wooden_slab_" + info.getName().toLowerCase());
|
||||||
|
GameRegistry.registerItem(new ItemSlab(slab, slab, double_slab, false), "wooden_slab_" + info.getName().toLowerCase());
|
||||||
|
|
||||||
|
GameRegistry.registerBlock(double_slab, null, "double_wooden_slab_" + info.getName().toLowerCase());
|
||||||
|
GameRegistry.registerItem(new ItemSlab(double_slab, slab, double_slab, true), "double_wooden_slab_" + info.getName().toLowerCase());
|
||||||
|
|
||||||
GameRegistry.addRecipe(new ItemStack(planks, 4, 0), "#", '#', log);
|
GameRegistry.addRecipe(new ItemStack(planks, 4, 0), "#", '#', log);
|
||||||
|
GameRegistry.addRecipe(new ItemStack(slab, 6, 0), "###", '#', planks);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Planks extends Block {
|
private class Planks extends Block {
|
||||||
|
@ -181,8 +194,62 @@ public class GenericWood {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class Slab extends BlockSlab {
|
||||||
|
public Slab(boolean doubleSlab) {
|
||||||
|
super(doubleSlab, Material.wood);
|
||||||
|
|
||||||
|
setCreativeTab(CreativeTabs.tabBlock);
|
||||||
|
|
||||||
|
setHardness(2.0f);
|
||||||
|
setResistance(5.0f);
|
||||||
|
setStepSound(soundTypeWood);
|
||||||
|
setBlockName("woodSlab" + info.getName());
|
||||||
|
|
||||||
|
setLightOpacity(doubleSlab ? 255 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public IIcon getIcon(int side, int meta) {
|
||||||
|
return planks.getIcon(side, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Item getItemDropped(int p_149650_1_, Random random, int p_149650_3_) {
|
||||||
|
return Item.getItemFromBlock(slab);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ItemStack createStackedBlock(int meta) {
|
||||||
|
return new ItemStack(Item.getItemFromBlock(slab), 2, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String func_150002_b(int p_150002_1_) {
|
||||||
|
return getUnlocalizedName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) {
|
||||||
|
if (!field_150004_a)
|
||||||
|
super.getSubBlocks(item, creativeTabs, list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public Item getItem(World world, int x, int y, int z) {
|
||||||
|
return Item.getItemFromBlock(slab);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static abstract class Info {
|
public static abstract class Info {
|
||||||
public abstract String getName();
|
public abstract String getName();
|
||||||
|
|
||||||
public abstract int getMinTreeHeight();
|
public abstract int getMinTreeHeight();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,3 +2,4 @@ tile.woodCherry.name=Cherry Tree Wood Planks
|
||||||
tile.logCherry.name=Cherry Tree Wood
|
tile.logCherry.name=Cherry Tree Wood
|
||||||
tile.leavesCherry.name=Cherry Tree Leaves
|
tile.leavesCherry.name=Cherry Tree Leaves
|
||||||
tile.saplingCherry.name=Cherry Tree Sapling
|
tile.saplingCherry.name=Cherry Tree Sapling
|
||||||
|
tile.woodSlabCherry.name=Cherry Tree Wood Slab
|
Reference in a new issue