Compression continues - Flowers
This commit is contained in:
parent
cd8dac3c8c
commit
2c931fa8f4
13 changed files with 135 additions and 8 deletions
66
src/minecraft/tdwp_ftw/biomesop/blocks/BlockBOPFlower.java
Normal file
66
src/minecraft/tdwp_ftw/biomesop/blocks/BlockBOPFlower.java
Normal 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;
|
||||
}
|
||||
}
|
|
@ -21,18 +21,18 @@ import tdwp_ftw.biomesop.configuration.BOPBlocks;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
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"};
|
||||
@SideOnly(Side.CLIENT)
|
||||
private Icon[] textures = {null, null, null, null};
|
||||
private final int metadata;
|
||||
|
||||
public BlockFoliage(int blockID, int index)
|
||||
public BlockBOPFoliage(int blockID, int index)
|
||||
{
|
||||
super(blockID, Material.vine);
|
||||
float f = 0.4F;
|
||||
BlockFoliage.setBurnProperties(this.blockID, 60, 100);
|
||||
BlockBOPFoliage.setBurnProperties(this.blockID, 60, 100);
|
||||
metadata = index;
|
||||
|
||||
if (metadata == 3)
|
|
@ -9,6 +9,7 @@ import net.minecraft.util.AxisAlignedBB;
|
|||
import net.minecraft.world.World;
|
||||
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
|
||||
|
||||
@Deprecated
|
||||
public class BlockBlueFlower extends Block
|
||||
{
|
||||
protected BlockBlueFlower(int par1, Material par3Material)
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.util.AxisAlignedBB;
|
|||
import net.minecraft.world.World;
|
||||
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
|
||||
|
||||
@Deprecated
|
||||
public class BlockDeathbloom extends Block
|
||||
{
|
||||
protected BlockDeathbloom(int par1, Material par3Material)
|
||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.world.World;
|
|||
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
|
||||
import tdwp_ftw.biomesop.configuration.BOPBlocks;
|
||||
|
||||
@Deprecated
|
||||
public class BlockGlowFlower extends Block
|
||||
{
|
||||
protected BlockGlowFlower(int par1, Material par3Material)
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.util.AxisAlignedBB;
|
|||
import net.minecraft.world.World;
|
||||
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
|
||||
|
||||
@Deprecated
|
||||
public class BlockHydrangea extends Block
|
||||
{
|
||||
protected BlockHydrangea(int par1, Material par3Material)
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.util.AxisAlignedBB;
|
|||
import net.minecraft.world.World;
|
||||
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
|
||||
|
||||
@Deprecated
|
||||
public class BlockOrangeFlower extends Block
|
||||
{
|
||||
protected BlockOrangeFlower(int par1, Material par3Material)
|
||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.world.World;
|
|||
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
|
||||
import tdwp_ftw.biomesop.configuration.BOPBlocks;
|
||||
|
||||
@Deprecated
|
||||
public class BlockPinkFlower extends Block
|
||||
{
|
||||
protected BlockPinkFlower(int par1, Material par3Material)
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.util.AxisAlignedBB;
|
|||
import net.minecraft.world.World;
|
||||
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
|
||||
|
||||
@Deprecated
|
||||
public class BlockPurpleFlower extends Block
|
||||
{
|
||||
protected BlockPurpleFlower(int par1, Material par3Material)
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.util.AxisAlignedBB;
|
|||
import net.minecraft.world.World;
|
||||
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
|
||||
|
||||
@Deprecated
|
||||
public class BlockViolet extends Block
|
||||
{
|
||||
protected BlockViolet(int par1, Material par3Material)
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.util.AxisAlignedBB;
|
|||
import net.minecraft.world.World;
|
||||
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
|
||||
|
||||
@Deprecated
|
||||
public class BlockWhiteFlower extends Block
|
||||
{
|
||||
protected BlockWhiteFlower(int par1, Material par3Material)
|
||||
|
|
|
@ -7,6 +7,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import tdwp_ftw.biomesop.blocks.*;
|
||||
import tdwp_ftw.biomesop.items.ItemBOPFlower;
|
||||
import tdwp_ftw.biomesop.items.ItemBOPPlank;
|
||||
import tdwp_ftw.biomesop.items.ItemBOPSlab;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
@ -188,10 +189,12 @@ public class BOPBlocks {
|
|||
public static BlockHalfSlab holySingleSlab;
|
||||
public static Block holyStairs;
|
||||
|
||||
public static Block planks;
|
||||
public static Block stairs;
|
||||
public static BlockHalfSlab singleSlab;
|
||||
public static BlockHalfSlab doubleSlab;
|
||||
// New definitions
|
||||
// public static Block planks;
|
||||
// public static Block stairs;
|
||||
// public static BlockHalfSlab singleSlab;
|
||||
// public static BlockHalfSlab doubleSlab;
|
||||
// public static Block flowers;
|
||||
|
||||
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,8), "Redwood 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
|
||||
|
|
35
src/minecraft/tdwp_ftw/biomesop/items/ItemBOPFlower.java
Normal file
35
src/minecraft/tdwp_ftw/biomesop/items/ItemBOPFlower.java
Normal 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);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue