diff --git a/src/minecraft/mods/BiomesOPlenty/textures/blocks/itembush.png b/src/minecraft/mods/BiomesOPlenty/textures/blocks/itembush.png new file mode 100644 index 000000000..e009c6d93 Binary files /dev/null and b/src/minecraft/mods/BiomesOPlenty/textures/blocks/itembush.png differ diff --git a/src/minecraft/mods/BiomesOPlenty/textures/blocks/itemhighgrass.png b/src/minecraft/mods/BiomesOPlenty/textures/blocks/itemhighgrass.png new file mode 100644 index 000000000..3c23500a8 Binary files /dev/null and b/src/minecraft/mods/BiomesOPlenty/textures/blocks/itemhighgrass.png differ diff --git a/src/minecraft/mods/BiomesOPlenty/textures/blocks/itemmediumgrass.png b/src/minecraft/mods/BiomesOPlenty/textures/blocks/itemmediumgrass.png new file mode 100644 index 000000000..7df6d8b0b Binary files /dev/null and b/src/minecraft/mods/BiomesOPlenty/textures/blocks/itemmediumgrass.png differ diff --git a/src/minecraft/mods/BiomesOPlenty/textures/blocks/itemshortgrass.png b/src/minecraft/mods/BiomesOPlenty/textures/blocks/itemshortgrass.png new file mode 100644 index 000000000..bef01da51 Binary files /dev/null and b/src/minecraft/mods/BiomesOPlenty/textures/blocks/itemshortgrass.png differ diff --git a/src/minecraft/mods/BiomesOPlenty/textures/blocks/itemsprout.png b/src/minecraft/mods/BiomesOPlenty/textures/blocks/itemsprout.png new file mode 100644 index 000000000..1d2302e8c Binary files /dev/null and b/src/minecraft/mods/BiomesOPlenty/textures/blocks/itemsprout.png differ diff --git a/src/minecraft/tdwp_ftw/biomesop/api/Blocks.java b/src/minecraft/tdwp_ftw/biomesop/api/Blocks.java index 91e43d606..3e70b04a8 100644 --- a/src/minecraft/tdwp_ftw/biomesop/api/Blocks.java +++ b/src/minecraft/tdwp_ftw/biomesop/api/Blocks.java @@ -31,4 +31,6 @@ public class Blocks 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(); } diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBOPFlower.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBOPFlower.java index 21d7ca239..03570c641 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBOPFlower.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBOPFlower.java @@ -7,7 +7,9 @@ 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.entity.Entity; import net.minecraft.item.ItemStack; +import net.minecraft.util.DamageSource; import net.minecraft.util.Icon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -17,7 +19,7 @@ import cpw.mods.fml.relauncher.SideOnly; public class BlockBOPFlower extends BlockFlower { - private static final String[] plants = new String[] {"swampflower", "deadbloom", "glowflower", "hydrangea", "orangeflower", "pinkflower", "purpleflower", "violet", "whiteflower"}; + private static final String[] plants = new String[] {"swampflower", "deadbloom", "glowflower", "hydrangea", "orangeflower", "pinkflower", "purpleflower", "violet", "whiteflower", "toadstool", "cactus"}; @SideOnly(Side.CLIENT) private Icon[] textures; @@ -55,6 +57,7 @@ public class BlockBOPFlower extends BlockFlower return textures[meta]; } + @Override public int getLightValue(IBlockAccess world, int x, int y, int z) { int meta = world.getBlockMetadata(x, y, z); @@ -64,6 +67,14 @@ public class BlockBOPFlower extends BlockFlower return 0; } + @Override + public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) + { + int meta = world.getBlockMetadata(x, y, z); + if (meta == 10) + entity.attackEntityFrom(DamageSource.cactus, 1); + } + @Override @SideOnly(Side.CLIENT) public void getSubBlocks(int blockID, CreativeTabs creativeTabs, List list) { diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBOPFoliage.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBOPFoliage.java index 463e7a6a2..631835ad8 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBOPFoliage.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBOPFoliage.java @@ -17,34 +17,34 @@ import net.minecraft.world.ColorizerGrass; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.IShearable; -import tdwp_ftw.biomesop.configuration.BOPBlocks; +import tdwp_ftw.biomesop.mod_BiomesOPlenty; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class BlockBOPFoliage extends BlockFlower implements IShearable { - private static final String[] foliageTypes = new String[] {"shortgrass", "mediumgrass", "highgrassbottom", "highgrasstop"}; + private static final String[] foliageTypes = new String[] {"shortgrass", "mediumgrass", "highgrassbottom", "bush", "sprout", "highgrasstop"}; @SideOnly(Side.CLIENT) - private Icon[] textures = {null, null, null, null}; - private final int metadata; + private Icon[] textures; + - public BlockBOPFoliage(int blockID, int index) + public BlockBOPFoliage(int blockID) { super(blockID, Material.vine); float f = 0.4F; - BlockBOPFoliage.setBurnProperties(this.blockID, 60, 100); - metadata = index; - - if (metadata == 3) - this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F); - else - this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.8F, 0.5F + f); + setBurnProperties(this.blockID, 60, 100); + setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.8F, 0.5F + f); + setHardness(0.0F); + setStepSound(Block.soundGrassFootstep); + this.setCreativeTab(mod_BiomesOPlenty.tabBiomesOPlenty); } @Override @SideOnly(Side.CLIENT) public void registerIcons(IconRegister iconRegister) { + textures = new Icon[foliageTypes.length]; + for (int i = 0; i < textures.length; ++i) textures[i] = iconRegister.registerIcon("BiomesOPlenty:"+foliageTypes[i]); } @@ -65,31 +65,28 @@ public class BlockBOPFoliage extends BlockFlower implements IShearable @SideOnly(Side.CLIENT) public void getSubBlocks(int blockID, CreativeTabs par2CreativeTabs, List list) { - list.add(new ItemStack(blockID, 1, 0)); - list.add(new ItemStack(blockID, 1, 1)); - list.add(new ItemStack(blockID, 1, 2)); - list.add(new ItemStack(blockID, 1, 3)); + for (int i = 0; i < textures.length-1; ++i) + list.add(new ItemStack(blockID, 1, i)); } @Override public boolean canPlaceBlockAt(World world, int x, int y, int z) { - return super.canPlaceBlockAt(world, x, y, z) && this.canThisPlantGrowOnThisBlockID(world.getBlockId(x, y - 1, z)); + return super.canPlaceBlockAt(world, x, y, z) && this.canThisPlantGrowOnThisBlockID(world.getBlockId(x, y - 1, z), world.getBlockMetadata(x, y, z)); } - @Override - protected boolean canThisPlantGrowOnThisBlockID(int blockID) + protected boolean canThisPlantGrowOnThisBlockID(int blockID, int metadata) { - if (metadata == 3) - return blockID == BOPBlocks.highGrassBottom.blockID; + if (metadata == 5) + return blockID == this.blockID; else return blockID == Block.grass.blockID || blockID == Block.dirt.blockID || blockID == Block.tilledField.blockID; } - + @Override public boolean canBlockStay(World world, int x, int y, int z) { - return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) && this.canThisPlantGrowOnThisBlockID(world.getBlockId(x, y - 1, z)); + return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) && this.canThisPlantGrowOnThisBlockID(world.getBlockId(x, y - 1, z), world.getBlockMetadata(x, y, z)); } @Override @@ -112,21 +109,23 @@ public class BlockBOPFoliage extends BlockFlower implements IShearable @SideOnly(Side.CLIENT) public int getRenderColor(int par1) { - return par1 == 0 ? 16777215 : ColorizerFoliage.getFoliageColorBasic(); + return ColorizerFoliage.getFoliageColorBasic(); } @Override @SideOnly(Side.CLIENT) public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { - int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4); - return var5 == 0 ? 16777215 : par1IBlockAccess.getBiomeGenForCoords(par2, par4).getBiomeGrassColor(); + return par1IBlockAccess.getBiomeGenForCoords(par2, par4).getBiomeGrassColor(); } @Override public int getDamageValue(World world, int x, int y, int z) { - return world.getBlockMetadata(x, y, z); + int meta = world.getBlockMetadata(x, y, z); + if (meta == 5) + meta = 2; + return meta; } @Override @@ -141,14 +140,6 @@ public class BlockBOPFoliage extends BlockFlower implements IShearable super.harvestBlock(world, player, x, y, z, meta); } - @Override - public int idPicked(World par1World, int par2, int par3, int par4) - { - // TODO - return -1; -// return BOPItems.shortGrassItem.itemID; - } - @Override public boolean isBlockReplaceable(World world, int x, int y, int z) { @@ -158,9 +149,11 @@ public class BlockBOPFoliage extends BlockFlower implements IShearable @Override public boolean isShearable(ItemStack item, World world, int x, int y, int z) { + if (world.getBlockMetadata(x, y, z) == 5) + return false; return true; } - + @Override public ArrayList onSheared(ItemStack item, World world, int x, int y, int z, int fortune) { diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBOPPlant.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBOPPlant.java new file mode 100644 index 000000000..b3d6fcacb --- /dev/null +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBOPPlant.java @@ -0,0 +1,154 @@ +package tdwp_ftw.biomesop.blocks; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +import tdwp_ftw.biomesop.mod_BiomesOPlenty; +import tdwp_ftw.biomesop.configuration.BOPBlocks; + +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.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.DamageSource; +import net.minecraft.util.Icon; +import net.minecraft.world.World; +import net.minecraftforge.common.IShearable; + +public class BlockBOPPlant extends BlockFlower implements IShearable +{ + private static final String[] plants = new String[] {"deadgrass", "desertgrass", "desertsprouts", "dunegrass", "holytallgrass", "thorn"}; + @SideOnly(Side.CLIENT) + private Icon[] textures; + + public BlockBOPPlant(int par1) + { + super(par1, Material.vine); + setTickRandomly(true); + float var3 = 0.4F; + setBurnProperties(this.blockID, 60, 100); + setHardness(0.0F); + setStepSound(Block.soundGrassFootstep); + setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, 0.8F, 0.5F + var3); + setCreativeTab(mod_BiomesOPlenty.tabBiomesOPlenty); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IconRegister iconRegister) + { + textures = new Icon[plants.length]; + + for (int i = 0; i < plants.length; ++i) + textures[i] = iconRegister.registerIcon("BiomesOPlenty:" + plants[i]); + } + + @Override + @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 < plants.length; ++i) + list.add(new ItemStack(blockID, 1, i)); + } + + @Override + public boolean canPlaceBlockAt(World world, int x, int y, int z) + { + return super.canPlaceBlockAt(world, x, y, z) && this.canThisPlantGrowOnThisBlockID(world.getBlockId(x, y - 1, z), world.getBlockMetadata(x, y, z)); + } + + protected boolean canThisPlantGrowOnThisBlockID(int id, int meta) + { + // TODO + if (meta == 0) + return id == BOPBlocks.driedDirt.blockID || id == Block.sand.blockID; + else if (meta == 1) + return id == BOPBlocks.redRock.blockID; + else if (meta == 2 || meta == 3) + return id == Block.sand.blockID; + else if (meta == 4) + return id == BOPBlocks.holyGrass.blockID; + else + return id == Block.grass.blockID || id == Block.dirt.blockID || id == Block.tilledField.blockID; + } + + @Override + public boolean canBlockStay(World world, int x, int y, int z) + { + return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) + && this.canThisPlantGrowOnThisBlockID(world.getBlockId(x, y - 1, z), world.getBlockMetadata(x, y, z)); + } + + @Override + public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) + { + int meta = world.getBlockMetadata(x, y, z); + if (meta == 5) + entity.attackEntityFrom(DamageSource.cactus, 1); + } + + @Override + public int getDamageValue(World world, int x, int y, int z) + { + int meta = world.getBlockMetadata(x, y, z); + return meta; + } + + @Override + public int idDropped(int par1, Random par2Random, int par3) + { + return -1; + } + + @Override + public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) + { + super.harvestBlock(world, player, x, y, z, meta); + } + + @Override + public boolean isBlockReplaceable(World world, int x, int y, int z) + { + int meta = world.getBlockMetadata(x, y, z); + if (meta == 5) + return false; + return true; + } + + @Override + public boolean isShearable(ItemStack item, World world, int x, int y, int z) + { + return true; + } + + @Override + 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))); + return ret; + } + + @Override + public boolean isBlockFoliage(World world, int x, int y, int z) + { + return true; + } +} diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBush.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBush.java index b3e25b3e4..683d86bc0 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBush.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBush.java @@ -18,6 +18,7 @@ import net.minecraft.world.World; import net.minecraftforge.common.IShearable; import tdwp_ftw.biomesop.configuration.BOPItems; +@Deprecated public class BlockBush extends BlockFlower implements IShearable { public BlockBush(int par1) diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDeadGrass.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDeadGrass.java index 11f59ae56..a306bcc3a 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDeadGrass.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDeadGrass.java @@ -16,6 +16,7 @@ import net.minecraftforge.common.IShearable; import tdwp_ftw.biomesop.mod_BiomesOPlenty; import tdwp_ftw.biomesop.configuration.BOPBlocks; +@Deprecated public class BlockDeadGrass extends Block implements IShearable { protected BlockDeadGrass(int par1, Material par3Material) diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDesertGrass.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDesertGrass.java index 6c139cae5..c50683dfc 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDesertGrass.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDesertGrass.java @@ -14,6 +14,7 @@ import net.minecraftforge.common.IShearable; import tdwp_ftw.biomesop.mod_BiomesOPlenty; import tdwp_ftw.biomesop.configuration.BOPBlocks; +@Deprecated public class BlockDesertGrass extends Block implements IShearable { protected BlockDesertGrass(int par1, Material par3Material) diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDesertSprouts.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDesertSprouts.java index c3e498a7d..d4125a76c 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDesertSprouts.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDesertSprouts.java @@ -9,6 +9,7 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; import tdwp_ftw.biomesop.mod_BiomesOPlenty; +@Deprecated public class BlockDesertSprouts extends Block { protected BlockDesertSprouts(int par1, Material par3Material) diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDuneGrass.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDuneGrass.java index 7d04211e3..3ea24604b 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDuneGrass.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDuneGrass.java @@ -9,6 +9,7 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; import tdwp_ftw.biomesop.mod_BiomesOPlenty; +@Deprecated public class BlockDuneGrass extends Block { protected BlockDuneGrass(int par1, Material par3Material) diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHighGrassBottom.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHighGrassBottom.java index 333090799..1fc9a2ad6 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHighGrassBottom.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHighGrassBottom.java @@ -13,6 +13,7 @@ import net.minecraft.world.ColorizerGrass; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +@Deprecated public class BlockHighGrassBottom extends BlockFlower { public BlockHighGrassBottom(int par1) diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHighGrassTop.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHighGrassTop.java index 18f646ea4..f3fbc6859 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHighGrassTop.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHighGrassTop.java @@ -10,6 +10,7 @@ import net.minecraft.world.ColorizerGrass; import net.minecraft.world.IBlockAccess; import tdwp_ftw.biomesop.configuration.BOPBlocks; +@Deprecated public class BlockHighGrassTop extends BlockFlower { public BlockHighGrassTop(int par1) diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHolyTallGrass.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHolyTallGrass.java index accc16741..f364c9c8a 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHolyTallGrass.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHolyTallGrass.java @@ -13,6 +13,7 @@ import net.minecraftforge.common.IShearable; import tdwp_ftw.biomesop.mod_BiomesOPlenty; import tdwp_ftw.biomesop.configuration.BOPBlocks; +@Deprecated public class BlockHolyTallGrass extends Block implements IShearable { protected BlockHolyTallGrass(int par1, Material par3Material) diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockMediumGrass.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockMediumGrass.java index 94bd5dea8..17dcaee3a 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockMediumGrass.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockMediumGrass.java @@ -18,6 +18,7 @@ import net.minecraft.world.World; import net.minecraftforge.common.IShearable; import tdwp_ftw.biomesop.configuration.BOPItems; +@Deprecated public class BlockMediumGrass extends BlockFlower implements IShearable { public BlockMediumGrass(int par1) diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockShortGrass.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockShortGrass.java index 27f15c436..23af03540 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockShortGrass.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockShortGrass.java @@ -16,6 +16,7 @@ import net.minecraft.world.World; import net.minecraftforge.common.IShearable; import tdwp_ftw.biomesop.configuration.BOPItems; +@Deprecated public class BlockShortGrass extends BlockFlower implements IShearable { public BlockShortGrass(int par1) diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockSprout.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockSprout.java index 92f980004..832d21b8c 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockSprout.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockSprout.java @@ -18,6 +18,7 @@ import net.minecraft.world.World; import net.minecraftforge.common.IShearable; import tdwp_ftw.biomesop.configuration.BOPItems; +@Deprecated public class BlockSprout extends BlockFlower implements IShearable { public BlockSprout(int par1) diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockThorn.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockThorn.java index da6dbaf1b..92ecfb4b6 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockThorn.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockThorn.java @@ -18,6 +18,7 @@ import net.minecraftforge.common.IShearable; import tdwp_ftw.biomesop.mod_BiomesOPlenty; import tdwp_ftw.biomesop.configuration.BOPBlocks; +@Deprecated public class BlockThorn extends Block implements IShearable { protected BlockThorn(int par1, Material par3Material) diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockTinyCactus.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockTinyCactus.java index 05b37d4a6..d66b87286 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockTinyCactus.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockTinyCactus.java @@ -11,6 +11,7 @@ import net.minecraft.util.DamageSource; import net.minecraft.world.World; import tdwp_ftw.biomesop.mod_BiomesOPlenty; +@Deprecated public class BlockTinyCactus extends Block { protected BlockTinyCactus(int par1, Material par3Material) diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockToadstool.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockToadstool.java index 5e4ca685f..39637424b 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockToadstool.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockToadstool.java @@ -9,6 +9,7 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; import tdwp_ftw.biomesop.mod_BiomesOPlenty; +@Deprecated public class BlockToadstool extends Block { protected BlockToadstool(int par1, Material par3Material) diff --git a/src/minecraft/tdwp_ftw/biomesop/configuration/BOPBlocks.java b/src/minecraft/tdwp_ftw/biomesop/configuration/BOPBlocks.java index 271c6e7ad..bd0fc4cc2 100644 --- a/src/minecraft/tdwp_ftw/biomesop/configuration/BOPBlocks.java +++ b/src/minecraft/tdwp_ftw/biomesop/configuration/BOPBlocks.java @@ -15,10 +15,12 @@ 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.ItemBOPFoliage; 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.ItemBOPPlant; import tdwp_ftw.biomesop.items.ItemBOPColorizedLeaves; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @@ -478,8 +480,8 @@ public class BOPBlocks { LanguageRegistry.addName(new ItemStack(Blocks.stoneSingleSlab.get(),1,0), "Red Rock Bricks Slab"); LanguageRegistry.addName(new ItemStack(Blocks.stoneSingleSlab.get(),1,1), "Red Rock Cobblestone Slab"); LanguageRegistry.addName(new ItemStack(Blocks.stoneSingleSlab.get(),1,2), "Mud Bricks Slab"); - - // Flowers - WORKING! + + // Flowers - WORKING! - need a fix for tiny cactus Blocks.flowers = Optional.of((new BlockBOPFlower(2002)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("flowers")); GameRegistry.registerBlock(Blocks.flowers.get(), ItemBOPFlower.class, "flowers"); @@ -492,8 +494,9 @@ public class BOPBlocks { LanguageRegistry.addName(new ItemStack(Blocks.flowers.get(),1,6), "Wildflower"); LanguageRegistry.addName(new ItemStack(Blocks.flowers.get(),1,7), "Violet"); LanguageRegistry.addName(new ItemStack(Blocks.flowers.get(),1,8), "Anemone"); + 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 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"); @@ -541,8 +544,29 @@ public class BOPBlocks { LanguageRegistry.addName(new ItemStack(Blocks.logs3.get(),1,0), "Redwood Wood"); LanguageRegistry.addName(new ItemStack(Blocks.logs3.get(),1,1), "Willow Wood"); LanguageRegistry.addName(new ItemStack(Blocks.logs3.get(),1,2), "Dead Wood"); -*/ + + // Foliage - WORKIMG! + Blocks.foliage = Optional.of((new BlockBOPFoliage(1988)).setUnlocalizedName("foliage")); + GameRegistry.registerBlock(Blocks.foliage.get(), ItemBOPFoliage.class, "foliage"); + + LanguageRegistry.addName(new ItemStack(Blocks.foliage.get(),1,0), "Short Grass"); + LanguageRegistry.addName(new ItemStack(Blocks.foliage.get(),1,1), "Medium Grass"); + LanguageRegistry.addName(new ItemStack(Blocks.foliage.get(),1,2), "High Grass"); + LanguageRegistry.addName(new ItemStack(Blocks.foliage.get(),1,3), "Bush"); + LanguageRegistry.addName(new ItemStack(Blocks.foliage.get(),1,4), "Sprout"); + + // Plants - Semi working + Blocks.plants = Optional.of((new BlockBOPPlant(1987)).setUnlocalizedName("plants")); + GameRegistry.registerBlock(Blocks.plants.get(), ItemBOPPlant.class, "plants"); + LanguageRegistry.addName(new ItemStack(Blocks.plants.get(),1,0), "Dead Grass"); + LanguageRegistry.addName(new ItemStack(Blocks.plants.get(),1,1), "Desert Grass"); + LanguageRegistry.addName(new ItemStack(Blocks.plants.get(),1,2), "Desert Sprouts"); + 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"); +*/ + // Add block registration GameRegistry.registerBlock(mud, "mud"); GameRegistry.registerBlock(driedDirt, "driedDirt"); diff --git a/src/minecraft/tdwp_ftw/biomesop/items/ItemBOPFlower.java b/src/minecraft/tdwp_ftw/biomesop/items/ItemBOPFlower.java index 8d0a975fd..c07fcd7e8 100644 --- a/src/minecraft/tdwp_ftw/biomesop/items/ItemBOPFlower.java +++ b/src/minecraft/tdwp_ftw/biomesop/items/ItemBOPFlower.java @@ -7,7 +7,7 @@ import net.minecraft.util.Icon; public class ItemBOPFlower extends ItemBlock { - private static final String[] plants = new String[] {"swampflower", "deadbloom", "glowflower", "hydrangea", "orangeflower", "pinkflower", "purpleflower", "violet", "whiteflower"}; + private static final String[] plants = new String[] {"swampflower", "deadbloom", "glowflower", "hydrangea", "orangeflower", "pinkflower", "purpleflower", "violet", "whiteflower", "toadstool", "cactus"}; public ItemBOPFlower(int par1) { diff --git a/src/minecraft/tdwp_ftw/biomesop/items/ItemBOPFoliage.java b/src/minecraft/tdwp_ftw/biomesop/items/ItemBOPFoliage.java new file mode 100644 index 000000000..ad0ef860c --- /dev/null +++ b/src/minecraft/tdwp_ftw/biomesop/items/ItemBOPFoliage.java @@ -0,0 +1,81 @@ +package tdwp_ftw.biomesop.items; + +import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Icon; +import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class ItemBOPFoliage extends ItemBlock +{ + private static final String[] foliageTypes = new String[] {"shortgrass", "mediumgrass", "highgrass", "bush", "sprout", "highgrasstop"}; + @SideOnly(Side.CLIENT) + private Icon[] textures; + + public ItemBOPFoliage(int par1) + { + super(par1); + setMaxDamage(0); + setHasSubtypes(true); + } + + @SideOnly(Side.CLIENT) + public void updateIcons(IconRegister iconRegister) + { + textures = new Icon[foliageTypes.length - 1]; + + for (int i = 0; i < foliageTypes.length - 1; ++i) + textures[i] = iconRegister.registerIcon("BiomesOPlenty:item" + foliageTypes[i]); + } + + @Override + public int getMetadata(int meta) + { + return meta; + } + + @Override + public String getUnlocalizedName(ItemStack itemStack) + { + return (new StringBuilder()).append(foliageTypes[itemStack.getItemDamage()]).toString(); + } + + @Override + public Icon getIconFromDamage(int meta) + { + if (meta == 5) + meta = 2; + return textures[meta]; + } + + public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) + { + + if (itemStack.getItemDamage() != 2) + { + return super.onItemUse(itemStack, player, world, x, y, z, side, hitX, hitY, hitZ); + } + else + { + ++y; + + if (!(player.canPlayerEdit(x, y, z, side, itemStack) || player.canPlayerEdit(x, y + 1, z, side, itemStack))) + return false; + else if (world.getBlockMaterial(x, y, z).isReplaceable() && world.getBlockMaterial(x, y + 1, z).isReplaceable()) + { + world.setBlock(x, y, z, itemStack.itemID, 2, 2); + world.setBlock(x, y + 1, z, itemStack.itemID, 5, 2); + world.notifyBlocksOfNeighborChange(x, y, z, itemStack.itemID); + world.notifyBlocksOfNeighborChange(x, y + 1, z, itemStack.itemID); + Block block = Block.blocksList[itemStack.itemID]; + world.playSoundEffect((double)((float)x + 0.5F), (double)((float)y + 0.5F), (double)((float)z + 0.5F), block.stepSound.getPlaceSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F); + --itemStack.stackSize; + } + return true; + } + } +} diff --git a/src/minecraft/tdwp_ftw/biomesop/items/ItemBOPPlant.java b/src/minecraft/tdwp_ftw/biomesop/items/ItemBOPPlant.java new file mode 100644 index 000000000..c93fb97ad --- /dev/null +++ b/src/minecraft/tdwp_ftw/biomesop/items/ItemBOPPlant.java @@ -0,0 +1,36 @@ +package tdwp_ftw.biomesop.items; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Icon; + +public class ItemBOPPlant extends ItemBlock +{ + private static final String[] plants = new String[] {"deadgrass", "desertgrass", "desertsprouts", "dunegrass", "holytallgrass", "thorn"}; + + public ItemBOPPlant(int par1) + { + super(par1); + setMaxDamage(0); + setHasSubtypes(true); + } + + @Override + public int getMetadata(int meta) + { + return meta; + } + + @Override + public String getUnlocalizedName(ItemStack itemStack) + { + return (new StringBuilder()).append(plants[itemStack.getItemDamage()]).toString(); + } + + @Override + public Icon getIconFromDamage(int meta) + { + return Block.blocksList[this.itemID].getBlockTextureFromSideAndMetadata(0, meta); + } +}