Compressed Logs and Slabs.

Reworked stairs a bit, still need some fixing.
This commit is contained in:
Amnet 2013-04-15 01:11:00 +02:00
parent 0337edec5e
commit f430e8dd3d
31 changed files with 497 additions and 91 deletions

View File

@ -11,6 +11,7 @@ import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import tdwp_ftw.biomesop.configuration.BOPBlocks;
@Deprecated
public class BlockAcaciaLog extends Block
{
/** The type of tree this log came from. */

View File

@ -12,7 +12,7 @@ import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import tdwp_ftw.biomesop.configuration.BOPBlocks;
@Deprecated
public class BlockAcaciaSlab extends BlockHalfSlab
{
/** The type of tree this slab came from. */

View File

@ -2,12 +2,14 @@ package tdwp_ftw.biomesop.blocks;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFlower;
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;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import cpw.mods.fml.relauncher.Side;
@ -53,6 +55,15 @@ public class BlockBOPFlower extends BlockFlower
return textures[meta];
}
public int getLightValue(IBlockAccess world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
if (meta == 2)
return 9;
else
return 0;
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(int blockID, CreativeTabs creativeTabs, List list) {

View File

@ -0,0 +1,156 @@
package tdwp_ftw.biomesop.blocks;
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;
import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockBOPLog extends Block
{
public static enum LogCategory
{
CAT1, CAT2, CAT3;
}
private static final String[] woodTypes = new String[] {"acacia", "cherry", "dark", "fir", "holy", "magic", "mangrove", "palm", "redwood", "willow", "dead"};
@SideOnly(Side.CLIENT)
private Icon[] textures;
private Icon logHeart;
private final LogCategory category;
public BlockBOPLog(int blockID, LogCategory cat)
{
super(blockID, Material.wood);
category = cat;
setBurnProperties(this.blockID, 5, 5);
setHardness(2.0F);
setResistance(5.0F);
setStepSound(Block.soundWoodFootstep);
this.setCreativeTab(mod_BiomesOPlenty.tabBiomesOPlenty);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister)
{
textures = new Icon[woodTypes.length];
logHeart = iconRegister.registerIcon("BiomesOPlenty:logTopBottum");
for (int i = 0; i < woodTypes.length; ++i)
textures[i] = iconRegister.registerIcon("BiomesOPlenty:"+woodTypes[i]+"log");
}
@Override
@SideOnly(Side.CLIENT)
public Icon getBlockTextureFromSideAndMetadata(int side, int meta)
{
int pos = meta & 12;
if (pos == 0 && (side == 1 || side == 0) || pos == 4 && (side == 5 || side == 4) || pos == 8 && (side == 2 || side == 3))
return logHeart;
return textures[(getTypeFromMeta(meta) + this.category.ordinal() * 4)];
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(int blockID, CreativeTabs creativeTabs, List list) {
for (int i = 0; i < 4; ++i)
if (category != LogCategory.CAT3 || i < 3)
// return;
// else
list.add(new ItemStack(this, 1, i));
}
@Override
public void breakBlock(World world, int x, int y, int z, int par5, int par6)
{
byte radius = 4;
int bounds = radius + 1;
if (world.checkChunksExist(x - bounds, y - bounds, z - bounds, x + bounds, y + bounds, z + bounds))
for (int i = -radius; i <= radius; ++i)
for (int j = -radius; j <= radius; ++j)
for (int k = -radius; k <= radius; ++k)
{
int blockID = world.getBlockId(x + i, y + j, z + k);
if (Block.blocksList[blockID] != null)
Block.blocksList[blockID].beginLeavesDecay(world, x + i, y + j, z + k);
}
}
@Override
public int onBlockPlaced(World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int meta)
{
int type = getTypeFromMeta(meta);
byte orientation = 0;
switch (side)
{
case 0:
case 1:
orientation = 0;
break;
case 2:
case 3:
orientation = 8;
break;
case 4:
case 5:
orientation = 4;
}
return type | orientation;
}
@Override
public int damageDropped(int meta)
{
return getTypeFromMeta(meta);
}
@Override
protected ItemStack createStackedBlock(int meta)
{
return new ItemStack(this.blockID, 1, getTypeFromMeta(meta));
}
@Override
public int getRenderType()
{
return 31;
}
@Override
public boolean canSustainLeaves(World world, int x, int y, int z)
{
return true;
}
@Override
public boolean isWood(World world, int x, int y, int z)
{
return true;
}
public int getWoodType(int meta)
{
return getTypeFromMeta(meta) + category.ordinal() * 4;
}
private static int getTypeFromMeta(int meta)
{
return meta & 3;
}
}

View File

@ -2,26 +2,46 @@ package tdwp_ftw.biomesop.blocks;
import java.util.List;
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.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockBOPSlab extends BlockHalfSlab
{
public static enum SlabCategory
{
WOOD1, WOOD2, STONE;
}
private static final String[] woodTypes = new String[] {"acacia", "cherry", "dark", "fir", "holy", "magic", "mangrove", "palm", "redwood", "willow"};
private static final String[] rockTypes = new String[] {"redbrick", "redcobble", "mudbrick"};
@SideOnly(Side.CLIENT)
private Icon[] textures;
public BlockBOPSlab(int par1, boolean par2)
private final SlabCategory category;
public BlockBOPSlab(int par1, boolean par2, Material material, SlabCategory cat)
{
super(par1, par2, Material.wood);
setBurnProperties(this.blockID, 5, 20);
super(par1, par2, material);
category = cat;
if (material == Material.wood)
{
setBurnProperties(this.blockID, 5, 20);
setHardness(2.0F);
setResistance(5.0F);
setStepSound(Block.soundWoodFootstep);
}
else if (material == Material.rock)
setStepSound(Block.soundStoneFootstep);
this.setCreativeTab(mod_BiomesOPlenty.tabBiomesOPlenty);
useNeighborBrightness[blockID] = true;
}
@ -30,35 +50,55 @@ public class BlockBOPSlab extends BlockHalfSlab
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister)
{
textures = new Icon[woodTypes.length];
for (int i = 0; i < woodTypes.length; ++i)
textures[i] = iconRegister.registerIcon("BiomesOPlenty:"+woodTypes[i]+"plank");
if (category == SlabCategory.STONE)
{
textures = new Icon[rockTypes.length];
for (int i = 0; i < rockTypes.length; ++i)
textures[i] = iconRegister.registerIcon("BiomesOPlenty:"+rockTypes[i]);
}
else
{
textures = new Icon[woodTypes.length];
for (int i = 0; i < woodTypes.length; ++i)
textures[i] = iconRegister.registerIcon("BiomesOPlenty:"+woodTypes[i]+"plank");
}
}
@Override
@SideOnly(Side.CLIENT)
public Icon getBlockTextureFromSideAndMetadata(int side, int meta)
{
if (meta < 0 || meta >= textures.length)
meta = 0;
return textures[meta];
if (category == SlabCategory.STONE)
return textures[getTypeFromMeta(meta)];
else
return textures[(getTypeFromMeta(meta) + this.category.ordinal() * 8)];
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(int blockID, CreativeTabs creativeTabs, List list) {
for (int i = 0; i < woodTypes.length; ++i)
list.add(new ItemStack(blockID, 1, i));
int max = 0;
if (category == SlabCategory.WOOD1)
max = 8;
else if (category == SlabCategory.WOOD2)
max = 2;
else if (category == SlabCategory.STONE)
max = 3;
for (int i = 0; i < max; ++i)
list.add(new ItemStack(blockID, 1, i));
}
@Override
public String getFullSlabName(int meta)
{
if (meta < 0 || meta >= textures.length)
meta = 0;
return (new StringBuilder()).append(woodTypes[meta]).append("Slab").toString();
if (category == SlabCategory.STONE)
return (new StringBuilder()).append(rockTypes[getTypeFromMeta(meta)]).append("Slab").toString();
else
return (new StringBuilder()).append(woodTypes[getWoodType(meta)]).append("Slab").toString();
}
@Override
@ -67,8 +107,72 @@ public class BlockBOPSlab extends BlockHalfSlab
return meta;
}
@Override
public float getBlockHardness(World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
float hardness = this.blockHardness;
if (category == SlabCategory.STONE)
{
switch (getTypeFromMeta(meta))
{
case 0:
hardness = 1.1F;
break;
case 1:
hardness = 1.6F;
break;
case 2:
hardness = 1.0F;
break;
}
}
return hardness;
}
@Override
public float getExplosionResistance(Entity par1Entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ)
{
int meta = world.getBlockMetadata(x, y, z);
float resistance = this.blockHardness;
if (category == SlabCategory.STONE)
{
switch (getTypeFromMeta(meta))
{
case 0:
resistance = 7.5F;
break;
case 1:
resistance = 7.0F;
break;
case 2:
resistance = 2.0F;
break;
}
}
return resistance / 5.0F;
}
protected ItemStack createStackedBlock(int par1)
{
return new ItemStack(this.blockID, 2, par1);
}
private int getWoodType(int meta)
{
return getTypeFromMeta(meta) + category.ordinal() * 8;
}
private static int getTypeFromMeta(int meta)
{
return meta & 7;
}
}

View File

@ -1,26 +1,29 @@
package tdwp_ftw.biomesop.blocks;
import java.util.List;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import net.minecraft.block.Block;
import net.minecraft.block.BlockStairs;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockBOPStairs extends BlockStairs
{
public static enum WoodCategory
{
ACACIA, CHERRY, DARK, FIR, HOLY, MAGIC, MANGROVE, PALM, REDWOOD, WILLOW;
}
private static final String[] woodTypes = new String[] {"acacia", "cherry", "dark", "fir", "holy", "magic", "mangrove", "palm", "redwood", "willow"};
@SideOnly(Side.CLIENT)
private Icon[] textures;
private final WoodCategory category;
public BlockBOPStairs(int blockID, Block model)
public BlockBOPStairs(int blockID, Block model, WoodCategory cat)
{
super(blockID, model, 0);
category = cat;
setBurnProperties(this.blockID, 5, 20);
this.setLightOpacity(0);
this.setCreativeTab(mod_BiomesOPlenty.tabBiomesOPlenty);
@ -40,17 +43,7 @@ public class BlockBOPStairs extends BlockStairs
@SideOnly(Side.CLIENT)
public Icon getBlockTextureFromSideAndMetadata(int side, int meta)
{
if (meta < 0 || meta >= textures.length)
meta = 0;
return textures[meta];
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(int blockID, CreativeTabs creativeTabs, List list) {
for (int i = 0; i < woodTypes.length; ++i)
list.add(new ItemStack(blockID, 1, i));
return textures[category.ordinal()];
}
@Override

View File

@ -11,6 +11,7 @@ import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import tdwp_ftw.biomesop.configuration.BOPBlocks;
@Deprecated
public class BlockCherryLog extends Block
{
/** The type of tree this log came from. */

View File

@ -12,6 +12,7 @@ import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import tdwp_ftw.biomesop.configuration.BOPBlocks;
@Deprecated
public class BlockCherrySlab extends BlockHalfSlab
{
/** The type of tree this slab came from. */

View File

@ -11,6 +11,7 @@ import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import tdwp_ftw.biomesop.configuration.BOPBlocks;
@Deprecated
public class BlockDarkLog extends Block
{
/** The type of tree this log came from. */

View File

@ -12,6 +12,7 @@ import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import tdwp_ftw.biomesop.configuration.BOPBlocks;
@Deprecated
public class BlockDarkSlab extends BlockHalfSlab
{
/** The type of tree this slab came from. */

View File

@ -11,6 +11,7 @@ import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import tdwp_ftw.biomesop.configuration.BOPBlocks;
@Deprecated
public class BlockDeadLog extends Block
{
/** The type of tree this log came from. */

View File

@ -11,6 +11,7 @@ import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import tdwp_ftw.biomesop.configuration.BOPBlocks;
@Deprecated
public class BlockFirLog extends Block
{
/** The type of tree this log came from. */

View File

@ -12,7 +12,7 @@ import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import tdwp_ftw.biomesop.configuration.BOPBlocks;
@Deprecated
public class BlockFirSlab extends BlockHalfSlab
{
/** The type of tree this slab came from. */

View File

@ -11,6 +11,7 @@ import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import tdwp_ftw.biomesop.configuration.BOPBlocks;
@Deprecated
public class BlockHolyLog extends Block
{
/** The type of tree this log came from. */

View File

@ -12,6 +12,7 @@ import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import tdwp_ftw.biomesop.configuration.BOPBlocks;
@Deprecated
public class BlockHolySlab extends BlockHalfSlab
{
/** The type of tree this slab came from. */

View File

@ -11,6 +11,7 @@ import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import tdwp_ftw.biomesop.configuration.BOPBlocks;
@Deprecated
public class BlockMagicLog extends Block
{
/** The type of tree this log came from. */

View File

@ -12,6 +12,7 @@ import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import tdwp_ftw.biomesop.configuration.BOPBlocks;
@Deprecated
public class BlockMagicSlab extends BlockHalfSlab
{
/** The type of tree this slab came from. */

View File

@ -11,6 +11,7 @@ import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import tdwp_ftw.biomesop.configuration.BOPBlocks;
@Deprecated
public class BlockMangroveLog extends Block
{
/** The type of tree this log came from. */

View File

@ -12,6 +12,7 @@ import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import tdwp_ftw.biomesop.configuration.BOPBlocks;
@Deprecated
public class BlockMangroveSlab extends BlockHalfSlab
{
/** The type of tree this slab came from. */

View File

@ -12,6 +12,7 @@ import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import tdwp_ftw.biomesop.configuration.BOPBlocks;
@Deprecated
public class BlockMudBrickSlab extends BlockHalfSlab
{
/** The type of tree this slab came from. */

View File

@ -11,6 +11,7 @@ import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import tdwp_ftw.biomesop.configuration.BOPBlocks;
@Deprecated
public class BlockPalmLog extends Block
{
/** The type of tree this log came from. */

View File

@ -12,6 +12,7 @@ import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import tdwp_ftw.biomesop.configuration.BOPBlocks;
@Deprecated
public class BlockPalmSlab extends BlockHalfSlab
{
/** The type of tree this slab came from. */

View File

@ -12,6 +12,7 @@ import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import tdwp_ftw.biomesop.configuration.BOPBlocks;
@Deprecated
public class BlockRedRockBrickSlab extends BlockHalfSlab
{
/** The type of tree this slab came from. */

View File

@ -12,6 +12,7 @@ import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import tdwp_ftw.biomesop.configuration.BOPBlocks;
@Deprecated
public class BlockRedRockCobbleSlab extends BlockHalfSlab
{
/** The type of tree this slab came from. */

View File

@ -11,6 +11,7 @@ import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import tdwp_ftw.biomesop.configuration.BOPBlocks;
@Deprecated
public class BlockRedwoodLog extends Block
{
/** The type of tree this log came from. */

View File

@ -12,6 +12,7 @@ import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import tdwp_ftw.biomesop.configuration.BOPBlocks;
@Deprecated
public class BlockRedwoodSlab extends BlockHalfSlab
{
/** The type of tree this slab came from. */

View File

@ -11,6 +11,7 @@ import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import tdwp_ftw.biomesop.configuration.BOPBlocks;
@Deprecated
public class BlockWillowLog extends Block
{
/** The type of tree this log came from. */

View File

@ -12,6 +12,7 @@ import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import tdwp_ftw.biomesop.configuration.BOPBlocks;
@Deprecated
public class BlockWillowSlab extends BlockHalfSlab
{
/** The type of tree this slab came from. */

View File

@ -2,15 +2,20 @@ package tdwp_ftw.biomesop.configuration;
import net.minecraft.block.Block;
import net.minecraft.block.BlockHalfSlab;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.oredict.OreDictionary;
import tdwp_ftw.biomesop.blocks.*;
import tdwp_ftw.biomesop.blocks.BlockBOPLog.LogCategory;
import tdwp_ftw.biomesop.blocks.BlockBOPSlab.SlabCategory;
import tdwp_ftw.biomesop.blocks.BlockBOPStairs.WoodCategory;
import tdwp_ftw.biomesop.items.ItemBOPFlower;
import tdwp_ftw.biomesop.items.ItemBOPPlank;
import tdwp_ftw.biomesop.items.ItemBOPSlab;
import tdwp_ftw.biomesop.items.ItemBOPLeaves;
import tdwp_ftw.biomesop.items.ItemBOPLog;
import tdwp_ftw.biomesop.items.ItemBOPColorizedLeaves;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
@ -192,13 +197,31 @@ public class BOPBlocks {
public static Block holyStairs;
// New definitions
// public static Block planks;
// public static Block stairs;
// public static BlockHalfSlab singleSlab;
// public static BlockHalfSlab doubleSlab;
public static Block planks;
public static Block acaciaStairs1;
public static Block cherryStairs1;
public static Block darkStairs1;
public static Block firStairs1;
public static Block holyStairs1;
public static Block magicStairs1;
public static Block mangroveStairs1;
public static Block palmStairs1;
public static Block redwoodStairs1;
public static Block willowStairs1;
public static Block stairs;
public static BlockHalfSlab woodenSingleSlab1;
public static BlockHalfSlab woodenDoubleSlab1;
public static BlockHalfSlab woodenSingleSlab2;
public static BlockHalfSlab woodenDoubleSlab2;
public static BlockHalfSlab stoneSingleSlab;
public static BlockHalfSlab stoneDoubleSlab;
public static Block flowers;
public static Block leaves;
public static Block leavesColorized;
public static Block logs1;
public static Block logs2;
public static Block logs3;
public static void init()
{
@ -375,9 +398,10 @@ public class BOPBlocks {
holyDoubleSlab = (BlockHalfSlab)(new BlockHolySlab(BOPConfiguration.holyDoubleSlabID, true)).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("holySlab");
holySingleSlab = (BlockHalfSlab)(new BlockHolySlab(BOPConfiguration.holySingleSlabID, false)).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("holySlab");
holyStairs = (new BlockHolyStairs(BOPConfiguration.holyStairsID, holyPlank)).setUnlocalizedName("holyStairs");
/*
// Planks condensed into one block
planks = (new BlockBOPPlank(2000)).setResistance(5.0F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("planks");
/*
// Planks - WORKING!
planks = (new BlockBOPPlank(1989)).setResistance(5.0F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("planks");
GameRegistry.registerBlock(planks, ItemBOPPlank.class, "planks");
LanguageRegistry.addName(new ItemStack(planks,1,0), "Acacia Wood Planks");
@ -391,52 +415,95 @@ public class BOPBlocks {
LanguageRegistry.addName(new ItemStack(planks,1,8), "Redwood Wood Planks");
LanguageRegistry.addName(new ItemStack(planks,1,9), "Willow Wood Planks");
doubleSlab = (BlockHalfSlab)(new BlockBOPSlab(2003, true)).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("slab");
singleSlab = (BlockHalfSlab)(new BlockBOPSlab(2002, false)).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("slab");
ItemBOPSlab.setSlabs(singleSlab, doubleSlab);
// Stairs - Almost working - need to fix displayed name. Stairs can't be compressed
acaciaStairs1 = (new BlockBOPStairs(1990, planks, WoodCategory.ACACIA)).setUnlocalizedName("acaciaStairs");
cherryStairs1 = (new BlockBOPStairs(1991, planks, WoodCategory.CHERRY)).setUnlocalizedName("cherryStairs");
darkStairs1 = (new BlockBOPStairs(1992, planks, WoodCategory.DARK)).setUnlocalizedName("darkStairs");
firStairs1 = (new BlockBOPStairs(1993, planks, WoodCategory.FIR)).setUnlocalizedName("firStairs");
holyStairs1 = (new BlockBOPStairs(1994, planks, WoodCategory.HOLY)).setUnlocalizedName("holyStairs");
magicStairs1 = (new BlockBOPStairs(1995, planks, WoodCategory.MAGIC)).setUnlocalizedName("magicStairs");
mangroveStairs1 = (new BlockBOPStairs(1996, planks, WoodCategory.MANGROVE)).setUnlocalizedName("mangroveStairs");
palmStairs1 = (new BlockBOPStairs(1997, planks, WoodCategory.PALM)).setUnlocalizedName("palmStairs");
redwoodStairs1 = (new BlockBOPStairs(1998, planks, WoodCategory.REDWOOD)).setUnlocalizedName("redwoodStairs");
willowStairs1 = (new BlockBOPStairs(1999, planks, WoodCategory.WILLOW)).setUnlocalizedName("willowStairs");
// Slabs condensed - almost working, need to divide
GameRegistry.registerBlock(doubleSlab, ItemBOPSlab.class, "doubleSlab");
GameRegistry.registerBlock(singleSlab, ItemBOPSlab.class, "singleSlab");
GameRegistry.registerBlock(acaciaStairs1, ItemBOPPlank.class, "acaciaStairs1");
GameRegistry.registerBlock(cherryStairs1, ItemBOPPlank.class, "cherryStairs1");
GameRegistry.registerBlock(darkStairs1, ItemBOPPlank.class, "darkStairs1");
GameRegistry.registerBlock(firStairs1, ItemBOPPlank.class, "firStairs1");
GameRegistry.registerBlock(holyStairs1, ItemBOPPlank.class, "holyStairs1");
GameRegistry.registerBlock(magicStairs1, ItemBOPPlank.class, "magicStairs1");
GameRegistry.registerBlock(mangroveStairs1, ItemBOPPlank.class, "mangroveStairs1");
GameRegistry.registerBlock(palmStairs1, ItemBOPPlank.class, "palmStairs1");
GameRegistry.registerBlock(redwoodStairs1, ItemBOPPlank.class, "redwoodStairs1");
GameRegistry.registerBlock(willowStairs1, ItemBOPPlank.class, "stairs1");
LanguageRegistry.addName(new ItemStack(doubleSlab,1,0), "Acacia Wood Slab");
LanguageRegistry.addName(new ItemStack(doubleSlab,1,1), "Cherry Wood Slab");
LanguageRegistry.addName(new ItemStack(doubleSlab,1,2), "Dark Wood Slab");
LanguageRegistry.addName(new ItemStack(doubleSlab,1,3), "Fir Wood Slab");
LanguageRegistry.addName(new ItemStack(doubleSlab,1,4), "Holy Wood Slab");
LanguageRegistry.addName(new ItemStack(doubleSlab,1,5), "Magic Wood Slab");
LanguageRegistry.addName(new ItemStack(doubleSlab,1,6), "Mangrove Wood Slab");
LanguageRegistry.addName(new ItemStack(doubleSlab,1,7), "Palm Wood Slab");
LanguageRegistry.addName(new ItemStack(doubleSlab,1,8), "Redwood Wood Slab");
LanguageRegistry.addName(new ItemStack(doubleSlab,1,9), "Willow Wood Slab");
LanguageRegistry.addName(new ItemStack(singleSlab,1,0), "Acacia Wood Slab");
LanguageRegistry.addName(new ItemStack(singleSlab,1,1), "Cherry Wood Slab");
LanguageRegistry.addName(new ItemStack(singleSlab,1,2), "Dark Wood Slab");
LanguageRegistry.addName(new ItemStack(singleSlab,1,3), "Fir Wood Slab");
LanguageRegistry.addName(new ItemStack(singleSlab,1,4), "Holy Wood Slab");
LanguageRegistry.addName(new ItemStack(singleSlab,1,5), "Magic Wood Slab");
LanguageRegistry.addName(new ItemStack(singleSlab,1,6), "Mangrove Wood Slab");
LanguageRegistry.addName(new ItemStack(singleSlab,1,7), "Palm Wood Slab");
LanguageRegistry.addName(new ItemStack(singleSlab,1,8), "Redwood Wood Slab");
LanguageRegistry.addName(new ItemStack(singleSlab,1,9), "Willow Wood Slab");
/*Stairs condensed into one block - NOT WORKING
stairs = (new BlockBOPStairs(2001, planks)).setUnlocalizedName("stairs");
GameRegistry.registerBlock(stairs, ItemBOPPlank.class, "stairs");
LanguageRegistry.addName(new ItemStack(stairs,1,0), "Acacia Wood Stairs");
LanguageRegistry.addName(new ItemStack(stairs,1,1), "Cherry Wood Stairs");
LanguageRegistry.addName(new ItemStack(stairs,1,2), "Dark Wood Stairs");
LanguageRegistry.addName(new ItemStack(stairs,1,3), "Fir Wood Stairs");
LanguageRegistry.addName(new ItemStack(stairs,1,4), "Holy Wood Stairs");
LanguageRegistry.addName(new ItemStack(stairs,1,5), "Magic Wood Stairs");
LanguageRegistry.addName(new ItemStack(stairs,1,6), "Mangrove Wood Stairs");
LanguageRegistry.addName(new ItemStack(stairs,1,7), "Palm Wood Stairs");
LanguageRegistry.addName(new ItemStack(stairs,1,8), "Redwood Wood Stairs");
LanguageRegistry.addName(new ItemStack(stairs,1,9), "Willow Wood Stairs");
LanguageRegistry.addName(acaciaStairs1, "Acacia Wood Stairs");
LanguageRegistry.addName(cherryStairs1, "Cherry Wood Stairs");
LanguageRegistry.addName(darkStairs1, "Dark Wood Stairs");
LanguageRegistry.addName(firStairs1, "Fir Wood Stairs");
LanguageRegistry.addName(holyStairs1, "Holy Wood Stairs");
LanguageRegistry.addName(magicStairs1, "Magic Wood Stairs");
LanguageRegistry.addName(mangroveStairs1, "Mangrove Wood Stairs");
LanguageRegistry.addName(palmStairs1, "Palm Wood Stairs");
LanguageRegistry.addName(redwoodStairs1, "Redwood Wood Stairs");
LanguageRegistry.addName(willowStairs1, "Willow Wood Stairs");
// Flowers - mostly working, missing glow on Glowflower
woodenDoubleSlab1 = (BlockHalfSlab)(new BlockBOPSlab(2007, true, Material.wood, SlabCategory.WOOD1)).setUnlocalizedName("woodenDoubleSlab1");
woodenSingleSlab1 = (BlockHalfSlab)(new BlockBOPSlab(2006, false, Material.wood, SlabCategory.WOOD1)).setUnlocalizedName("woodenSingleSlab1");
ItemBOPSlab.setSlabs(woodenSingleSlab1, woodenDoubleSlab1);
// Slabs - WORKING!
GameRegistry.registerBlock(woodenDoubleSlab1, ItemBOPSlab.class, "woodenDoubleSlab1");
GameRegistry.registerBlock(woodenSingleSlab1, ItemBOPSlab.class, "woodenSingleSlab1");
LanguageRegistry.addName(new ItemStack(woodenDoubleSlab1,1,0), "Acacia Wood Slab");
LanguageRegistry.addName(new ItemStack(woodenDoubleSlab1,1,1), "Cherry Wood Slab");
LanguageRegistry.addName(new ItemStack(woodenDoubleSlab1,1,2), "Dark Wood Slab");
LanguageRegistry.addName(new ItemStack(woodenDoubleSlab1,1,3), "Fir Wood Slab");
LanguageRegistry.addName(new ItemStack(woodenDoubleSlab1,1,4), "Holy Wood Slab");
LanguageRegistry.addName(new ItemStack(woodenDoubleSlab1,1,5), "Magic Wood Slab");
LanguageRegistry.addName(new ItemStack(woodenDoubleSlab1,1,6), "Mangrove Wood Slab");
LanguageRegistry.addName(new ItemStack(woodenDoubleSlab1,1,7), "Palm Wood Slab");
LanguageRegistry.addName(new ItemStack(woodenSingleSlab1,1,0), "Acacia Wood Slab");
LanguageRegistry.addName(new ItemStack(woodenSingleSlab1,1,1), "Cherry Wood Slab");
LanguageRegistry.addName(new ItemStack(woodenSingleSlab1,1,2), "Dark Wood Slab");
LanguageRegistry.addName(new ItemStack(woodenSingleSlab1,1,3), "Fir Wood Slab");
LanguageRegistry.addName(new ItemStack(woodenSingleSlab1,1,4), "Holy Wood Slab");
LanguageRegistry.addName(new ItemStack(woodenSingleSlab1,1,5), "Magic Wood Slab");
LanguageRegistry.addName(new ItemStack(woodenSingleSlab1,1,6), "Mangrove Wood Slab");
LanguageRegistry.addName(new ItemStack(woodenSingleSlab1,1,7), "Palm Wood Slab");
woodenDoubleSlab2 = (BlockHalfSlab)(new BlockBOPSlab(2009, true, Material.wood, SlabCategory.WOOD2)).setUnlocalizedName("woodenDoubleSlab2");
woodenSingleSlab2 = (BlockHalfSlab)(new BlockBOPSlab(2008, false, Material.wood, SlabCategory.WOOD2)).setUnlocalizedName("woodenSingleSlab2");
ItemBOPSlab.setSlabs(woodenSingleSlab2, woodenDoubleSlab2);
GameRegistry.registerBlock(woodenDoubleSlab2, ItemBOPSlab.class, "woodenDoubleSlab2");
GameRegistry.registerBlock(woodenSingleSlab2, ItemBOPSlab.class, "woodenSingleSlab2");
LanguageRegistry.addName(new ItemStack(woodenDoubleSlab2,1,0), "Redwood Wood Slab");
LanguageRegistry.addName(new ItemStack(woodenDoubleSlab2,1,1), "Willow Wood Slab");
LanguageRegistry.addName(new ItemStack(woodenSingleSlab2,1,0), "Redwood Wood Slab");
LanguageRegistry.addName(new ItemStack(woodenSingleSlab2,1,1), "Willow Wood Slab");
stoneDoubleSlab = (BlockHalfSlab)(new BlockBOPSlab(2011, true, Material.rock, SlabCategory.STONE)).setUnlocalizedName("stoneDoubleSlab");
stoneSingleSlab = (BlockHalfSlab)(new BlockBOPSlab(2010, false, Material.rock, SlabCategory.STONE)).setUnlocalizedName("stoneSingleSlab");
ItemBOPSlab.setSlabs(stoneSingleSlab, stoneDoubleSlab);
GameRegistry.registerBlock(stoneDoubleSlab, ItemBOPSlab.class, "stoneDoubleSlab2");
GameRegistry.registerBlock(stoneSingleSlab, ItemBOPSlab.class, "stoneSingleSlab");
LanguageRegistry.addName(new ItemStack(stoneDoubleSlab,1,0), "Red Rock Bricks Slab");
LanguageRegistry.addName(new ItemStack(stoneDoubleSlab,1,1), "Red Rock Cobblestone Slab");
LanguageRegistry.addName(new ItemStack(stoneDoubleSlab,1,2), "Mud Bricks Slab");
LanguageRegistry.addName(new ItemStack(stoneSingleSlab,1,0), "Red Rock Bricks Slab");
LanguageRegistry.addName(new ItemStack(stoneSingleSlab,1,1), "Red Rock Cobblestone Slab");
LanguageRegistry.addName(new ItemStack(stoneSingleSlab,1,2), "Mud Bricks Slab");
// Flowers - WORKING!
flowers = (new BlockBOPFlower(2002)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("flowers");
GameRegistry.registerBlock(flowers, ItemBOPFlower.class, "flowers");
@ -476,8 +543,29 @@ public class BOPBlocks {
LanguageRegistry.addName(new ItemStack(leavesColorized,1,2), "Palm Leaves");
LanguageRegistry.addName(new ItemStack(leavesColorized,1,3), "Redwood Leaves");
LanguageRegistry.addName(new ItemStack(leavesColorized,1,4), "Willow Leaves");
*/
// Logs - WORKING!
logs1 = (new BlockBOPLog(2003,LogCategory.CAT1)).setUnlocalizedName("wood1");
logs2 = (new BlockBOPLog(2004,LogCategory.CAT2)).setUnlocalizedName("wood2");
logs3 = (new BlockBOPLog(2005,LogCategory.CAT3)).setUnlocalizedName("wood3");
GameRegistry.registerBlock(logs1, ItemBOPLog.class, "wood1");
GameRegistry.registerBlock(logs2, ItemBOPLog.class, "wood2");
GameRegistry.registerBlock(logs3, ItemBOPLog.class, "wood3");
LanguageRegistry.addName(new ItemStack(logs1,1,0), "Acacia Woods");
LanguageRegistry.addName(new ItemStack(logs1,1,1), "Cherry Wood");
LanguageRegistry.addName(new ItemStack(logs1,1,2), "Dark Wood");
LanguageRegistry.addName(new ItemStack(logs1,1,3), "Fir Wood");
LanguageRegistry.addName(new ItemStack(logs2,1,0), "Holy Wood");
LanguageRegistry.addName(new ItemStack(logs2,1,1), "Magic Wood");
LanguageRegistry.addName(new ItemStack(logs2,1,2), "Mangrove Wood");
LanguageRegistry.addName(new ItemStack(logs2,1,3), "Palm Wood");
LanguageRegistry.addName(new ItemStack(logs3,1,0), "Redwood Wood");
LanguageRegistry.addName(new ItemStack(logs3,1,1), "Willow Wood");
LanguageRegistry.addName(new ItemStack(logs3,1,2), "Dead Wood");
*/
// Add block registration
GameRegistry.registerBlock(mud, "mud");

View File

@ -0,0 +1,31 @@
package tdwp_ftw.biomesop.items;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import tdwp_ftw.biomesop.blocks.BlockBOPLog;
public class ItemBOPLog extends ItemBlock
{
private static final String[] woodTypes = new String[] {"acacia", "cherry", "dark", "fir", "holy", "magic", "mangrove", "palm", "redwood", "willow", "dead"};
public ItemBOPLog(int par1)
{
super(par1);
setMaxDamage(0);
setHasSubtypes(true);
}
@Override
public int getMetadata(int meta)
{
return meta;
}
@Override
public String getUnlocalizedName(ItemStack itemStack)
{
BlockBOPLog wood = (BlockBOPLog)Block.blocksList[itemStack.itemID];
return (new StringBuilder()).append(woodTypes[wood.getWoodType(itemStack.getItemDamage())]).append("Wood").toString();
}
}

View File

@ -1,14 +1,15 @@
package tdwp_ftw.biomesop.items;
import net.minecraft.block.Block;
import net.minecraft.block.BlockHalfSlab;
import net.minecraft.item.ItemSlab;
import net.minecraft.item.ItemStack;
import tdwp_ftw.biomesop.blocks.BlockBOPSlab;
import com.google.common.base.Optional;
public class ItemBOPSlab extends ItemSlab
{
private static final String[] woodTypes = new String[] {"acacia", "cherry", "dark", "fir", "holy", "magic", "mangrove", "palm", "redwood", "willow"};
private static Optional<BlockHalfSlab> singleSlab = Optional.absent();
private static Optional<BlockHalfSlab> doubleSlab = Optional.absent();
@ -30,7 +31,7 @@ public class ItemBOPSlab extends ItemSlab
@Override
public String getUnlocalizedName(ItemStack itemStack) {
return itemStack.getItem().getUnlocalizedName();
// return (new StringBuilder()).append(woodTypes[itemStack.getItemDamage()]).append("Slab").toString();
BlockBOPSlab slab = (BlockBOPSlab)Block.blocksList[itemStack.itemID];
return (new StringBuilder()).append(slab.getFullSlabName(itemStack.getItemDamage())).toString();
}
}