diff --git a/src/minecraft/biomesoplenty/api/Blocks.java b/src/minecraft/biomesoplenty/api/Blocks.java index 5b63ca209..8dc446367 100644 --- a/src/minecraft/biomesoplenty/api/Blocks.java +++ b/src/minecraft/biomesoplenty/api/Blocks.java @@ -7,7 +7,27 @@ import net.minecraft.block.BlockHalfSlab; public class Blocks { + // Worldgen Blocks + public static Optional ash = Optional.absent(); + public static Optional ashStone = Optional.absent(); + public static Optional cragRock = Optional.absent(); + public static Optional driedDirt = Optional.absent(); + public static Optional hardDirt = Optional.absent(); + public static Optional hardIce = Optional.absent(); + public static Optional hardSand = Optional.absent(); + public static Optional holyGrass = Optional.absent(); + public static Optional holyStone = Optional.absent(); + public static Optional mud = Optional.absent(); + public static Optional originGrass = Optional.absent(); + public static Optional redRock = Optional.absent(); + + // Planks and logs public static Optional planks = Optional.absent(); + public static Optional logs1 = Optional.absent(); + public static Optional logs2 = Optional.absent(); + public static Optional logs3 = Optional.absent(); + + // Stairs public static Optional acaciaStairs = Optional.absent(); public static Optional cherryStairs = Optional.absent(); public static Optional darkStairs = Optional.absent(); @@ -19,18 +39,20 @@ public class Blocks public static Optional redwoodStairs = Optional.absent(); public static Optional willowStairs = Optional.absent(); + // Slabs public static Optional woodenSingleSlab1 = Optional.absent(); public static Optional woodenDoubleSlab1 = Optional.absent(); public static Optional woodenSingleSlab2 = Optional.absent(); public static Optional woodenDoubleSlab2 = Optional.absent(); public static Optional stoneSingleSlab = Optional.absent(); public static Optional stoneDoubleSlab = Optional.absent(); + + // Plants public static Optional flowers = Optional.absent(); public static Optional leaves = Optional.absent(); public static Optional leavesColorized = Optional.absent(); - public static Optional logs1 = Optional.absent(); - public static Optional logs2 = Optional.absent(); - public static Optional logs3 = Optional.absent(); public static Optional foliage = Optional.absent(); public static Optional plants = Optional.absent(); + public static Optional saplings = Optional.absent(); + public static Optional colorizedSaplings = Optional.absent(); } diff --git a/src/minecraft/biomesoplenty/blocks/BlockAcaciaSapling.java b/src/minecraft/biomesoplenty/blocks/BlockAcaciaSapling.java index 33c8e9d36..a567580e6 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockAcaciaSapling.java +++ b/src/minecraft/biomesoplenty/blocks/BlockAcaciaSapling.java @@ -14,6 +14,7 @@ import net.minecraft.util.Icon; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; +@Deprecated public class BlockAcaciaSapling extends BlockSapling { public static final String[] WOOD_TYPES = new String[] {"acacia"}; diff --git a/src/minecraft/biomesoplenty/blocks/BlockBOPColorizedLeaves.java b/src/minecraft/biomesoplenty/blocks/BlockBOPColorizedLeaves.java index 1b4f92bd1..9f2c90b3c 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockBOPColorizedLeaves.java +++ b/src/minecraft/biomesoplenty/blocks/BlockBOPColorizedLeaves.java @@ -4,13 +4,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Random; -import biomesoplenty.mod_BiomesOPlenty; -import biomesoplenty.configuration.BOPBlocks; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - - import net.minecraft.block.BlockLeavesBase; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; @@ -21,6 +14,10 @@ import net.minecraft.world.ColorizerFoliage; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.IShearable; +import biomesoplenty.mod_BiomesOPlenty; +import biomesoplenty.api.Blocks; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; public class BlockBOPColorizedLeaves extends BlockLeavesBase implements IShearable { @@ -108,7 +105,7 @@ public class BlockBOPColorizedLeaves extends BlockLeavesBase implements IShearab @Override public int idDropped(int par1, Random par2Random, int par3) { - return BOPBlocks.yellowSapling.blockID; + return Blocks.colorizedSaplings.get().blockID; } @Override @@ -117,6 +114,12 @@ public class BlockBOPColorizedLeaves extends BlockLeavesBase implements IShearab return meta & textures[0].length; } + @Override + public int quantityDropped(Random random) + { + return random.nextInt(20) == 0 ? 1 : 0; + } + @Override public boolean isShearable(ItemStack item, World world, int x, int y, int z) { @@ -127,7 +130,7 @@ public class BlockBOPColorizedLeaves extends BlockLeavesBase implements IShearab public ArrayList onSheared(ItemStack item, World world, int x, int y, int z, int fortune) { ArrayList ret = new ArrayList(); - ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3)); + ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 15)); return ret; } } diff --git a/src/minecraft/biomesoplenty/blocks/BlockBOPColorizedSapling.java b/src/minecraft/biomesoplenty/blocks/BlockBOPColorizedSapling.java new file mode 100644 index 000000000..89332816c --- /dev/null +++ b/src/minecraft/biomesoplenty/blocks/BlockBOPColorizedSapling.java @@ -0,0 +1,139 @@ +package biomesoplenty.blocks; + +import java.util.List; +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockSapling; +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 net.minecraft.world.gen.feature.WorldGenerator; +import biomesoplenty.mod_BiomesOPlenty; +import biomesoplenty.worldgen.WorldGenAcacia; +import biomesoplenty.worldgen.WorldGenAutumn; +import biomesoplenty.worldgen.WorldGenAutumn2; +import biomesoplenty.worldgen.WorldGenBambooTree; +import biomesoplenty.worldgen.WorldGenBambooTree2; +import biomesoplenty.worldgen.WorldGenCherry1; +import biomesoplenty.worldgen.WorldGenCherry2; +import biomesoplenty.worldgen.WorldGenDeadTree2; +import biomesoplenty.worldgen.WorldGenMangrove; +import biomesoplenty.worldgen.WorldGenMaple; +import biomesoplenty.worldgen.WorldGenMystic2; +import biomesoplenty.worldgen.WorldGenOminous1; +import biomesoplenty.worldgen.WorldGenOminous2; +import biomesoplenty.worldgen.WorldGenOriginTree; +import biomesoplenty.worldgen.WorldGenPalmTree1; +import biomesoplenty.worldgen.WorldGenPalmTree3; +import biomesoplenty.worldgen.WorldGenPromisedTree; +import biomesoplenty.worldgen.WorldGenRedwoodTree2; +import biomesoplenty.worldgen.WorldGenTaiga9; +import biomesoplenty.worldgen.WorldGenWillow; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class BlockBOPColorizedSapling extends BlockSapling +{ + private static final String[] saplings = new String[] {"acacia", "mangrove", "palm", "redwood", "willow"}; + @SideOnly(Side.CLIENT) + private Icon[] textures; + private static final int TYPES = 15; + + public BlockBOPColorizedSapling(int par1) + { + super(par1); + setHardness(0.0F); + setStepSound(Block.soundGrassFootstep); + this.setCreativeTab(mod_BiomesOPlenty.tabBiomesOPlenty); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IconRegister iconRegister) + { + textures = new Icon[saplings.length]; + + for (int i = 0; i < saplings.length; ++i) + textures[i] = iconRegister.registerIcon("BiomesOPlenty:" + saplings[i] + "sapling"); + + } + + @Override + @SideOnly(Side.CLIENT) + public Icon getBlockTextureFromSideAndMetadata(int side, int meta) + { + if (meta < 0 || meta >= saplings.length) + meta = 0; + + return textures[meta]; + } + + @Override + @SideOnly(Side.CLIENT) + public void getSubBlocks(int blockID, CreativeTabs creativeTabs, List list) { + for (int i = 0; i < saplings.length; ++i) + list.add(new ItemStack(blockID, 1, i)); + } + + @Override + public void growTree(World world, int x, int y, int z, Random random) + { + int meta = world.getBlockMetadata(x, y, z) & TYPES; + Object obj = null; + int rnd = random.nextInt(8); + + if (obj == null) + { + switch (meta) + { + case 0: // Acacia Tree + obj = new WorldGenAcacia(false); + break; + + case 1: // Mangrove Tree + obj = new WorldGenMangrove(false); + break; + + case 2: // Palm Tree + rnd = random.nextInt(4); + + if (rnd == 0) + obj = new WorldGenPalmTree1(); + else + obj = new WorldGenPalmTree3(); + break; + + case 3: // Redwood Tree + obj = new WorldGenRedwoodTree2(false); + break; + + case 4: // Willow Tree + obj = new WorldGenWillow(); + break; + } + } + + if (obj != null) + { + world.setBlockToAir(x, y, z); + + if (!((WorldGenerator)obj).generate(world, random, x, y, z)) + world.setBlock(x, y, z, this.blockID, meta, 2); + } + } + + @Override + public int damageDropped(int meta) + { + return meta & TYPES; + } + + @Override + public int getDamageValue(World world, int x, int y, int z) + { + return world.getBlockMetadata(x, y, z) & TYPES; + } +} diff --git a/src/minecraft/biomesoplenty/blocks/BlockBOPFlower.java b/src/minecraft/biomesoplenty/blocks/BlockBOPFlower.java index 57fe7a1bb..dbdf10282 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockBOPFlower.java +++ b/src/minecraft/biomesoplenty/blocks/BlockBOPFlower.java @@ -86,6 +86,6 @@ public class BlockBOPFlower extends BlockFlower @Override public int damageDropped(int meta) { - return meta; + return meta & 15; } } diff --git a/src/minecraft/biomesoplenty/blocks/BlockBOPFoliage.java b/src/minecraft/biomesoplenty/blocks/BlockBOPFoliage.java index 8565d653b..3e3a5ae50 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockBOPFoliage.java +++ b/src/minecraft/biomesoplenty/blocks/BlockBOPFoliage.java @@ -55,9 +55,7 @@ public class BlockBOPFoliage extends BlockFlower implements IShearable public Icon getBlockTextureFromSideAndMetadata(int side, int meta) { if (meta >= textures.length) - { meta = 0; - } return textures[meta]; } diff --git a/src/minecraft/biomesoplenty/blocks/BlockBOPLeaves.java b/src/minecraft/biomesoplenty/blocks/BlockBOPLeaves.java index 3984df580..1b3781b41 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockBOPLeaves.java +++ b/src/minecraft/biomesoplenty/blocks/BlockBOPLeaves.java @@ -5,6 +5,7 @@ import java.util.List; import java.util.Random; import biomesoplenty.mod_BiomesOPlenty; +import biomesoplenty.api.Blocks; import biomesoplenty.configuration.BOPBlocks; import cpw.mods.fml.relauncher.Side; @@ -67,7 +68,7 @@ public class BlockBOPLeaves extends BlockLeavesBase implements IShearable @Override public int idDropped(int par1, Random par2Random, int par3) { - return BOPBlocks.yellowSapling.blockID; + return Blocks.saplings.get().blockID; } @Override @@ -76,6 +77,12 @@ public class BlockBOPLeaves extends BlockLeavesBase implements IShearable return meta & textures[0].length; } + @Override + public int quantityDropped(Random random) + { + return random.nextInt(20) == 0 ? 1 : 0; + } + @Override public boolean isShearable(ItemStack item, World world, int x, int y, int z) { @@ -86,7 +93,7 @@ public class BlockBOPLeaves extends BlockLeavesBase implements IShearable public ArrayList onSheared(ItemStack item, World world, int x, int y, int z, int fortune) { ArrayList ret = new ArrayList(); - ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3)); + ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 15)); return ret; } } diff --git a/src/minecraft/biomesoplenty/blocks/BlockBOPSapling.java b/src/minecraft/biomesoplenty/blocks/BlockBOPSapling.java new file mode 100644 index 000000000..600fc57f4 --- /dev/null +++ b/src/minecraft/biomesoplenty/blocks/BlockBOPSapling.java @@ -0,0 +1,166 @@ +package biomesoplenty.blocks; + +import java.util.List; +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockSapling; +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 net.minecraft.world.gen.feature.WorldGenerator; +import biomesoplenty.mod_BiomesOPlenty; +import biomesoplenty.worldgen.WorldGenAutumn; +import biomesoplenty.worldgen.WorldGenAutumn2; +import biomesoplenty.worldgen.WorldGenBambooTree; +import biomesoplenty.worldgen.WorldGenBambooTree2; +import biomesoplenty.worldgen.WorldGenCherry1; +import biomesoplenty.worldgen.WorldGenCherry2; +import biomesoplenty.worldgen.WorldGenDeadTree2; +import biomesoplenty.worldgen.WorldGenMaple; +import biomesoplenty.worldgen.WorldGenMystic2; +import biomesoplenty.worldgen.WorldGenOminous1; +import biomesoplenty.worldgen.WorldGenOminous2; +import biomesoplenty.worldgen.WorldGenOriginTree; +import biomesoplenty.worldgen.WorldGenPromisedTree; +import biomesoplenty.worldgen.WorldGenTaiga9; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class BlockBOPSapling extends BlockSapling +{ + private static final String[] saplings = new String[] {"yellow", "bamboo", "magic", "dark", "brown", "fir", "holy", "orange", "origin", "pink", "red", "white"}; + @SideOnly(Side.CLIENT) + private Icon[] textures; + private static final int TYPES = 15; + + public BlockBOPSapling(int par1) + { + super(par1); + setHardness(0.0F); + setStepSound(Block.soundGrassFootstep); + this.setCreativeTab(mod_BiomesOPlenty.tabBiomesOPlenty); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IconRegister iconRegister) + { + textures = new Icon[saplings.length]; + + for (int i = 0; i < saplings.length; ++i) + textures[i] = iconRegister.registerIcon("BiomesOPlenty:" + saplings[i] + "sapling"); + + } + + @Override + @SideOnly(Side.CLIENT) + public Icon getBlockTextureFromSideAndMetadata(int side, int meta) + { + if (meta < 0 || meta >= saplings.length) + meta = 0; + + return textures[meta]; + } + + @Override + @SideOnly(Side.CLIENT) + public void getSubBlocks(int blockID, CreativeTabs creativeTabs, List list) { + for (int i = 0; i < saplings.length; ++i) + list.add(new ItemStack(blockID, 1, i)); + } + + @Override + public void growTree(World world, int x, int y, int z, Random random) + { + int meta = world.getBlockMetadata(x, y, z) & TYPES; + Object obj = null; + int rnd = random.nextInt(8); + + if (obj == null) + { + switch (meta) + { + case 0: // Autumn Tree + obj = new WorldGenAutumn(false); + break; + + case 1: // Bamboo Tree + rnd = random.nextInt(8); + + if (rnd == 0) + obj = new WorldGenBambooTree(false); + else + obj = new WorldGenBambooTree2(false); + break; + + case 2: // Magic Tree + obj = new WorldGenMystic2(false); + break; + + case 3: // Dark Tree + rnd = random.nextInt(8); + + if (rnd == 0) + obj = new WorldGenOminous2(); + else + obj = new WorldGenOminous1(false); + break; + + case 4: // Dead Tree + obj = new WorldGenDeadTree2(false); + break; + + case 5: // Fir Tree + obj = new WorldGenTaiga9(false); + break; + + case 6: // Holy Tree + obj = new WorldGenPromisedTree(false); + break; + + case 7: // Autumn Tree + obj = new WorldGenAutumn2(false); + break; + + case 8: // Origin Tree + obj = new WorldGenOriginTree(false); + break; + + case 9: // Pink Cherry Tree + obj = new WorldGenCherry1(false); + break; + + case 10: // Maple Tree + obj = new WorldGenMaple(false); + break; + + case 11: // White Cherry Tree + obj = new WorldGenCherry2(false); + break; + } + } + + if (obj != null) + { + world.setBlockToAir(x, y, z); + + if (!((WorldGenerator)obj).generate(world, random, x, y, z)) + world.setBlock(x, y, z, this.blockID, meta, 2); + } + } + + @Override + public int damageDropped(int meta) + { + return meta & TYPES; + } + + @Override + public int getDamageValue(World world, int x, int y, int z) + { + return world.getBlockMetadata(x, y, z) & TYPES; + } +} diff --git a/src/minecraft/biomesoplenty/blocks/BlockBambooSapling.java b/src/minecraft/biomesoplenty/blocks/BlockBambooSapling.java index b835ea1d1..aca52f4ca 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockBambooSapling.java +++ b/src/minecraft/biomesoplenty/blocks/BlockBambooSapling.java @@ -16,6 +16,7 @@ import net.minecraft.util.Icon; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; +@Deprecated public class BlockBambooSapling extends BlockSapling { public static final String[] WOOD_TYPES = new String[] {"dark"}; diff --git a/src/minecraft/biomesoplenty/blocks/BlockBrownSapling.java b/src/minecraft/biomesoplenty/blocks/BlockBrownSapling.java index 13c351ae8..8ac7d776a 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockBrownSapling.java +++ b/src/minecraft/biomesoplenty/blocks/BlockBrownSapling.java @@ -14,6 +14,7 @@ import net.minecraft.util.Icon; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; +@Deprecated public class BlockBrownSapling extends BlockSapling { public static final String[] WOOD_TYPES = new String[] {"brown"}; diff --git a/src/minecraft/biomesoplenty/blocks/BlockDarkSapling.java b/src/minecraft/biomesoplenty/blocks/BlockDarkSapling.java index 7fb4c96cd..409c40fea 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockDarkSapling.java +++ b/src/minecraft/biomesoplenty/blocks/BlockDarkSapling.java @@ -15,6 +15,7 @@ import net.minecraft.util.Icon; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; +@Deprecated public class BlockDarkSapling extends BlockSapling { public static final String[] WOOD_TYPES = new String[] {"dark"}; diff --git a/src/minecraft/biomesoplenty/blocks/BlockFirSapling.java b/src/minecraft/biomesoplenty/blocks/BlockFirSapling.java index d2e076798..ea3e0fd3a 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockFirSapling.java +++ b/src/minecraft/biomesoplenty/blocks/BlockFirSapling.java @@ -14,6 +14,7 @@ import net.minecraft.util.Icon; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; +@Deprecated public class BlockFirSapling extends BlockSapling { public static final String[] WOOD_TYPES = new String[] {"fir"}; diff --git a/src/minecraft/biomesoplenty/blocks/BlockHolySapling.java b/src/minecraft/biomesoplenty/blocks/BlockHolySapling.java index 8f34d2539..bbf474e19 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockHolySapling.java +++ b/src/minecraft/biomesoplenty/blocks/BlockHolySapling.java @@ -16,6 +16,7 @@ import net.minecraft.util.Icon; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; +@Deprecated public class BlockHolySapling extends BlockSapling { public static final String[] WOOD_TYPES = new String[] {"holy"}; diff --git a/src/minecraft/biomesoplenty/blocks/BlockMagicSapling.java b/src/minecraft/biomesoplenty/blocks/BlockMagicSapling.java index cfe23836f..433e17c94 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockMagicSapling.java +++ b/src/minecraft/biomesoplenty/blocks/BlockMagicSapling.java @@ -16,6 +16,7 @@ import net.minecraft.util.Icon; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; +@Deprecated public class BlockMagicSapling extends BlockSapling { public static final String[] WOOD_TYPES = new String[] {"magic"}; diff --git a/src/minecraft/biomesoplenty/blocks/BlockMangroveSapling.java b/src/minecraft/biomesoplenty/blocks/BlockMangroveSapling.java index 02c64392a..a87160263 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockMangroveSapling.java +++ b/src/minecraft/biomesoplenty/blocks/BlockMangroveSapling.java @@ -15,6 +15,7 @@ import net.minecraft.util.Icon; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; +@Deprecated public class BlockMangroveSapling extends BlockSapling { public static final String[] WOOD_TYPES = new String[] {"mangrove"}; diff --git a/src/minecraft/biomesoplenty/blocks/BlockOrangeSapling.java b/src/minecraft/biomesoplenty/blocks/BlockOrangeSapling.java index 5cceb6e5e..5510a9d66 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockOrangeSapling.java +++ b/src/minecraft/biomesoplenty/blocks/BlockOrangeSapling.java @@ -14,6 +14,7 @@ import net.minecraft.util.Icon; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; +@Deprecated public class BlockOrangeSapling extends BlockSapling { public static final String[] WOOD_TYPES = new String[] {"orange"}; diff --git a/src/minecraft/biomesoplenty/blocks/BlockOriginSapling.java b/src/minecraft/biomesoplenty/blocks/BlockOriginSapling.java index 5b13c5e57..bdbbfe47a 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockOriginSapling.java +++ b/src/minecraft/biomesoplenty/blocks/BlockOriginSapling.java @@ -16,6 +16,7 @@ import net.minecraft.util.Icon; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; +@Deprecated public class BlockOriginSapling extends BlockSapling { public static final String[] WOOD_TYPES = new String[] {"origin"}; diff --git a/src/minecraft/biomesoplenty/blocks/BlockPalmSapling.java b/src/minecraft/biomesoplenty/blocks/BlockPalmSapling.java index ccd409cb0..f43647828 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockPalmSapling.java +++ b/src/minecraft/biomesoplenty/blocks/BlockPalmSapling.java @@ -15,6 +15,7 @@ import net.minecraft.util.Icon; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; +@Deprecated public class BlockPalmSapling extends BlockSapling { public static final String[] WOOD_TYPES = new String[] {"palm"}; diff --git a/src/minecraft/biomesoplenty/blocks/BlockPinkSapling.java b/src/minecraft/biomesoplenty/blocks/BlockPinkSapling.java index 5995b7773..26a2c616f 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockPinkSapling.java +++ b/src/minecraft/biomesoplenty/blocks/BlockPinkSapling.java @@ -14,6 +14,7 @@ import net.minecraft.util.Icon; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; +@Deprecated public class BlockPinkSapling extends BlockSapling { public static final String[] WOOD_TYPES = new String[] {"cherry"}; diff --git a/src/minecraft/biomesoplenty/blocks/BlockRedSapling.java b/src/minecraft/biomesoplenty/blocks/BlockRedSapling.java index 5437626b6..0b014b6c7 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockRedSapling.java +++ b/src/minecraft/biomesoplenty/blocks/BlockRedSapling.java @@ -14,6 +14,7 @@ import net.minecraft.util.Icon; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; +@Deprecated public class BlockRedSapling extends BlockSapling { public static final String[] WOOD_TYPES = new String[] {"maple"}; diff --git a/src/minecraft/biomesoplenty/blocks/BlockRedwoodSapling.java b/src/minecraft/biomesoplenty/blocks/BlockRedwoodSapling.java index 46bc0b67a..a9c95bf28 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockRedwoodSapling.java +++ b/src/minecraft/biomesoplenty/blocks/BlockRedwoodSapling.java @@ -14,6 +14,7 @@ import net.minecraft.util.Icon; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; +@Deprecated public class BlockRedwoodSapling extends BlockSapling { public static final String[] WOOD_TYPES = new String[] {"redwood"}; diff --git a/src/minecraft/biomesoplenty/blocks/BlockWhiteSapling.java b/src/minecraft/biomesoplenty/blocks/BlockWhiteSapling.java index 7c76baf6d..ac217b471 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockWhiteSapling.java +++ b/src/minecraft/biomesoplenty/blocks/BlockWhiteSapling.java @@ -14,6 +14,7 @@ import net.minecraft.util.Icon; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; +@Deprecated public class BlockWhiteSapling extends BlockSapling { public static final String[] WOOD_TYPES = new String[] {"white"}; diff --git a/src/minecraft/biomesoplenty/blocks/BlockWillowSapling.java b/src/minecraft/biomesoplenty/blocks/BlockWillowSapling.java index 1b7df4a8b..6e0cf9916 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockWillowSapling.java +++ b/src/minecraft/biomesoplenty/blocks/BlockWillowSapling.java @@ -14,6 +14,7 @@ import net.minecraft.util.Icon; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; +@Deprecated public class BlockWillowSapling extends BlockSapling { public static final String[] WOOD_TYPES = new String[] {"willow"}; diff --git a/src/minecraft/biomesoplenty/blocks/BlockYellowSapling.java b/src/minecraft/biomesoplenty/blocks/BlockYellowSapling.java index 335c982bf..7396b58d5 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockYellowSapling.java +++ b/src/minecraft/biomesoplenty/blocks/BlockYellowSapling.java @@ -14,6 +14,7 @@ import net.minecraft.util.Icon; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; +@Deprecated public class BlockYellowSapling extends BlockSapling { public static final String[] WOOD_TYPES = new String[] {"yellow"}; diff --git a/src/minecraft/biomesoplenty/configuration/BOPBlocks.java b/src/minecraft/biomesoplenty/configuration/BOPBlocks.java index b06ce64eb..5bc1365a0 100644 --- a/src/minecraft/biomesoplenty/configuration/BOPBlocks.java +++ b/src/minecraft/biomesoplenty/configuration/BOPBlocks.java @@ -6,6 +6,7 @@ import biomesoplenty.blocks.BlockBOPLog.LogCategory; import biomesoplenty.blocks.BlockBOPSlab.SlabCategory; import biomesoplenty.blocks.BlockBOPStairs.WoodCategory; import biomesoplenty.items.ItemBOPColorizedLeaves; +import biomesoplenty.items.ItemBOPColorizedSapling; import biomesoplenty.items.ItemBOPFlower; import biomesoplenty.items.ItemBOPFoliage; import biomesoplenty.items.ItemBOPLeaves; @@ -13,6 +14,7 @@ import biomesoplenty.items.ItemBOPLog; import biomesoplenty.items.ItemBOPPlank; import biomesoplenty.items.ItemBOPPlant; import biomesoplenty.items.ItemBOPSlab; +import biomesoplenty.items.ItemBOPSapling; import com.google.common.base.Optional; @@ -498,7 +500,7 @@ public class BOPBlocks { LanguageRegistry.addName(new ItemStack(Blocks.flowers.get(),1,9), "Toadstool"); LanguageRegistry.addName(new ItemStack(Blocks.flowers.get(),1,10), "Tiny Cactus"); - // Leaves - Almost working, will have to fix drops + // Leaves - WORKING! Blocks.leaves = Optional.of((new BlockBOPLeaves(2000)).setHardness(0.2F).setLightOpacity(1).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("leaves")); GameRegistry.registerBlock(Blocks.leaves.get(), ItemBOPLeaves.class, "leaves"); @@ -566,8 +568,33 @@ public class BOPBlocks { LanguageRegistry.addName(new ItemStack(Blocks.plants.get(),1,3), "Dune Grass"); LanguageRegistry.addName(new ItemStack(Blocks.plants.get(),1,4), "Holy Tall Grass"); LanguageRegistry.addName(new ItemStack(Blocks.plants.get(),1,5), "Thorns"); + + // Saplings - WORKING! + Blocks.saplings = Optional.of((new BlockBOPSapling(1986)).setUnlocalizedName("saplings")); + GameRegistry.registerBlock(Blocks.saplings.get(), ItemBOPSapling.class, "saplings"); + + LanguageRegistry.addName(new ItemStack(Blocks.saplings.get(),1,0), "Autumn Sapling"); + LanguageRegistry.addName(new ItemStack(Blocks.saplings.get(),1,1), "Bamboo Sapling"); + LanguageRegistry.addName(new ItemStack(Blocks.saplings.get(),1,2), "Magic Sapling"); + LanguageRegistry.addName(new ItemStack(Blocks.saplings.get(),1,3), "Dark Sapling"); + LanguageRegistry.addName(new ItemStack(Blocks.saplings.get(),1,4), "Dying Sapling"); + LanguageRegistry.addName(new ItemStack(Blocks.saplings.get(),1,5), "Fir Sapling"); + LanguageRegistry.addName(new ItemStack(Blocks.saplings.get(),1,6), "Holy Sapling"); + LanguageRegistry.addName(new ItemStack(Blocks.saplings.get(),1,7), "Autumn Sapling"); + LanguageRegistry.addName(new ItemStack(Blocks.saplings.get(),1,8), "Origin Sapling"); + LanguageRegistry.addName(new ItemStack(Blocks.saplings.get(),1,9), "Cherry Sapling"); + LanguageRegistry.addName(new ItemStack(Blocks.saplings.get(),1,10), "Maple Sapling"); + LanguageRegistry.addName(new ItemStack(Blocks.saplings.get(),1,11), "Cherry Sapling"); + + Blocks.colorizedSaplings = Optional.of((new BlockBOPColorizedSapling(1985)).setUnlocalizedName("colorizedSaplings")); + GameRegistry.registerBlock(Blocks.colorizedSaplings.get(), ItemBOPColorizedSapling.class, "colorizedSaplings"); + + LanguageRegistry.addName(new ItemStack(Blocks.colorizedSaplings.get(),1,0), "Acacia Sapling"); + LanguageRegistry.addName(new ItemStack(Blocks.colorizedSaplings.get(),1,1), "Mangrove Sapling"); + LanguageRegistry.addName(new ItemStack(Blocks.colorizedSaplings.get(),1,2), "Palm Sapling"); + LanguageRegistry.addName(new ItemStack(Blocks.colorizedSaplings.get(),1,3), "Redwood Sapling"); + LanguageRegistry.addName(new ItemStack(Blocks.colorizedSaplings.get(),1,4), "Willow Sapling"); */ - // Add block registration GameRegistry.registerBlock(mud, "mud"); GameRegistry.registerBlock(driedDirt, "driedDirt"); diff --git a/src/minecraft/biomesoplenty/items/ItemBOPColorizedLeaves.java b/src/minecraft/biomesoplenty/items/ItemBOPColorizedLeaves.java index bd808b8c2..aab31dc96 100644 --- a/src/minecraft/biomesoplenty/items/ItemBOPColorizedLeaves.java +++ b/src/minecraft/biomesoplenty/items/ItemBOPColorizedLeaves.java @@ -17,7 +17,7 @@ public class ItemBOPColorizedLeaves extends ItemBlock @Override public int getMetadata(int meta) { - return meta; + return meta & 15; } @Override diff --git a/src/minecraft/biomesoplenty/items/ItemBOPColorizedSapling.java b/src/minecraft/biomesoplenty/items/ItemBOPColorizedSapling.java new file mode 100644 index 000000000..0581bf104 --- /dev/null +++ b/src/minecraft/biomesoplenty/items/ItemBOPColorizedSapling.java @@ -0,0 +1,38 @@ +package biomesoplenty.items; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Icon; + +public class ItemBOPColorizedSapling extends ItemBlock +{ + private static final String[] saplings = new String[] {"acacia", "mangrove", "palm", "redwood", "willow"}; + + public ItemBOPColorizedSapling(int par1) + { + super(par1); + setMaxDamage(0); + setHasSubtypes(true); + } + + @Override + public int getMetadata(int meta) + { + return meta & 15; + } + + @Override + public String getUnlocalizedName(ItemStack itemStack) + { + return (new StringBuilder()).append(saplings[itemStack.getItemDamage()]).append("Sapling").toString(); + } + + + + @Override + public Icon getIconFromDamage(int meta) + { + return Block.blocksList[this.itemID].getBlockTextureFromSideAndMetadata(0, meta); + } +} diff --git a/src/minecraft/biomesoplenty/items/ItemBOPFlower.java b/src/minecraft/biomesoplenty/items/ItemBOPFlower.java index c2162ad35..4cada6e5d 100644 --- a/src/minecraft/biomesoplenty/items/ItemBOPFlower.java +++ b/src/minecraft/biomesoplenty/items/ItemBOPFlower.java @@ -19,7 +19,7 @@ public class ItemBOPFlower extends ItemBlock @Override public int getMetadata(int meta) { - return meta; + return meta & 15; } @Override diff --git a/src/minecraft/biomesoplenty/items/ItemBOPFoliage.java b/src/minecraft/biomesoplenty/items/ItemBOPFoliage.java index 2cc38d6bf..1313aa12c 100644 --- a/src/minecraft/biomesoplenty/items/ItemBOPFoliage.java +++ b/src/minecraft/biomesoplenty/items/ItemBOPFoliage.java @@ -35,7 +35,7 @@ public class ItemBOPFoliage extends ItemBlock @Override public int getMetadata(int meta) { - return meta; + return meta & 15; } @Override diff --git a/src/minecraft/biomesoplenty/items/ItemBOPLeaves.java b/src/minecraft/biomesoplenty/items/ItemBOPLeaves.java index b2f355a55..01827a7b1 100644 --- a/src/minecraft/biomesoplenty/items/ItemBOPLeaves.java +++ b/src/minecraft/biomesoplenty/items/ItemBOPLeaves.java @@ -17,7 +17,7 @@ public class ItemBOPLeaves extends ItemBlock @Override public int getMetadata(int meta) { - return meta; + return meta & 15; } @Override diff --git a/src/minecraft/biomesoplenty/items/ItemBOPLog.java b/src/minecraft/biomesoplenty/items/ItemBOPLog.java index d65e2c007..5f21c8584 100644 --- a/src/minecraft/biomesoplenty/items/ItemBOPLog.java +++ b/src/minecraft/biomesoplenty/items/ItemBOPLog.java @@ -20,7 +20,7 @@ public class ItemBOPLog extends ItemBlock @Override public int getMetadata(int meta) { - return meta; + return meta & 3; } @Override diff --git a/src/minecraft/biomesoplenty/items/ItemBOPPlank.java b/src/minecraft/biomesoplenty/items/ItemBOPPlank.java index a64942bd7..ee117b9ed 100644 --- a/src/minecraft/biomesoplenty/items/ItemBOPPlank.java +++ b/src/minecraft/biomesoplenty/items/ItemBOPPlank.java @@ -17,7 +17,7 @@ public class ItemBOPPlank extends ItemBlock @Override public int getMetadata(int meta) { - return meta; + return meta & 15; } @Override diff --git a/src/minecraft/biomesoplenty/items/ItemBOPPlant.java b/src/minecraft/biomesoplenty/items/ItemBOPPlant.java index 2fdfb8a1f..3a869405a 100644 --- a/src/minecraft/biomesoplenty/items/ItemBOPPlant.java +++ b/src/minecraft/biomesoplenty/items/ItemBOPPlant.java @@ -19,7 +19,7 @@ public class ItemBOPPlant extends ItemBlock @Override public int getMetadata(int meta) { - return meta; + return meta & 15; } @Override diff --git a/src/minecraft/biomesoplenty/items/ItemBOPSapling.java b/src/minecraft/biomesoplenty/items/ItemBOPSapling.java new file mode 100644 index 000000000..ab5a4f864 --- /dev/null +++ b/src/minecraft/biomesoplenty/items/ItemBOPSapling.java @@ -0,0 +1,38 @@ +package biomesoplenty.items; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Icon; + +public class ItemBOPSapling extends ItemBlock +{ +private static final String[] saplings = new String[] {"yellow", "bamboo", "magic", "dark", "brown", "fir", "holy", "orange", "origin", "pink", "red", "white"}; + + public ItemBOPSapling(int par1) + { + super(par1); + setMaxDamage(0); + setHasSubtypes(true); + } + + @Override + public int getMetadata(int meta) + { + return meta & 15; + } + + @Override + public String getUnlocalizedName(ItemStack itemStack) + { + return (new StringBuilder()).append(saplings[itemStack.getItemDamage()]).append("Sapling").toString(); + } + + + + @Override + public Icon getIconFromDamage(int meta) + { + return Block.blocksList[this.itemID].getBlockTextureFromSideAndMetadata(0, meta); + } +} diff --git a/src/minecraft/biomesoplenty/items/ItemBOPSlab.java b/src/minecraft/biomesoplenty/items/ItemBOPSlab.java index f802198b7..7abf0b953 100644 --- a/src/minecraft/biomesoplenty/items/ItemBOPSlab.java +++ b/src/minecraft/biomesoplenty/items/ItemBOPSlab.java @@ -27,7 +27,7 @@ public class ItemBOPSlab extends ItemSlab @Override public int getMetadata(int meta) { - return meta; + return meta & 7; } @Override