Generic blocks that have one texture file.

This commit is contained in:
Amnet 2013-04-18 21:29:40 +02:00
parent d94a69b0f3
commit 17cb0310d8
22 changed files with 437 additions and 51 deletions

View File

@ -54,6 +54,7 @@ public class Blocks
public static Optional<? extends Block> flowers = Optional.absent();
public static Optional<? extends Block> leaves = Optional.absent();
public static Optional<? extends Block> leavesColorized = Optional.absent();
public static Optional<? extends Block> leavesFruit = Optional.absent();
public static Optional<? extends Block> foliage = Optional.absent();
public static Optional<? extends Block> plants = Optional.absent();
public static Optional<? extends Block> flatPlants = Optional.absent();
@ -64,5 +65,8 @@ public class Blocks
public static Optional<? extends Block> moss = Optional.absent();
public static Optional<? extends Block> petals = Optional.absent();
public static Optional<? extends Block> decorativeBlocks = Optional.absent();
public static Optional<? extends Block> amethystBlock = Optional.absent();
public static Optional<? extends Block> amethystOre = Optional.absent();
public static Optional<? extends Block> bambooThatching = Optional.absent();
public static Optional<? extends Block> mudBrick = Optional.absent();
}

View File

@ -9,6 +9,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
@Deprecated
public class BlockAmethystBlock extends Block
{
public BlockAmethystBlock(int par1)

View File

@ -11,6 +11,7 @@ import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
@Deprecated
public class BlockAmethystOre extends Block
{
public BlockAmethystOre(int par1)

View File

@ -20,6 +20,7 @@ import net.minecraftforge.common.IShearable;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@Deprecated
public class BlockAppleLeaves extends BlockLeavesBase implements IShearable
{
/**

View File

@ -20,6 +20,7 @@ import net.minecraftforge.common.IShearable;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@Deprecated
public class BlockAppleLeavesFruitless extends BlockLeavesBase implements IShearable
{
/**

View File

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

View File

@ -7,6 +7,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.world.IBlockAccess;
@Deprecated
public class BlockAshStone extends Block
{
public BlockAshStone(int par1)

View File

@ -0,0 +1,132 @@
package biomesoplenty.blocks;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import biomesoplenty.mod_BiomesOPlenty;
import biomesoplenty.api.Blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLeavesBase;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
import net.minecraftforge.common.IShearable;
public class BlockBOPAppleLeaves extends BlockLeavesBase implements IShearable
{
private static final String[] leaves = new String[] {"apple"};
@SideOnly(Side.CLIENT)
private Icon[][] textures;
public BlockBOPAppleLeaves(int blockID)
{
super(blockID, Material.leaves, false);
setBurnProperties(this.blockID, 30, 60);
this.setTickRandomly(true);
setHardness(0.2F);
setLightOpacity(1);
setStepSound(Block.soundGrassFootstep);
this.setCreativeTab(mod_BiomesOPlenty.tabBiomesOPlenty);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister)
{
textures = new Icon[2][2];
textures[0][0] = iconRegister.registerIcon("BiomesOPlenty:" + leaves[0] + "leaves3");
textures[1][0] = iconRegister.registerIcon("BiomesOPlenty:" + leaves[0] + "leaves4");
textures[0][1] = iconRegister.registerIcon("BiomesOPlenty:" + leaves[0] + "leaves1");
textures[1][1] = iconRegister.registerIcon("BiomesOPlenty:" + leaves[0] + "leaves2");
}
@Override
@SideOnly(Side.CLIENT)
public Icon getIcon(int side, int meta)
{
if (meta < 0 || meta >= textures[0].length)
meta = 0;
return textures[(!isOpaqueCube() ? 0 : 1)][meta];
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(int blockID, CreativeTabs creativeTabs, List list) {
list.add(new ItemStack(blockID, 1, 0));
}
@Override
public void updateTick (World world, int x, int y, int z, Random random)
{
if (world.isRemote)
return;
// if (random1.nextInt(20) == 0 && world.getBlockLightValue(x, y, z) >= 8)
// {
int meta = world.getBlockMetadata(x, y, z);
if (meta < 1)
world.setBlock(x, y, z, blockID, meta + 1, 3);
// }
}
@Override
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
{
if (world.isRemote)
return false;
int meta = world.getBlockMetadata(x, y, z);
if (meta == 1)
{
world.setBlock(x, y, z, blockID, 0, 3);
EntityItem entityitem = new EntityItem(world, player.posX, player.posY - 1.0D, player.posZ, new ItemStack(Item.appleRed, 1, 0));
world.spawnEntityInWorld(entityitem);
entityitem.onCollideWithPlayer(player);
}
return true;
}
@Override
public int idDropped(int par1, Random par2Random, int par3)
{
return Blocks.saplings.get().blockID;
}
@Override
public int damageDropped(int meta)
{
return 0;
}
@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)
{
return true;
}
@Override
public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ret.add(new ItemStack(this, 1, 0));
return ret;
}
}

View File

@ -0,0 +1,185 @@
package biomesoplenty.blocks;
import java.util.Random;
import biomesoplenty.mod_BiomesOPlenty;
import biomesoplenty.configuration.BOPItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class BlockBOPGeneric extends Block
{
public enum BlockType
{
ASH_STONE, HARD_SAND, HARD_DIRT, HARD_ICE, HOLY_STONE, AMETHYST_ORE, AMETHYST_BLOCK, BAMBOO_THATCHING, DRIED_DIRT, CRAG_ROCK, MUD_BRICK;
}
@SideOnly(Side.CLIENT)
private Icon texture;
private BlockType type;
public BlockBOPGeneric(int id, Material material, BlockType type)
{
super(id, material);
this.type = type;
this.setCreativeTab(mod_BiomesOPlenty.tabBiomesOPlenty);
switch (type)
{
case AMETHYST_BLOCK:
setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundMetalFootstep).setUnlocalizedName("amethystBlock");
break;
case AMETHYST_ORE:
setHardness(3.0F).setResistance(5.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("amethystOre");
break;
case ASH_STONE:
setHardness(1.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("ashStone");
break;
case BAMBOO_THATCHING:
setHardness(1.0F).setResistance(5.0F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("bambooThatching");
break;
case CRAG_ROCK:
setHardness(1.0F).setStepSound(Block.soundGravelFootstep).setUnlocalizedName("cragRock");
break;
case DRIED_DIRT:
setHardness(0.1F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("driedDirt");
break;
case HARD_DIRT:
setHardness(0.9F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("hardDirt");
break;
case HARD_ICE:
setHardness(0.75F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("hardIce");
break;
case HARD_SAND:
setHardness(0.7F).setStepSound(Block.soundSandFootstep).setUnlocalizedName("hardSand");
break;
case HOLY_STONE:
setHardness(1.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("holyStone");
break;
case MUD_BRICK:
setHardness(1.0F).setResistance(2.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("mudBrick");
break;
default:
break;
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister)
{
switch (type)
{
case AMETHYST_BLOCK:
texture = iconRegister.registerIcon("BiomesOPlenty:amethystblock");
break;
case AMETHYST_ORE:
texture = iconRegister.registerIcon("BiomesOPlenty:amethystore");
break;
case ASH_STONE:
texture = iconRegister.registerIcon("BiomesOPlenty:ashstone");
break;
case BAMBOO_THATCHING:
texture = iconRegister.registerIcon("BiomesOPlenty:bamboothatching");
break;
case CRAG_ROCK:
texture = iconRegister.registerIcon("BiomesOPlenty:cragrock");
break;
case DRIED_DIRT:
texture = iconRegister.registerIcon("BiomesOPlenty:drieddirt");
break;
case HARD_DIRT:
texture = iconRegister.registerIcon("BiomesOPlenty:harddirt");
break;
case HARD_ICE:
texture = iconRegister.registerIcon("BiomesOPlenty:hardice");
break;
case HARD_SAND:
texture = iconRegister.registerIcon("BiomesOPlenty:hardsand");
break;
case HOLY_STONE:
texture = iconRegister.registerIcon("BiomesOPlenty:holystone");
break;
case MUD_BRICK:
texture = iconRegister.registerIcon("BiomesOPlenty:mudbrick");
break;
default:
break;
}
}
@Override
@SideOnly(Side.CLIENT)
public Icon getIcon(int side, int meta)
{
return texture;
}
@Override
public int idDropped(int par1, Random par2Random, int par3)
{
return type == BlockType.AMETHYST_ORE ? BOPItems.amethyst.itemID : this.blockID;
}
@Override
public int quantityDropped(Random par1Random)
{
return type == BlockType.AMETHYST_ORE ? 1 + par1Random.nextInt(2) : 1;
}
@Override
public int quantityDroppedWithBonus(int bonus, Random par2Random)
{
if (bonus > 0 && this.blockID != this.idDropped(0, par2Random, bonus))
{
int rnd = par2Random.nextInt(bonus + 2) - 1;
if (rnd < 0)
rnd = 0;
return this.quantityDropped(par2Random) * (rnd + 1);
}
else
return this.quantityDropped(par2Random);
}
@Override
public void dropBlockAsItemWithChance(World world, int par2, int par3, int par4, int par5, float par6, int par7)
{
super.dropBlockAsItemWithChance(world, par2, par3, par4, par5, par6, par7);
if (this.idDropped(par5, world.rand, par7) != this.blockID)
{
int var8 = MathHelper.getRandomIntegerInRange(world.rand, 1, 4);
this.dropXpOnBlockBreak(world, par2, par3, par4, var8);
}
}
}

View File

@ -78,7 +78,7 @@ public class BlockBOPLeaves extends BlockLeavesBase implements IShearable
@Override
public int damageDropped(int meta)
{
return meta & 15;
return (meta & 15) + 1;
}
@Override

View File

@ -12,6 +12,7 @@ import net.minecraft.util.Icon;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
import biomesoplenty.mod_BiomesOPlenty;
import biomesoplenty.worldgen.WorldGenApple;
import biomesoplenty.worldgen.WorldGenAutumn;
import biomesoplenty.worldgen.WorldGenAutumn2;
import biomesoplenty.worldgen.WorldGenBambooTree;
@ -31,7 +32,7 @@ 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"};
private static final String[] saplings = new String[] {"apple", "yellow", "bamboo", "magic", "dark", "brown", "fir", "holy", "orange", "origin", "pink", "red", "white"};
@SideOnly(Side.CLIENT)
private Icon[] textures;
private static final int TYPES = 15;
@ -78,16 +79,20 @@ public class BlockBOPSapling extends BlockSapling
int meta = world.getBlockMetadata(x, y, z) & TYPES;
Object obj = null;
int rnd = random.nextInt(8);
System.out.println(meta);
if (obj == null)
{
switch (meta)
{
case 0: // Autumn Tree
case 0: // Apple Tree
obj = new WorldGenApple(false);
break;
case 1: // Autumn Tree
obj = new WorldGenAutumn(false);
break;
case 1: // Bamboo Tree
case 2: // Bamboo Tree
rnd = random.nextInt(8);
if (rnd == 0)
@ -96,11 +101,11 @@ public class BlockBOPSapling extends BlockSapling
obj = new WorldGenBambooTree2(false);
break;
case 2: // Magic Tree
case 3: // Magic Tree
obj = new WorldGenMystic2(false);
break;
case 3: // Dark Tree
case 4: // Dark Tree
rnd = random.nextInt(8);
if (rnd == 0)
@ -109,35 +114,35 @@ public class BlockBOPSapling extends BlockSapling
obj = new WorldGenOminous1(false);
break;
case 4: // Dead Tree
case 5: // Dead Tree
obj = new WorldGenDeadTree2(false);
break;
case 5: // Fir Tree
case 6: // Fir Tree
obj = new WorldGenTaiga9(false);
break;
case 6: // Holy Tree
case 7: // Holy Tree
obj = new WorldGenPromisedTree(false);
break;
case 7: // Autumn Tree
case 8: // Autumn Tree
obj = new WorldGenAutumn2(false);
break;
case 8: // Origin Tree
case 9: // Origin Tree
obj = new WorldGenOriginTree(false);
break;
case 9: // Pink Cherry Tree
case 10: // Pink Cherry Tree
obj = new WorldGenCherry1(false);
break;
case 10: // Maple Tree
case 11: // Maple Tree
obj = new WorldGenMaple(false);
break;
case 11: // White Cherry Tree
case 12: // White Cherry Tree
obj = new WorldGenCherry2(false);
break;
}

View File

@ -1,6 +0,0 @@
package biomesoplenty.blocks;
public class BlockBOPVines
{
}

View File

@ -9,6 +9,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
@Deprecated
public class BlockBambooThatching extends Block
{
public BlockBambooThatching(int par1)

View File

@ -9,6 +9,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
@Deprecated
public class BlockCragRock extends Block
{
public BlockCragRock(int par1)

View File

@ -9,6 +9,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.world.World;
@Deprecated
public class BlockDriedDirt extends Block
{
public BlockDriedDirt(int par1)

View File

@ -6,6 +6,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
@Deprecated
public class BlockHardDirt extends Block
{
public BlockHardDirt(int par1)

View File

@ -6,6 +6,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
@Deprecated
public class BlockHardIce extends Block
{
public BlockHardIce(int par1)

View File

@ -6,6 +6,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
@Deprecated
public class BlockHardSand extends Block
{
public BlockHardSand(int par1)

View File

@ -9,6 +9,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
@Deprecated
public class BlockHolyStone extends Block
{
public BlockHolyStone(int par1)

View File

@ -6,6 +6,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
@Deprecated
public class BlockMudBrick extends Block
{
public BlockMudBrick(int par1)

View File

@ -3,6 +3,7 @@ package biomesoplenty.configuration;
import static com.google.common.base.Preconditions.checkNotNull;
import biomesoplenty.api.Blocks;
import biomesoplenty.blocks.*;
import biomesoplenty.blocks.BlockBOPGeneric.BlockType;
import biomesoplenty.blocks.BlockBOPLog.LogCategory;
import biomesoplenty.blocks.BlockBOPSlab.SlabCategory;
import biomesoplenty.blocks.BlockBOPStairs.Category;
@ -36,7 +37,7 @@ public class BOPBlocks {
// Block declaration
public static Block mud; // Worldgen
public static Block driedDirt; // Worldgen
public static Block driedDirt; // DONE (Worldgen)
public static Block redRock; // DONE (Worldgen)
public static Block ash; // Worldgen
public static Block deadGrass; // DONE
@ -54,7 +55,7 @@ public class BOPBlocks {
public static Block toadstool; // DONE
public static BlockHighGrassBottom highGrassBottom; // DONE
public static BlockHighGrassTop highGrassTop; // DONE
public static Block ashStone; // Worldgen
public static Block ashStone; // DONE (Worldgen)
public static Block hardIce; // DONE
public static Block redLeaves; // DONE
public static Block orangeLeaves; // DONE
@ -63,12 +64,12 @@ public class BOPBlocks {
public static Block whiteLeaves; // DONE
public static Block deadLeaves; // DONE
public static BlockShortGrass shortGrass; // DONE
public static Block appleLeaves;
public static Block appleLeaves; // DONE
public static BlockSprout sprout; // DONE
public static BlockBush bush; // DONE
public static Block bamboo;
public static Block bambooLeaves; // DONE
public static Block mudBrickBlock;
public static Block mudBrickBlock; // DONE
public static BlockHalfSlab mudBrickDoubleSlab; // DONE
public static BlockHalfSlab mudBrickSingleSlab; // DONE
public static Block mudBrickStairs; // DONE
@ -77,7 +78,7 @@ public class BOPBlocks {
public static Block pinkFlower; // DONE
public static Block treeMoss; // Leave
public static Block deadWood; // DONE
public static Block appleLeavesFruitless;
public static Block appleLeavesFruitless; // DONE
public static Block barley; // DONE
public static Block giantFlowerStem;
public static Block giantFlowerRed; // DONE
@ -91,7 +92,7 @@ public class BOPBlocks {
public static Block yellowSapling; // DONE
public static Block brownSapling; // DONE
public static Block willowSapling; // DONE
public static Block appleSapling;
public static Block appleSapling; // DONE
public static Block originSapling; // DONE
public static Block pinkSapling; // DONE
public static Block whiteSapling; // DONE
@ -112,21 +113,21 @@ public class BOPBlocks {
public static Block duneGrass; // DONE
public static Block desertSprouts; // DONE
public static Block mangroveSapling; // DONE
public static Block hardSand; // Worldgen
public static Block hardSand; // DONE (Worldgen)
public static Block acaciaSapling; // DONE
public static Block hardDirt; // Worldgen
public static Block hardDirt; // DONE (Worldgen)
public static Block holyGrass; // Worldgen
public static Block holyStone; // Worldgen
public static Block holyStone; // DONE (Worldgen)
public static Block holyTallGrass; // DONE
public static Block promisedPortal; // Leave
public static Block holySapling; // DONE
public static Block amethystOre;
public static Block amethystBlock;
public static Block bambooThatching;
public static Block amethystOre; // DONE
public static Block amethystBlock; // DONE
public static Block bambooThatching; // DONE
public static Block moss; // Leave
public static Block algae; // DONE
public static Block smolderingGrass;
public static Block cragRock; // Worldgen
public static Block cragRock; // DONE (Worldgen)
public static Block quicksand;
public static Block bambooSapling; // DONE
@ -547,7 +548,12 @@ public class BOPBlocks {
LanguageRegistry.addName(new ItemStack(Blocks.leavesColorized.get(),1,2), "Palm Leaves");
LanguageRegistry.addName(new ItemStack(Blocks.leavesColorized.get(),1,3), "Redwood Leaves");
LanguageRegistry.addName(new ItemStack(Blocks.leavesColorized.get(),1,4), "Willow Leaves");
*/
Blocks.leavesFruit = Optional.of((new BlockBOPAppleLeaves(2000)).setUnlocalizedName("leavesFruit"));
GameRegistry.registerBlock(Blocks.leavesFruit.get(), "leavesFruit");
LanguageRegistry.addName(Blocks.leavesFruit.get(), "Apple Leaves");
/*
// Logs - WORKING!
Blocks.logs1 = Optional.of((new BlockBOPLog(2003,LogCategory.CAT1)).setUnlocalizedName("wood1"));
Blocks.logs2 = Optional.of((new BlockBOPLog(2004,LogCategory.CAT2)).setUnlocalizedName("wood2"));
@ -593,24 +599,25 @@ public class BOPBlocks {
LanguageRegistry.addName(new ItemStack(Blocks.plants.get(),1,5), "Thorns");
LanguageRegistry.addName(new ItemStack(Blocks.plants.get(),1,6), "Barley");
LanguageRegistry.addName(new ItemStack(Blocks.plants.get(),1,7), "Cattail");
*/
// 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");
LanguageRegistry.addName(new ItemStack(Blocks.saplings.get(),1,0), "Apple Sapling");
LanguageRegistry.addName(new ItemStack(Blocks.saplings.get(),1,1), "Autumn Sapling");
LanguageRegistry.addName(new ItemStack(Blocks.saplings.get(),1,2), "Bamboo Sapling");
LanguageRegistry.addName(new ItemStack(Blocks.saplings.get(),1,3), "Magic Sapling");
LanguageRegistry.addName(new ItemStack(Blocks.saplings.get(),1,4), "Dark Sapling");
LanguageRegistry.addName(new ItemStack(Blocks.saplings.get(),1,5), "Dying Sapling");
LanguageRegistry.addName(new ItemStack(Blocks.saplings.get(),1,6), "Fir Sapling");
LanguageRegistry.addName(new ItemStack(Blocks.saplings.get(),1,7), "Holy Sapling");
LanguageRegistry.addName(new ItemStack(Blocks.saplings.get(),1,8), "Autumn Sapling");
LanguageRegistry.addName(new ItemStack(Blocks.saplings.get(),1,9), "Origin Sapling");
LanguageRegistry.addName(new ItemStack(Blocks.saplings.get(),1,10), "Cherry Sapling");
LanguageRegistry.addName(new ItemStack(Blocks.saplings.get(),1,11), "Maple Sapling");
LanguageRegistry.addName(new ItemStack(Blocks.saplings.get(),1,12), "Cherry Sapling");
/*
Blocks.colorizedSaplings = Optional.of((new BlockBOPColorizedSapling(1985)).setUnlocalizedName("colorizedSaplings"));
GameRegistry.registerBlock(Blocks.colorizedSaplings.get(), ItemBOPColorizedSapling.class, "colorizedSaplings");
@ -626,6 +633,49 @@ public class BOPBlocks {
LanguageRegistry.addName(new ItemStack(Blocks.petals.get(),1,0), "Giant Red Flower");
LanguageRegistry.addName(new ItemStack(Blocks.petals.get(),1,1), "Giant Yellow Flower");
*/
Blocks.amethystBlock = Optional.of(new BlockBOPGeneric(1960, Material.iron, BlockType.AMETHYST_BLOCK));
GameRegistry.registerBlock(Blocks.amethystBlock.get(), "amethystBlock2");
LanguageRegistry.addName(Blocks.amethystBlock.get(), "Block of Amethyst");
Blocks.amethystOre = Optional.of(new BlockBOPGeneric(1961, Material.rock, BlockType.AMETHYST_ORE));
GameRegistry.registerBlock(Blocks.amethystOre.get(), "amethystOre2");
LanguageRegistry.addName(Blocks.amethystOre.get(), "Amethyst Ore");
Blocks.ashStone = Optional.of(new BlockBOPGeneric(1962, Material.rock, BlockType.ASH_STONE));
GameRegistry.registerBlock(Blocks.ashStone.get(), "ashStone2");
LanguageRegistry.addName(Blocks.ashStone.get(), "Ash Stone");
Blocks.bambooThatching = Optional.of(new BlockBOPGeneric(1963, Material.wood, BlockType.BAMBOO_THATCHING));
GameRegistry.registerBlock(Blocks.bambooThatching.get(), "bambooThatching2");
LanguageRegistry.addName(Blocks.bambooThatching.get(), "Bamboo Thatching");
Blocks.driedDirt = Optional.of(new BlockBOPGeneric(1964, Material.rock, BlockType.DRIED_DIRT));
GameRegistry.registerBlock(Blocks.driedDirt.get(), "driedDirt2");
LanguageRegistry.addName(Blocks.driedDirt.get(), "Dried Dirt");
Blocks.hardDirt = Optional.of(new BlockBOPGeneric(1965, Material.rock, BlockType.HARD_DIRT));
GameRegistry.registerBlock(Blocks.hardDirt.get(), "hardDirt2");
LanguageRegistry.addName(Blocks.hardDirt.get(), "Hard Dirt");
Blocks.hardIce = Optional.of(new BlockBOPGeneric(1966, Material.rock, BlockType.HARD_ICE));
GameRegistry.registerBlock(Blocks.hardIce.get(), "hardIce2");
LanguageRegistry.addName(Blocks.hardIce.get(), "Hard Ice");
Blocks.hardSand = Optional.of(new BlockBOPGeneric(1967, Material.sand, BlockType.HARD_SAND));
GameRegistry.registerBlock(Blocks.hardSand.get(), "hardSand2");
LanguageRegistry.addName(Blocks.hardSand.get(), "Hard Sand");
Blocks.holyStone = Optional.of(new BlockBOPGeneric(1968, Material.rock, BlockType.HOLY_STONE));
GameRegistry.registerBlock(Blocks.holyStone.get(), "holyStone2");
LanguageRegistry.addName(Blocks.holyStone.get(), "Holy Stone");
Blocks.cragRock = Optional.of(new BlockBOPGeneric(1969, Material.rock, BlockType.CRAG_ROCK));
GameRegistry.registerBlock(Blocks.cragRock.get(), "cragRock2");
LanguageRegistry.addName(Blocks.cragRock.get(), "Crag Rock");
Blocks.mudBrick = Optional.of(new BlockBOPGeneric(1970, Material.rock, BlockType.MUD_BRICK));
GameRegistry.registerBlock(Blocks.mudBrick.get(), "mudBrick2");
LanguageRegistry.addName(Blocks.mudBrick.get(), "Mud Bricks");
// Add block registration
GameRegistry.registerBlock(mud, "mud");

View File

@ -7,7 +7,8 @@ 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"};
private static final String[] saplings = new String[] {"apple", "yellow", "bamboo", "magic", "dark", "brown", "fir", "holy", "orange", "origin", "pink", "red", "white"};
private static final int MAX = 12;
public ItemBOPSapling(int par1)
{
@ -25,7 +26,8 @@ private static final String[] saplings = new String[] {"yellow", "bamboo", "magi
@Override
public String getUnlocalizedName(ItemStack itemStack)
{
return (new StringBuilder()).append(saplings[itemStack.getItemDamage()]).append("Sapling").toString();
int meta = itemStack.getItemDamageForDisplay() > MAX ? 0 : itemStack.getItemDamageForDisplay();
return (new StringBuilder()).append(saplings[meta]).append("Sapling").toString();
}