Saplings!

This commit is contained in:
Amnet 2013-04-16 14:57:04 +02:00
parent 5a96e56158
commit 8327a881da
35 changed files with 482 additions and 27 deletions

View file

@ -7,7 +7,27 @@ import net.minecraft.block.BlockHalfSlab;
public class Blocks public class Blocks
{ {
// Worldgen Blocks
public static Optional<? extends Block> ash = Optional.absent();
public static Optional<? extends Block> ashStone = Optional.absent();
public static Optional<? extends Block> cragRock = Optional.absent();
public static Optional<? extends Block> driedDirt = Optional.absent();
public static Optional<? extends Block> hardDirt = Optional.absent();
public static Optional<? extends Block> hardIce = Optional.absent();
public static Optional<? extends Block> hardSand = Optional.absent();
public static Optional<? extends Block> holyGrass = Optional.absent();
public static Optional<? extends Block> holyStone = Optional.absent();
public static Optional<? extends Block> mud = Optional.absent();
public static Optional<? extends Block> originGrass = Optional.absent();
public static Optional<? extends Block> redRock = Optional.absent();
// Planks and logs
public static Optional<? extends Block> planks = Optional.absent(); public static Optional<? extends Block> planks = Optional.absent();
public static Optional<? extends Block> logs1 = Optional.absent();
public static Optional<? extends Block> logs2 = Optional.absent();
public static Optional<? extends Block> logs3 = Optional.absent();
// Stairs
public static Optional<? extends Block> acaciaStairs = Optional.absent(); public static Optional<? extends Block> acaciaStairs = Optional.absent();
public static Optional<? extends Block> cherryStairs = Optional.absent(); public static Optional<? extends Block> cherryStairs = Optional.absent();
public static Optional<? extends Block> darkStairs = Optional.absent(); public static Optional<? extends Block> darkStairs = Optional.absent();
@ -19,18 +39,20 @@ public class Blocks
public static Optional<? extends Block> redwoodStairs = Optional.absent(); public static Optional<? extends Block> redwoodStairs = Optional.absent();
public static Optional<? extends Block> willowStairs = Optional.absent(); public static Optional<? extends Block> willowStairs = Optional.absent();
// Slabs
public static Optional<? extends BlockHalfSlab> woodenSingleSlab1 = Optional.absent(); public static Optional<? extends BlockHalfSlab> woodenSingleSlab1 = Optional.absent();
public static Optional<? extends BlockHalfSlab> woodenDoubleSlab1 = Optional.absent(); public static Optional<? extends BlockHalfSlab> woodenDoubleSlab1 = Optional.absent();
public static Optional<? extends BlockHalfSlab> woodenSingleSlab2 = Optional.absent(); public static Optional<? extends BlockHalfSlab> woodenSingleSlab2 = Optional.absent();
public static Optional<? extends BlockHalfSlab> woodenDoubleSlab2 = Optional.absent(); public static Optional<? extends BlockHalfSlab> woodenDoubleSlab2 = Optional.absent();
public static Optional<? extends BlockHalfSlab> stoneSingleSlab = Optional.absent(); public static Optional<? extends BlockHalfSlab> stoneSingleSlab = Optional.absent();
public static Optional<? extends BlockHalfSlab> stoneDoubleSlab = Optional.absent(); public static Optional<? extends BlockHalfSlab> stoneDoubleSlab = Optional.absent();
// Plants
public static Optional<? extends Block> flowers = Optional.absent(); public static Optional<? extends Block> flowers = Optional.absent();
public static Optional<? extends Block> leaves = Optional.absent(); public static Optional<? extends Block> leaves = Optional.absent();
public static Optional<? extends Block> leavesColorized = Optional.absent(); public static Optional<? extends Block> leavesColorized = Optional.absent();
public static Optional<? extends Block> logs1 = Optional.absent();
public static Optional<? extends Block> logs2 = Optional.absent();
public static Optional<? extends Block> logs3 = Optional.absent();
public static Optional<? extends Block> foliage = Optional.absent(); public static Optional<? extends Block> foliage = Optional.absent();
public static Optional<? extends Block> plants = Optional.absent(); public static Optional<? extends Block> plants = Optional.absent();
public static Optional<? extends Block> saplings = Optional.absent();
public static Optional<? extends Block> colorizedSaplings = Optional.absent();
} }

View file

@ -14,6 +14,7 @@ import net.minecraft.util.Icon;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraft.world.gen.feature.WorldGenerator;
@Deprecated
public class BlockAcaciaSapling extends BlockSapling public class BlockAcaciaSapling extends BlockSapling
{ {
public static final String[] WOOD_TYPES = new String[] {"acacia"}; public static final String[] WOOD_TYPES = new String[] {"acacia"};

View file

@ -4,13 +4,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Random; 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.BlockLeavesBase;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister; 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.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.IShearable; 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 public class BlockBOPColorizedLeaves extends BlockLeavesBase implements IShearable
{ {
@ -108,7 +105,7 @@ public class BlockBOPColorizedLeaves extends BlockLeavesBase implements IShearab
@Override @Override
public int idDropped(int par1, Random par2Random, int par3) public int idDropped(int par1, Random par2Random, int par3)
{ {
return BOPBlocks.yellowSapling.blockID; return Blocks.colorizedSaplings.get().blockID;
} }
@Override @Override
@ -117,6 +114,12 @@ public class BlockBOPColorizedLeaves extends BlockLeavesBase implements IShearab
return meta & textures[0].length; return meta & textures[0].length;
} }
@Override
public int quantityDropped(Random random)
{
return random.nextInt(20) == 0 ? 1 : 0;
}
@Override @Override
public boolean isShearable(ItemStack item, World world, int x, int y, int z) 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<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune) public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
{ {
ArrayList<ItemStack> ret = new ArrayList<ItemStack>(); ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
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; return ret;
} }
} }

View file

@ -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;
}
}

View file

@ -86,6 +86,6 @@ public class BlockBOPFlower extends BlockFlower
@Override @Override
public int damageDropped(int meta) public int damageDropped(int meta)
{ {
return meta; return meta & 15;
} }
} }

View file

@ -55,9 +55,7 @@ public class BlockBOPFoliage extends BlockFlower implements IShearable
public Icon getBlockTextureFromSideAndMetadata(int side, int meta) public Icon getBlockTextureFromSideAndMetadata(int side, int meta)
{ {
if (meta >= textures.length) if (meta >= textures.length)
{
meta = 0; meta = 0;
}
return textures[meta]; return textures[meta];
} }

View file

@ -5,6 +5,7 @@ import java.util.List;
import java.util.Random; import java.util.Random;
import biomesoplenty.mod_BiomesOPlenty; import biomesoplenty.mod_BiomesOPlenty;
import biomesoplenty.api.Blocks;
import biomesoplenty.configuration.BOPBlocks; import biomesoplenty.configuration.BOPBlocks;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@ -67,7 +68,7 @@ public class BlockBOPLeaves extends BlockLeavesBase implements IShearable
@Override @Override
public int idDropped(int par1, Random par2Random, int par3) public int idDropped(int par1, Random par2Random, int par3)
{ {
return BOPBlocks.yellowSapling.blockID; return Blocks.saplings.get().blockID;
} }
@Override @Override
@ -76,6 +77,12 @@ public class BlockBOPLeaves extends BlockLeavesBase implements IShearable
return meta & textures[0].length; return meta & textures[0].length;
} }
@Override
public int quantityDropped(Random random)
{
return random.nextInt(20) == 0 ? 1 : 0;
}
@Override @Override
public boolean isShearable(ItemStack item, World world, int x, int y, int z) 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<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune) public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
{ {
ArrayList<ItemStack> ret = new ArrayList<ItemStack>(); ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
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; return ret;
} }
} }

View file

@ -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;
}
}

View file

@ -16,6 +16,7 @@ import net.minecraft.util.Icon;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraft.world.gen.feature.WorldGenerator;
@Deprecated
public class BlockBambooSapling extends BlockSapling public class BlockBambooSapling extends BlockSapling
{ {
public static final String[] WOOD_TYPES = new String[] {"dark"}; public static final String[] WOOD_TYPES = new String[] {"dark"};

View file

@ -14,6 +14,7 @@ import net.minecraft.util.Icon;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraft.world.gen.feature.WorldGenerator;
@Deprecated
public class BlockBrownSapling extends BlockSapling public class BlockBrownSapling extends BlockSapling
{ {
public static final String[] WOOD_TYPES = new String[] {"brown"}; public static final String[] WOOD_TYPES = new String[] {"brown"};

View file

@ -15,6 +15,7 @@ import net.minecraft.util.Icon;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraft.world.gen.feature.WorldGenerator;
@Deprecated
public class BlockDarkSapling extends BlockSapling public class BlockDarkSapling extends BlockSapling
{ {
public static final String[] WOOD_TYPES = new String[] {"dark"}; public static final String[] WOOD_TYPES = new String[] {"dark"};

View file

@ -14,6 +14,7 @@ import net.minecraft.util.Icon;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraft.world.gen.feature.WorldGenerator;
@Deprecated
public class BlockFirSapling extends BlockSapling public class BlockFirSapling extends BlockSapling
{ {
public static final String[] WOOD_TYPES = new String[] {"fir"}; public static final String[] WOOD_TYPES = new String[] {"fir"};

View file

@ -16,6 +16,7 @@ import net.minecraft.util.Icon;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraft.world.gen.feature.WorldGenerator;
@Deprecated
public class BlockHolySapling extends BlockSapling public class BlockHolySapling extends BlockSapling
{ {
public static final String[] WOOD_TYPES = new String[] {"holy"}; public static final String[] WOOD_TYPES = new String[] {"holy"};

View file

@ -16,6 +16,7 @@ import net.minecraft.util.Icon;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraft.world.gen.feature.WorldGenerator;
@Deprecated
public class BlockMagicSapling extends BlockSapling public class BlockMagicSapling extends BlockSapling
{ {
public static final String[] WOOD_TYPES = new String[] {"magic"}; public static final String[] WOOD_TYPES = new String[] {"magic"};

View file

@ -15,6 +15,7 @@ import net.minecraft.util.Icon;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraft.world.gen.feature.WorldGenerator;
@Deprecated
public class BlockMangroveSapling extends BlockSapling public class BlockMangroveSapling extends BlockSapling
{ {
public static final String[] WOOD_TYPES = new String[] {"mangrove"}; public static final String[] WOOD_TYPES = new String[] {"mangrove"};

View file

@ -14,6 +14,7 @@ import net.minecraft.util.Icon;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraft.world.gen.feature.WorldGenerator;
@Deprecated
public class BlockOrangeSapling extends BlockSapling public class BlockOrangeSapling extends BlockSapling
{ {
public static final String[] WOOD_TYPES = new String[] {"orange"}; public static final String[] WOOD_TYPES = new String[] {"orange"};

View file

@ -16,6 +16,7 @@ import net.minecraft.util.Icon;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraft.world.gen.feature.WorldGenerator;
@Deprecated
public class BlockOriginSapling extends BlockSapling public class BlockOriginSapling extends BlockSapling
{ {
public static final String[] WOOD_TYPES = new String[] {"origin"}; public static final String[] WOOD_TYPES = new String[] {"origin"};

View file

@ -15,6 +15,7 @@ import net.minecraft.util.Icon;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraft.world.gen.feature.WorldGenerator;
@Deprecated
public class BlockPalmSapling extends BlockSapling public class BlockPalmSapling extends BlockSapling
{ {
public static final String[] WOOD_TYPES = new String[] {"palm"}; public static final String[] WOOD_TYPES = new String[] {"palm"};

View file

@ -14,6 +14,7 @@ import net.minecraft.util.Icon;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraft.world.gen.feature.WorldGenerator;
@Deprecated
public class BlockPinkSapling extends BlockSapling public class BlockPinkSapling extends BlockSapling
{ {
public static final String[] WOOD_TYPES = new String[] {"cherry"}; public static final String[] WOOD_TYPES = new String[] {"cherry"};

View file

@ -14,6 +14,7 @@ import net.minecraft.util.Icon;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraft.world.gen.feature.WorldGenerator;
@Deprecated
public class BlockRedSapling extends BlockSapling public class BlockRedSapling extends BlockSapling
{ {
public static final String[] WOOD_TYPES = new String[] {"maple"}; public static final String[] WOOD_TYPES = new String[] {"maple"};

View file

@ -14,6 +14,7 @@ import net.minecraft.util.Icon;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraft.world.gen.feature.WorldGenerator;
@Deprecated
public class BlockRedwoodSapling extends BlockSapling public class BlockRedwoodSapling extends BlockSapling
{ {
public static final String[] WOOD_TYPES = new String[] {"redwood"}; public static final String[] WOOD_TYPES = new String[] {"redwood"};

View file

@ -14,6 +14,7 @@ import net.minecraft.util.Icon;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraft.world.gen.feature.WorldGenerator;
@Deprecated
public class BlockWhiteSapling extends BlockSapling public class BlockWhiteSapling extends BlockSapling
{ {
public static final String[] WOOD_TYPES = new String[] {"white"}; public static final String[] WOOD_TYPES = new String[] {"white"};

View file

@ -14,6 +14,7 @@ import net.minecraft.util.Icon;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraft.world.gen.feature.WorldGenerator;
@Deprecated
public class BlockWillowSapling extends BlockSapling public class BlockWillowSapling extends BlockSapling
{ {
public static final String[] WOOD_TYPES = new String[] {"willow"}; public static final String[] WOOD_TYPES = new String[] {"willow"};

View file

@ -14,6 +14,7 @@ import net.minecraft.util.Icon;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraft.world.gen.feature.WorldGenerator;
@Deprecated
public class BlockYellowSapling extends BlockSapling public class BlockYellowSapling extends BlockSapling
{ {
public static final String[] WOOD_TYPES = new String[] {"yellow"}; public static final String[] WOOD_TYPES = new String[] {"yellow"};

View file

@ -6,6 +6,7 @@ import biomesoplenty.blocks.BlockBOPLog.LogCategory;
import biomesoplenty.blocks.BlockBOPSlab.SlabCategory; import biomesoplenty.blocks.BlockBOPSlab.SlabCategory;
import biomesoplenty.blocks.BlockBOPStairs.WoodCategory; import biomesoplenty.blocks.BlockBOPStairs.WoodCategory;
import biomesoplenty.items.ItemBOPColorizedLeaves; import biomesoplenty.items.ItemBOPColorizedLeaves;
import biomesoplenty.items.ItemBOPColorizedSapling;
import biomesoplenty.items.ItemBOPFlower; import biomesoplenty.items.ItemBOPFlower;
import biomesoplenty.items.ItemBOPFoliage; import biomesoplenty.items.ItemBOPFoliage;
import biomesoplenty.items.ItemBOPLeaves; import biomesoplenty.items.ItemBOPLeaves;
@ -13,6 +14,7 @@ import biomesoplenty.items.ItemBOPLog;
import biomesoplenty.items.ItemBOPPlank; import biomesoplenty.items.ItemBOPPlank;
import biomesoplenty.items.ItemBOPPlant; import biomesoplenty.items.ItemBOPPlant;
import biomesoplenty.items.ItemBOPSlab; import biomesoplenty.items.ItemBOPSlab;
import biomesoplenty.items.ItemBOPSapling;
import com.google.common.base.Optional; 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,9), "Toadstool");
LanguageRegistry.addName(new ItemStack(Blocks.flowers.get(),1,10), "Tiny Cactus"); 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")); 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"); 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,3), "Dune Grass");
LanguageRegistry.addName(new ItemStack(Blocks.plants.get(),1,4), "Holy Tall Grass"); LanguageRegistry.addName(new ItemStack(Blocks.plants.get(),1,4), "Holy Tall Grass");
LanguageRegistry.addName(new ItemStack(Blocks.plants.get(),1,5), "Thorns"); 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 // Add block registration
GameRegistry.registerBlock(mud, "mud"); GameRegistry.registerBlock(mud, "mud");
GameRegistry.registerBlock(driedDirt, "driedDirt"); GameRegistry.registerBlock(driedDirt, "driedDirt");

View file

@ -17,7 +17,7 @@ public class ItemBOPColorizedLeaves extends ItemBlock
@Override @Override
public int getMetadata(int meta) public int getMetadata(int meta)
{ {
return meta; return meta & 15;
} }
@Override @Override

View file

@ -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);
}
}

View file

@ -19,7 +19,7 @@ public class ItemBOPFlower extends ItemBlock
@Override @Override
public int getMetadata(int meta) public int getMetadata(int meta)
{ {
return meta; return meta & 15;
} }
@Override @Override

View file

@ -35,7 +35,7 @@ public class ItemBOPFoliage extends ItemBlock
@Override @Override
public int getMetadata(int meta) public int getMetadata(int meta)
{ {
return meta; return meta & 15;
} }
@Override @Override

View file

@ -17,7 +17,7 @@ public class ItemBOPLeaves extends ItemBlock
@Override @Override
public int getMetadata(int meta) public int getMetadata(int meta)
{ {
return meta; return meta & 15;
} }
@Override @Override

View file

@ -20,7 +20,7 @@ public class ItemBOPLog extends ItemBlock
@Override @Override
public int getMetadata(int meta) public int getMetadata(int meta)
{ {
return meta; return meta & 3;
} }
@Override @Override

View file

@ -17,7 +17,7 @@ public class ItemBOPPlank extends ItemBlock
@Override @Override
public int getMetadata(int meta) public int getMetadata(int meta)
{ {
return meta; return meta & 15;
} }
@Override @Override

View file

@ -19,7 +19,7 @@ public class ItemBOPPlant extends ItemBlock
@Override @Override
public int getMetadata(int meta) public int getMetadata(int meta)
{ {
return meta; return meta & 15;
} }
@Override @Override

View file

@ -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);
}
}

View file

@ -27,7 +27,7 @@ public class ItemBOPSlab extends ItemSlab
@Override @Override
public int getMetadata(int meta) public int getMetadata(int meta)
{ {
return meta; return meta & 7;
} }
@Override @Override