Compression continues - Flowers

This commit is contained in:
Amnet 2013-04-14 00:16:42 +02:00
parent cd8dac3c8c
commit 2c931fa8f4
13 changed files with 135 additions and 8 deletions

View file

@ -0,0 +1,66 @@
package tdwp_ftw.biomesop.blocks;
import java.util.List;
import net.minecraft.block.BlockFlower;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import cpw.mods.fml.relauncher.Side;
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"};
@SideOnly(Side.CLIENT)
private Icon[] textures;
protected BlockBOPFlower(int blockID, Material material)
{
super(blockID, material);
this.setTickRandomly(true);
float var4 = 0.2F;
this.setBlockBounds(0.5F - var4, 0.0F, 0.5F - var4, 0.5F + var4, var4 * 3.0F, 0.5F + var4);
this.setCreativeTab(mod_BiomesOPlenty.tabBiomesOPlenty);
}
public BlockBOPFlower(int blockID)
{
this(blockID, Material.plants);
}
@Override
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 int damageDropped(int meta)
{
return meta;
}
}

View file

@ -21,18 +21,18 @@ import tdwp_ftw.biomesop.configuration.BOPBlocks;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
public class BlockFoliage extends BlockFlower implements IShearable 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", "highgrasstop"};
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private Icon[] textures = {null, null, null, null}; private Icon[] textures = {null, null, null, null};
private final int metadata; private final int metadata;
public BlockFoliage(int blockID, int index) public BlockBOPFoliage(int blockID, int index)
{ {
super(blockID, Material.vine); super(blockID, Material.vine);
float f = 0.4F; float f = 0.4F;
BlockFoliage.setBurnProperties(this.blockID, 60, 100); BlockBOPFoliage.setBurnProperties(this.blockID, 60, 100);
metadata = index; metadata = index;
if (metadata == 3) if (metadata == 3)

View file

@ -9,6 +9,7 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World; import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty; import tdwp_ftw.biomesop.mod_BiomesOPlenty;
@Deprecated
public class BlockBlueFlower extends Block public class BlockBlueFlower extends Block
{ {
protected BlockBlueFlower(int par1, Material par3Material) protected BlockBlueFlower(int par1, Material par3Material)

View file

@ -9,6 +9,7 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World; import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty; import tdwp_ftw.biomesop.mod_BiomesOPlenty;
@Deprecated
public class BlockDeathbloom extends Block public class BlockDeathbloom extends Block
{ {
protected BlockDeathbloom(int par1, Material par3Material) protected BlockDeathbloom(int par1, Material par3Material)

View file

@ -10,6 +10,7 @@ import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty; import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import tdwp_ftw.biomesop.configuration.BOPBlocks; import tdwp_ftw.biomesop.configuration.BOPBlocks;
@Deprecated
public class BlockGlowFlower extends Block public class BlockGlowFlower extends Block
{ {
protected BlockGlowFlower(int par1, Material par3Material) protected BlockGlowFlower(int par1, Material par3Material)

View file

@ -9,6 +9,7 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World; import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty; import tdwp_ftw.biomesop.mod_BiomesOPlenty;
@Deprecated
public class BlockHydrangea extends Block public class BlockHydrangea extends Block
{ {
protected BlockHydrangea(int par1, Material par3Material) protected BlockHydrangea(int par1, Material par3Material)

View file

@ -9,6 +9,7 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World; import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty; import tdwp_ftw.biomesop.mod_BiomesOPlenty;
@Deprecated
public class BlockOrangeFlower extends Block public class BlockOrangeFlower extends Block
{ {
protected BlockOrangeFlower(int par1, Material par3Material) protected BlockOrangeFlower(int par1, Material par3Material)

View file

@ -10,6 +10,7 @@ import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty; import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import tdwp_ftw.biomesop.configuration.BOPBlocks; import tdwp_ftw.biomesop.configuration.BOPBlocks;
@Deprecated
public class BlockPinkFlower extends Block public class BlockPinkFlower extends Block
{ {
protected BlockPinkFlower(int par1, Material par3Material) protected BlockPinkFlower(int par1, Material par3Material)

View file

@ -9,6 +9,7 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World; import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty; import tdwp_ftw.biomesop.mod_BiomesOPlenty;
@Deprecated
public class BlockPurpleFlower extends Block public class BlockPurpleFlower extends Block
{ {
protected BlockPurpleFlower(int par1, Material par3Material) protected BlockPurpleFlower(int par1, Material par3Material)

View file

@ -9,6 +9,7 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World; import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty; import tdwp_ftw.biomesop.mod_BiomesOPlenty;
@Deprecated
public class BlockViolet extends Block public class BlockViolet extends Block
{ {
protected BlockViolet(int par1, Material par3Material) protected BlockViolet(int par1, Material par3Material)

View file

@ -9,6 +9,7 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World; import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty; import tdwp_ftw.biomesop.mod_BiomesOPlenty;
@Deprecated
public class BlockWhiteFlower extends Block public class BlockWhiteFlower extends Block
{ {
protected BlockWhiteFlower(int par1, Material par3Material) protected BlockWhiteFlower(int par1, Material par3Material)

View file

@ -7,6 +7,7 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
import tdwp_ftw.biomesop.blocks.*; import tdwp_ftw.biomesop.blocks.*;
import tdwp_ftw.biomesop.items.ItemBOPFlower;
import tdwp_ftw.biomesop.items.ItemBOPPlank; import tdwp_ftw.biomesop.items.ItemBOPPlank;
import tdwp_ftw.biomesop.items.ItemBOPSlab; import tdwp_ftw.biomesop.items.ItemBOPSlab;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
@ -188,10 +189,12 @@ public class BOPBlocks {
public static BlockHalfSlab holySingleSlab; public static BlockHalfSlab holySingleSlab;
public static Block holyStairs; public static Block holyStairs;
public static Block planks; // New definitions
public static Block stairs; // public static Block planks;
public static BlockHalfSlab singleSlab; // public static Block stairs;
public static BlockHalfSlab doubleSlab; // public static BlockHalfSlab singleSlab;
// public static BlockHalfSlab doubleSlab;
// public static Block flowers;
public static void init() public static void init()
{ {
@ -428,6 +431,20 @@ public class BOPBlocks {
LanguageRegistry.addName(new ItemStack(stairs,1,7), "Palm Wood Stairs"); LanguageRegistry.addName(new ItemStack(stairs,1,7), "Palm Wood Stairs");
LanguageRegistry.addName(new ItemStack(stairs,1,8), "Redwood Wood Stairs"); LanguageRegistry.addName(new ItemStack(stairs,1,8), "Redwood Wood Stairs");
LanguageRegistry.addName(new ItemStack(stairs,1,9), "Willow Wood Stairs"); LanguageRegistry.addName(new ItemStack(stairs,1,9), "Willow Wood Stairs");
// Flowers - mostly working, missing glow on Glowflower
flowers = (new BlockBOPFlower(2000)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("flowers");
GameRegistry.registerBlock(flowers, ItemBOPFlower.class, "plants");
LanguageRegistry.addName(new ItemStack(flowers,1,0), "Swampflower");
LanguageRegistry.addName(new ItemStack(flowers,1,1), "Deathbloom");
LanguageRegistry.addName(new ItemStack(flowers,1,2), "Glowflower");
LanguageRegistry.addName(new ItemStack(flowers,1,3), "Hydrangea");
LanguageRegistry.addName(new ItemStack(flowers,1,4), "Daisy");
LanguageRegistry.addName(new ItemStack(flowers,1,5), "Tulip");
LanguageRegistry.addName(new ItemStack(flowers,1,6), "Wildflower");
LanguageRegistry.addName(new ItemStack(flowers,1,7), "Violet");
LanguageRegistry.addName(new ItemStack(flowers,1,8), "Anemone");
*/ */
// Add block registration // Add block registration

View file

@ -0,0 +1,35 @@
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 ItemBOPFlower extends ItemBlock
{
private static final String[] plants = new String[] {"swampflower", "deadbloom", "glowflower", "hydrangea", "orangeflower", "pinkflower", "purpleflower", "violet", "whiteflower"};
public ItemBOPFlower(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();
}
public Icon getIconFromDamage(int meta)
{
return Block.blocksList[this.itemID].getBlockTextureFromSideAndMetadata(0, meta);
}
}