Added stalagmites and stalactites

This commit is contained in:
Matt Caughey 2013-11-07 20:26:52 -05:00
parent 28ac09bf2e
commit 026069ac82
12 changed files with 332 additions and 1 deletions

View File

@ -204,6 +204,9 @@ public class BlockReferences {
bluebells (Blocks.flowers2, 5),
minersdelight (Blocks.flowers2, 6),
icyiris (Blocks.flowers2, 7),
stalagmite (Blocks.stoneFormations, 0),
stalactite (Blocks.stoneFormations, 1),
;
public Optional<? extends Block> block;

View File

@ -87,6 +87,7 @@ public class Blocks
public static Optional<? extends Block> cloud = Optional.absent();
public static Optional<? extends Block> hive = Optional.absent();
public static Optional<? extends Block> honeyBlock = Optional.absent();
public static Optional<? extends Block> stoneFormations = Optional.absent();
//Nether
public static Optional<? extends Block> bones = Optional.absent();

View File

@ -243,6 +243,8 @@ public class BiomeDecoratorBOP extends BiomeDecorator
public WorldGenerator koruGen;
public WorldGenerator waspHiveGen;
public WorldGenerator rootGen;
public WorldGenerator stalagmiteGen;
public WorldGenerator stalactiteGen;
public WorldGenerator boneSpineGen;
public WorldGenerator boneSpine2Gen;
@ -344,6 +346,8 @@ public class BiomeDecoratorBOP extends BiomeDecorator
public int koruPerChunk;
public int waspHivesPerChunk;
public int rootsPerChunk;
public int stalagmitesPerChunk;
public int stalactitesPerChunk;
public int boneSpinesPerChunk;
public int boneSpines2PerChunk;
@ -555,6 +559,8 @@ public class BiomeDecoratorBOP extends BiomeDecorator
redwoodShrubGen = new WorldGenRedwoodShrub(0,0);
koruGen = new WorldGenTallGrass(Blocks.foliage.get().blockID, 12);
rootGen = new WorldGenBOPTallGrass(Blocks.plants.get().blockID, 15);
stalagmiteGen = new WorldGenBOPTallGrass(Blocks.stoneFormations.get().blockID, 0);
stalactiteGen = new WorldGenBOPTallGrass(Blocks.stoneFormations.get().blockID, 1);
pitGen = new WorldGenPit(Blocks.ash.get().blockID);
waterlilyPerChunk = 0;
lilyflowersPerChunk = 0;
@ -651,6 +657,8 @@ public class BiomeDecoratorBOP extends BiomeDecorator
koruPerChunk = 0;
waspHivesPerChunk = 0;
rootsPerChunk = 9;
stalagmitesPerChunk = 3;
stalactitesPerChunk = 6;
generateLakes = true;
generateAsh = false;
generateMycelium = false;
@ -1341,6 +1349,22 @@ public class BiomeDecoratorBOP extends BiomeDecorator
rootGen.generate(currentWorld, randomGenerator, var3, var4, var5);
}
for (var2 = 0; var2 < stalagmitesPerChunk; ++var2)
{
var3 = chunk_X + randomGenerator.nextInt(16) + 8;
var4 = randomGenerator.nextInt(64);
var5 = chunk_Z + randomGenerator.nextInt(16) + 8;
stalagmiteGen.generate(currentWorld, randomGenerator, var3, var4, var5);
}
for (var2 = 0; var2 < stalactitesPerChunk; ++var2)
{
var3 = chunk_X + randomGenerator.nextInt(16) + 8;
var4 = randomGenerator.nextInt(64);
var5 = chunk_Z + randomGenerator.nextInt(16) + 8;
stalactiteGen.generate(currentWorld, randomGenerator, var3, var4, var5);
}
for (var2 = 0; var2 < waspHivesPerChunk; ++var2)
{
int var420 = randomGenerator.nextInt(4);

View File

@ -26,6 +26,9 @@ public class BiomeGenOriginValley extends BiomeGenBase
customBiomeDecorator.sandPerChunk2 = 0;
customBiomeDecorator.clayPerChunk = 0;
customBiomeDecorator.rootsPerChunk = -999;
customBiomeDecorator.stalagmitesPerChunk = -999;
customBiomeDecorator.stalactitesPerChunk = -999;
customBiomeDecorator.minersDelightPerChunk = -999;
}
/**

View File

@ -0,0 +1,173 @@
package biomesoplenty.blocks;
import java.util.List;
import java.util.Random;
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.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import biomesoplenty.BiomesOPlenty;
import biomesoplenty.api.Blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockStoneFormations extends BlockFlower
{
private static final String[] forms = new String[] {"stalagmite", "stalactite"};
private Icon[] textures;
protected BlockStoneFormations(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(BiomesOPlenty.tabBiomesOPlenty);
}
public BlockStoneFormations(int blockID)
{
this(blockID, Material.rock);
}
@Override
public void registerIcons(IconRegister iconRegister)
{
textures = new Icon[forms.length];
for (int i = 0; i < forms.length; ++i) {
textures[i] = iconRegister.registerIcon("biomesoplenty:" + forms[i]);
}
}
@Override
public Icon getIcon(int side, int meta)
{
if (meta < 0 || meta >= textures.length) {
meta = 0;
}
return textures[meta];
}
@Override
public int getRenderType()
{
return 1;
}
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int par2, int par3, int par4)
{
int meta = world.getBlockMetadata(par2, par3, par4);
switch (meta)
{
default:
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
break;
}
}
@Override
@SideOnly(Side.CLIENT)
@SuppressWarnings({ "rawtypes", "unchecked" })
public void getSubBlocks(int blockID, CreativeTabs creativeTabs, List list) {
for (int i = 0; i < forms.length; ++i)
{
list.add(new ItemStack(blockID, 1, i));
}
}
@Override
protected boolean canThisPlantGrowOnThisBlockID(int id)
{
return id == Block.stone.blockID;
}
protected boolean canThisPlantGrowOnThisBlockID(int id, int metadata)
{
return id == Block.stone.blockID;
}
@Override
public boolean canPlaceBlockOnSide(World world, int x, int y, int z, int side, ItemStack itemStack)
{
int idbottom = world.getBlockId(x, y - 1, z);
int idtop = world.getBlockId(x, y + 1, z);
int meta = itemStack.getItemDamage();
//boolean sky = world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z);
if (itemStack.itemID == blockID) {
switch (meta)
{
case 0: // Stalagmite
return idbottom == Block.stone.blockID;
case 1: // Stalactite
return idtop == Block.stone.blockID;
default:
return idbottom == Block.stone.blockID;
}
} else
return this.canPlaceBlockOnSide(world, x, y, z, side);
}
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, int neighborID)
{
//super.onNeighborBlockChange(world, x, y, z, neighborID);
this.checkFlowerChange(world, x, y, z);
}
@Override
public int getDamageValue(World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
return meta;
}
@Override
public int damageDropped(int meta)
{
return meta & 15;
}
@Override
public boolean canBlockStay(World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
if (world.getBlockId(x, y, z) != blockID)
{
if (meta == 1)
return this.canThisPlantGrowOnThisBlockID(world.getBlockId(x, y + 1, z));
else
return this.canThisPlantGrowOnThisBlockID(world.getBlockId(x, y - 1, z));
}
else
{
if (meta == 1)
return this.canThisPlantGrowOnThisBlockID(world.getBlockId(x, y + 1, z), world.getBlockMetadata(x, y, z));
else
return this.canThisPlantGrowOnThisBlockID(world.getBlockId(x, y - 1, z), world.getBlockMetadata(x, y, z));
}
}
@Override
public boolean isBlockReplaceable(World world, int x, int y, int z)
{
return true;
}
}

View File

@ -49,6 +49,7 @@ import biomesoplenty.blocks.BlockMud;
import biomesoplenty.blocks.BlockOriginGrass;
import biomesoplenty.blocks.BlockPromisedPortal;
import biomesoplenty.blocks.BlockPuddle;
import biomesoplenty.blocks.BlockStoneFormations;
import biomesoplenty.blocks.BlockTreeMoss;
import biomesoplenty.blocks.BlockWillow;
import biomesoplenty.configuration.configfile.BOPConfigurationIDs;
@ -79,6 +80,7 @@ import biomesoplenty.itemblocks.ItemBlockRedRock;
import biomesoplenty.itemblocks.ItemBlockSapling;
import biomesoplenty.itemblocks.ItemBlockSkystone;
import biomesoplenty.itemblocks.ItemBlockSlab;
import biomesoplenty.itemblocks.ItemBlockStoneFormations;
import biomesoplenty.items.ItemBOPAmethyst;
import biomesoplenty.items.ItemBOPIvy;
import biomesoplenty.items.ItemBOPWillow;
@ -136,6 +138,7 @@ public class BOPBlocks
Blocks.plants = Optional.of((new BlockBOPPlant(BOPConfigurationIDs.plantsID)).setUnlocalizedName("bop.plants"));
Blocks.flowers = Optional.of((new BlockBOPFlower(BOPConfigurationIDs.flowersID)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("bop.flowers"));
Blocks.flowers2 = Optional.of((new BlockBOPFlower2(BOPConfigurationIDs.flowers2ID)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("bop.flowers2"));
Blocks.stoneFormations = Optional.of((new BlockStoneFormations(BOPConfigurationIDs.stoneFormationsID)).setHardness(0.5F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("bop.stoneFormations"));
Blocks.mushrooms = Optional.of((new BlockBOPMushroom(BOPConfigurationIDs.mushroomsID)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("bop.mushrooms"));
Blocks.coral = Optional.of((new BlockBOPCoral(BOPConfigurationIDs.coralID)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("bop.coral"));
Blocks.willow = Optional.of((new BlockWillow(BOPConfigurationIDs.willowID)).setHardness(0.2F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("bop.willow"));
@ -228,6 +231,7 @@ public class BOPBlocks
GameRegistry.registerBlock(Blocks.plants.get(), ItemBlockPlant.class, "bop.plants");
GameRegistry.registerBlock(Blocks.flowers.get(), ItemBlockFlower.class, "bop.flowers");
GameRegistry.registerBlock(Blocks.flowers2.get(), ItemBlockFlower2.class, "bop.flowers2");
GameRegistry.registerBlock(Blocks.stoneFormations.get(), ItemBlockStoneFormations.class, "bop.stoneFormations");
GameRegistry.registerBlock(Blocks.mushrooms.get(), ItemBlockMushroom.class, "bop.mushrooms");
GameRegistry.registerBlock(Blocks.coral.get(), ItemBlockCoral.class, "bop.coral");
GameRegistry.registerBlock(Blocks.willow.get(), ItemBOPWillow.class, "bop.willow");

View File

@ -98,7 +98,8 @@ public class BOPConfigurationIDs
public static int cloudID;
public static int hiveID;
public static int honeyBlockID;
public static int stoneFormationsID;
public static int bonesID;
public static int glassID;
public static int altarID;
@ -418,6 +419,7 @@ public class BOPConfigurationIDs
honeyStillID = config.get("Liquid IDs", "Honey Still ID (ID before this must be free!)", 1989, null).getInt();
honeyBlockID = config.getBlock("Honey Block ID", 1991, null).getInt();
stoneFormationsID = config.getBlock("Stone Formations ID", 1992, null).getInt();
// Get Item ID's
foodID = config.getItem("Food ID", 21003, null).getInt();

View File

@ -0,0 +1,118 @@
package biomesoplenty.itemblocks;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import biomesoplenty.BiomesOPlenty;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemBlockStoneFormations extends ItemBlock
{
private static final String[] forms = new String[] {"stalagmite", "stalactite"};
@SideOnly(Side.CLIENT)
private Icon[] textures;
public ItemBlockStoneFormations(int par1)
{
super(par1);
setMaxDamage(0);
setHasSubtypes(true);
}
@Override
public String getUnlocalizedName(ItemStack itemStack)
{
int meta = itemStack.getItemDamage();
if (meta < 0 || meta >= forms.length) {
meta = 0;
}
return super.getUnlocalizedName() + "." + forms[meta];
}
@Override
public Icon getIconFromDamage(int meta)
{
return Block.blocksList[itemID].getIcon(0, meta);
}
@Override
@SideOnly(Side.CLIENT)
public boolean isFull3D()
{
return true;
}
@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
{
int id = world.getBlockId(x, y, z);
if (id == Block.snow.blockID && (world.getBlockMetadata(x, y, z) & 7) < 1) {
side = 1;
} else if (!Block.blocksList[id].isBlockReplaceable(world, x, y, z))
{
if (side == 0) {
--y;
}
if (side == 1) {
++y;
}
if (side == 2) {
--z;
}
if (side == 3) {
++z;
}
if (side == 4) {
--x;
}
if (side == 5) {
++x;
}
}
if (!player.canPlayerEdit(x, y, z, side, itemStack))
return false;
else if (itemStack.stackSize == 0)
return false;
else
{
if (world.canPlaceEntityOnSide(this.getBlockID(), x, y, z, false, side, (Entity)null, itemStack))
{
Block block = Block.blocksList[this.getBlockID()];
int j1 = block.onBlockPlaced(world, x, y, z, side, hitX, hitY, hitZ, 0);
if (world.setBlock(x, y, z, this.getBlockID(), itemStack.getItemDamage(), 3))
{
if (world.getBlockId(x, y, z) == this.getBlockID())
{
Block.blocksList[this.getBlockID()].onBlockPlacedBy(world, x, y, z, player, itemStack);
Block.blocksList[this.getBlockID()].onPostBlockPlaced(world, x, y, z, j1);
}
world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, block.stepSound.getPlaceSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
--itemStack.stackSize;
}
}
return true;
}
}
}

View File

@ -60,6 +60,9 @@ tile.bop.flowers2.bluebells.name=Bluebells
tile.bop.flowers2.minersdelight.name=Miner's Delight
tile.bop.flowers2.icyiris.name=Icy Iris
tile.bop.stoneFormations.stalagmite.name=Stalagmite
tile.bop.stoneFormations.stalactite.name=Stalactite
tile.bop.foliage.algae.name=Algae
tile.bop.foliage.shortgrass.name=Short Grass
tile.bop.foliage.mediumgrass.name=Medium Grass

Binary file not shown.

Before

Width:  |  Height:  |  Size: 728 B

After

Width:  |  Height:  |  Size: 769 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 389 B