Added empty honeycombs

This commit is contained in:
Matt Caughey 2013-10-29 19:17:37 -04:00
parent a6d06c97b3
commit 58004b0183
8 changed files with 59 additions and 28 deletions

View File

@ -1,23 +1,23 @@
package biomesoplenty.blocks; package biomesoplenty.blocks;
import java.util.List; import java.util.List;
import java.util.Random;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityMobSpawner;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
import biomesoplenty.BiomesOPlenty; import biomesoplenty.BiomesOPlenty;
import biomesoplenty.entities.EntityWasp;
public class BlockHive extends Block public class BlockHive extends Block
{ {
private static final String[] hiveTypes = new String[] {"honeycomb", "honeycombspawner", "hive", "hivespawner"}; private static final String[] hiveTypes = new String[] {"honeycomb", "honeycombspawner", "hive", "hivespawner", "honeycombempty"};
private Icon[] textures; private Icon[] textures;
public BlockHive(int par1) public BlockHive(int par1)
@ -26,12 +26,36 @@ public class BlockHive extends Block
this.setCreativeTab(BiomesOPlenty.tabBiomesOPlenty); this.setCreativeTab(BiomesOPlenty.tabBiomesOPlenty);
} }
/** @Override
* Returns a new instance of a block's tile entity class. Called on placing the block. public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
*/ {
public TileEntity createNewTileEntity(World par1World) if (par1World.getBlockMetadata(par2, par3, par4) == 1 || par1World.getBlockMetadata(par2, par3, par4) == 3)
{
if (par5Random.nextInt(10) == 0)
{
int spawnx = (par2 - 4) + par5Random.nextInt(8);
int spawny = (par3 - 4) + par5Random.nextInt(8);
int spawnz = (par4 - 4) + par5Random.nextInt(8);
if (par1World.isAirBlock(spawnx, spawny, spawnz))
{
EntityWasp wasp = new EntityWasp(par1World);
wasp.setLocationAndAngles((double)spawnx, (double)spawny, (double)spawnz, 0.0F, 0.0F);
par1World.spawnEntityInWorld(wasp);
}
}
}
}
@Override
public void breakBlock(World world, int x, int y, int z, int par5, int par6)
{ {
return new TileEntityMobSpawner(); if (world.getBlockMetadata(x, y, z) == 4)
{
EntityWasp wasp = new EntityWasp(world);
wasp.setLocationAndAngles((double)x + 0.6, (double)y + 0.1, (double)z + 0.3, 0.0F, 0.0F);
world.spawnEntityInWorld(wasp);
}
} }
@Override @Override

View File

@ -8,7 +8,7 @@ import net.minecraft.world.World;
public class ItemBlockHive extends ItemBlock public class ItemBlockHive extends ItemBlock
{ {
private static final String[] types = new String[] {"honeycomb", "honeycombspawner", "hive", "hivespawner"}; private static final String[] types = new String[] {"honeycomb", "honeycombspawner", "hive", "hivespawner", "honeycombempty"};
public ItemBlockHive(int par1) public ItemBlockHive(int par1)
{ {

View File

@ -69,7 +69,9 @@ public class WorldGenHive extends WorldGenerator
//Bottom 3 //Bottom 3
generateHiveCubeSmall(world, x, (y - (baseHeight + 9)) + cubeno, z, (baseHeight - 9) + (cubeno * 2), (baseWidth - 4) + cubeno, cubeno, chance, meta); generateHiveCubeSmall(world, x, (y - (baseHeight + 9)) + cubeno, z, (baseHeight - 9) + (cubeno * 2), (baseWidth - 4) + cubeno, cubeno, chance, meta);
spawnWasps(world, rand, x, y, z, 15); spawnWasps(world, rand, x, y, z);
spawnEmptyHoneycombs(world, rand, x, y, z);
} }
return true; return true;
@ -124,38 +126,42 @@ public class WorldGenHive extends WorldGenerator
} }
} }
public void spawnWasps(World world, Random rand, int x, int y, int z, int amount) public void spawnWasps(World world, Random rand, int x, int y, int z)
{ {
for (int spawn = 0; spawn < amount; spawn++) for (int spawn = 0; spawn < 20; spawn++)
{ {
int spawnx = (x - 8) + rand.nextInt(16); int spawnx = (x - 12) + rand.nextInt(24);
int spawny = (y + 2) - rand.nextInt(16); int spawny = y - rand.nextInt(24);
int spawnz = (z - 8) + rand.nextInt(16); int spawnz = (z - 12) + rand.nextInt(24);
if (world.getBlockId(spawnx, spawny, spawnz) == Blocks.hive.get().blockID) if (world.getBlockId(spawnx, spawny, spawnz) == Blocks.hive.get().blockID)
{ {
if (world.getBlockMetadata(spawnx, spawny, spawnz) == 0) if (world.getBlockMetadata(spawnx, spawny, spawnz) == 0)
{ {
world.setBlock(spawnx, spawny, spawnz, Blocks.hive.get().blockID, 1, 0); world.setBlock(spawnx, spawny, spawnz, Blocks.hive.get().blockID, 1, 0);
TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner)world.getBlockTileEntity(spawnx, spawny, spawnz);
if (tileentitymobspawner != null)
{
tileentitymobspawner.getSpawnerLogic().setMobID("BiomesOPlenty.Wasp");
}
} }
if (world.getBlockMetadata(spawnx, spawny, spawnz) == 2) if (world.getBlockMetadata(spawnx, spawny, spawnz) == 2)
{ {
world.setBlock(spawnx, spawny, spawnz, Blocks.hive.get().blockID, 3, 0); world.setBlock(spawnx, spawny, spawnz, Blocks.hive.get().blockID, 3, 0);
}
}
}
}
TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner)world.getBlockTileEntity(spawnx, spawny, spawnz); public void spawnEmptyHoneycombs(World world, Random rand, int x, int y, int z)
{
if (tileentitymobspawner != null) for (int spawn = 0; spawn < 50; spawn++)
{ {
tileentitymobspawner.getSpawnerLogic().setMobID("BiomesOPlenty.Wasp"); int spawnx = (x - 8) + rand.nextInt(16);
} int spawny = y - rand.nextInt(12);
int spawnz = (z - 8) + rand.nextInt(16);
if (world.getBlockId(spawnx, spawny, spawnz) == Blocks.hive.get().blockID)
{
if (world.getBlockMetadata(spawnx, spawny, spawnz) == 0)
{
world.setBlock(spawnx, spawny, spawnz, Blocks.hive.get().blockID, 4, 0);
} }
} }
} }

View File

@ -161,6 +161,7 @@ tile.bop.hive.honeycomb.name=Honeycomb Block
tile.bop.hive.honeycombspawner.name=Honeycomb Wasp Spawner tile.bop.hive.honeycombspawner.name=Honeycomb Wasp Spawner
tile.bop.hive.hive.name=Hive Block tile.bop.hive.hive.name=Hive Block
tile.bop.hive.hivespawner.name=Hive Wasp Spawner tile.bop.hive.hivespawner.name=Hive Wasp Spawner
tile.bop.hive.honeycombempty.name=Empty Honeycomb Block
tile.bop.bones.bones_small.name=Small Bone Segment tile.bop.bones.bones_small.name=Small Bone Segment
tile.bop.bones.bones_medium.name=Medium Bone Segment tile.bop.bones.bones_medium.name=Medium Bone Segment

Binary file not shown.

Before

Width:  |  Height:  |  Size: 755 B

After

Width:  |  Height:  |  Size: 776 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 709 B

After

Width:  |  Height:  |  Size: 726 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 663 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 B