This commit is contained in:
Adubbz 2014-05-18 13:47:32 +10:00
commit bf9b5bf4f7
9 changed files with 53 additions and 32 deletions

View file

@ -6,15 +6,20 @@ import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import biomesoplenty.BiomesOPlenty; import biomesoplenty.BiomesOPlenty;
import biomesoplenty.api.BOPItemHelper; import biomesoplenty.api.BOPItemHelper;
import biomesoplenty.api.content.BOPCBiomes;
public class BlockBOPGeneric extends Block public class BlockBOPGeneric extends Block
{ {
public enum BlockType public enum BlockType
{ {
ASH_STONE, HARD_SAND, HARD_DIRT, HARD_ICE, DRIED_DIRT, CRAG_ROCK, MUD_BRICK, SPECTRAL_SOIL, CRYSTAL; ASH_STONE, HARD_SAND, HARD_DIRT, HARD_ICE, DRIED_DIRT, CRAG_ROCK, MUD_BRICK, BIOME_BLOCK, CRYSTAL;
} }
private IIcon texture; private IIcon texture;
@ -23,6 +28,7 @@ public class BlockBOPGeneric extends Block
public BlockBOPGeneric(Material material, BlockType type) public BlockBOPGeneric(Material material, BlockType type)
{ {
super(material); super(material);
this.setHarvestLevel("pickaxe", 3, 7);
this.type = type; this.type = type;
//TODO: this.setCreativeTab() //TODO: this.setCreativeTab()
@ -85,11 +91,11 @@ public class BlockBOPGeneric extends Block
this.setStepSound(Block.soundTypePiston); this.setStepSound(Block.soundTypePiston);
break; break;
case SPECTRAL_SOIL: case BIOME_BLOCK:
//TODO: this.setHardness //TODO: this.setHardness
this.setHardness(0.6F); this.setHardness(0.6F);
//TODO setStepSound(Block.soundGravelFootstep) //TODO setStepSound(Block.soundGravelFootstep)
this.setStepSound(soundTypeGravel); this.setStepSound(soundTypeGlass);
break; break;
case CRYSTAL: case CRYSTAL:
@ -142,8 +148,8 @@ public class BlockBOPGeneric extends Block
texture = iconRegister.registerIcon("biomesoplenty:mudbrick"); texture = iconRegister.registerIcon("biomesoplenty:mudbrick");
break; break;
case SPECTRAL_SOIL: case BIOME_BLOCK:
texture = iconRegister.registerIcon("biomesoplenty:spectralsoil"); texture = iconRegister.registerIcon("biomesoplenty:biomeblock");
break; break;
case CRYSTAL: case CRYSTAL:
@ -169,6 +175,41 @@ public class BlockBOPGeneric extends Block
return Item.getItemFromBlock(this); return Item.getItemFromBlock(this);
} }
} }
@Override
//TODO: dropBlockAsItemWithChance()
public void dropBlockAsItemWithChance(World world, int x, int y, int z, int metadata, float chance, int fortune)
{
if (world.isRemote)
return;
switch (type)
{
case BIOME_BLOCK:
for (BiomeGenBase biome : BiomeGenBase.getBiomeGenArray())
{
if (biome != null)
{
if (biome != BOPCBiomes.boneyard && biome != BOPCBiomes.visceralHeap && biome != BOPCBiomes.undergarden && biome != BOPCBiomes.corruptedSands && biome != BOPCBiomes.phantasmagoricInferno && biome != BOPCBiomes.lushRiver && biome != BOPCBiomes.dryRiver && biome != BiomeGenBase.beach && biome != BiomeGenBase.coldBeach && biome != BiomeGenBase.stoneBeach && biome != BiomeGenBase.frozenOcean && biome != BiomeGenBase.frozenRiver && biome != BiomeGenBase.hell && biome != BiomeGenBase.river && biome != BiomeGenBase.sky && biome != BiomeGenBase.ocean && biome != BiomeGenBase.deepOcean)
{
ItemStack biomeEssence = new ItemStack(BOPItemHelper.get("biomeEssence"));
biomeEssence.setTagCompound(new NBTTagCompound());
biomeEssence.getTagCompound().setInteger("biomeID", biome.biomeID);
if (world.rand.nextInt(75) == 0)
{
this.dropBlockAsItem(world, x, y, z, biomeEssence);
}
}
}
}
default:
break;
}
}
@Override @Override
//TODO damageDropped() //TODO damageDropped()

View file

@ -165,7 +165,7 @@ public class BlockBOPGrass extends Block
if (world.getBlockLightValue(x, y + 1, z) < 4 && world.getBlockLightOpacity(x, y + 1, z) > 2) if (world.getBlockLightValue(x, y + 1, z) < 4 && world.getBlockLightOpacity(x, y + 1, z) > 2)
{ {
//TODO: setBlock() //TODO: setBlock()
world.setBlock(x, y, z, BOPBlockHelper.get("spectralSoil"), 0, 2); world.setBlock(x, y, z, Blocks.end_stone, 0, 2);
} }
else if (world.getBlockLightValue(x, y + 1, z) >= 9) else if (world.getBlockLightValue(x, y + 1, z) >= 9)
{ {
@ -178,7 +178,7 @@ public class BlockBOPGrass extends Block
Block block = world.getBlock(rX, rY + 1, rZ); Block block = world.getBlock(rX, rY + 1, rZ);
//TODO: getBlock() //TODO: getBlock()
if (world.getBlock(rX, rY, rZ) == BOPBlockHelper.get("spectralSoil") && world.getBlockLightValue(rX, rY + 1, rZ) >= 4 && world.getBlockLightOpacity(rX, rY + 1, rZ) <= 2) if (world.getBlock(rX, rY, rZ) == Blocks.end_stone && world.getBlockLightValue(rX, rY + 1, rZ) >= 4 && world.getBlockLightOpacity(rX, rY + 1, rZ) <= 2)
{ {
//TODO: setBlock() //TODO: setBlock()
world.setBlock(rX, rY, rZ, BOPBlockHelper.get("bopGrass"), 0, 2); world.setBlock(rX, rY, rZ, BOPBlockHelper.get("bopGrass"), 0, 2);
@ -217,7 +217,7 @@ public class BlockBOPGrass extends Block
public Item getItemDropped(int metadata, Random random, int fortune) public Item getItemDropped(int metadata, Random random, int fortune)
{ {
//TODO: getItemFromBlock() getItemFromBlock() //TODO: getItemFromBlock() getItemFromBlock()
return metadata == 0 ? Item.getItemFromBlock(BOPBlockHelper.get("spectralSoil")) : Item.getItemFromBlock(Blocks.dirt); return metadata == 0 ? Item.getItemFromBlock(Blocks.end_stone) : Item.getItemFromBlock(Blocks.dirt);
} }
} }

View file

@ -172,7 +172,7 @@ public class BlockBOPPlant extends BOPBlockWorldDecor implements IShearable
return block == Blocks.water && reedwater != Blocks.water; return block == Blocks.water && reedwater != Blocks.water;
case 15: // Root case 15: // Root
return root != Blocks.air && (root == Blocks.grass || root == Blocks.dirt || root == Blocks.farmland || root == BOPBlockHelper.get("longGrass") || root == BOPBlockHelper.get("spectralSoil")); return root != Blocks.air && (root == Blocks.grass || root == Blocks.dirt || root == Blocks.farmland || root == BOPBlockHelper.get("longGrass"));
default: default:
return block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland || block == BOPBlockHelper.get("overgrownNetherrack"); return block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland || block == BOPBlockHelper.get("overgrownNetherrack");

View file

@ -146,7 +146,7 @@ public class BOPBlocks
registerBlock(new BlockBOPGeneric(Material.sand, BlockType.HARD_SAND).setBlockName("hardSand")); registerBlock(new BlockBOPGeneric(Material.sand, BlockType.HARD_SAND).setBlockName("hardSand"));
registerBlock(new BlockBOPGeneric(Material.rock, BlockType.HARD_DIRT).setBlockName("hardDirt")); registerBlock(new BlockBOPGeneric(Material.rock, BlockType.HARD_DIRT).setBlockName("hardDirt"));
registerBlock(new BlockBOPGeneric(Material.sand, BlockType.SPECTRAL_SOIL).setBlockName("spectralSoil")); registerBlock(new BlockBOPGeneric(Material.glass, BlockType.BIOME_BLOCK).setBlockName("biomeBlock"));
registerBlock(new BlockBOPGeneric(Material.glass, BlockType.CRYSTAL).setBlockName("crystal")); registerBlock(new BlockBOPGeneric(Material.glass, BlockType.CRYSTAL).setBlockName("crystal"));

View file

@ -2,6 +2,7 @@ package biomesoplenty.common.core;
import biomesoplenty.api.BOPBlockHelper; import biomesoplenty.api.BOPBlockHelper;
import biomesoplenty.api.BOPItemHelper; import biomesoplenty.api.BOPItemHelper;
import biomesoplenty.api.content.BOPCBiomes;
import biomesoplenty.common.configuration.BOPConfigurationMisc; import biomesoplenty.common.configuration.BOPConfigurationMisc;
import biomesoplenty.common.entities.projectiles.dispenser.DispenserBehaviourDart; import biomesoplenty.common.entities.projectiles.dispenser.DispenserBehaviourDart;
import biomesoplenty.common.entities.projectiles.dispenser.DispenserBehaviourMudball; import biomesoplenty.common.entities.projectiles.dispenser.DispenserBehaviourMudball;
@ -67,27 +68,6 @@ public class BOPVanillaCompat
bonusChest.addItem(new WeightedRandomChestContent(new ItemStack(BOPItemHelper.get("wadingBoots"), 1, 0), 1, 1, 5)); bonusChest.addItem(new WeightedRandomChestContent(new ItemStack(BOPItemHelper.get("wadingBoots"), 1, 0), 1, 1, 5));
bonusChest.addItem(new WeightedRandomChestContent(new ItemStack(BOPItemHelper.get("flippers"), 1, 0), 1, 1, 5)); bonusChest.addItem(new WeightedRandomChestContent(new ItemStack(BOPItemHelper.get("flippers"), 1, 0), 1, 1, 5));
for (BiomeGenBase biome : BiomeGenBase.getBiomeGenArray())
{
if (biome != null)
{
ItemStack biomeEssence = new ItemStack(BOPItemHelper.get("biomeEssence"));
biomeEssence.setTagCompound(new NBTTagCompound());
biomeEssence.getTagCompound().setInteger("biomeID", biome.biomeID);
desertTemple.addItem(new WeightedRandomChestContent(biomeEssence, 1, 1, 1));
dungeon.addItem(new WeightedRandomChestContent(biomeEssence, 1, 1, 1));
jungleTemple.addItem(new WeightedRandomChestContent(biomeEssence, 1, 1, 2));
mineshaft.addItem(new WeightedRandomChestContent(biomeEssence, 1, 1, 1));
strongholdCorridor.addItem(new WeightedRandomChestContent(biomeEssence, 1, 1, 1));
strongholdCrossing.addItem(new WeightedRandomChestContent(biomeEssence, 1, 1, 1));
strongholdLibrary.addItem(new WeightedRandomChestContent(biomeEssence, 1, 1, 3));
bonusChest.addItem(new WeightedRandomChestContent(biomeEssence, 1, 1, 1));
}
}
} }
} }

View file

@ -8,7 +8,7 @@ tile.hardIce.name=Hardened Ice
tile.driedDirt.name=Dried Dirt tile.driedDirt.name=Dried Dirt
tile.cragRock.name=Crag Rock tile.cragRock.name=Crag Rock
tile.mudBricks.name=Mud Bricks tile.mudBricks.name=Mud Bricks
tile.spectralSoil.name=Spectral Soil tile.biomeBlock.name=Biome Essence Ore
tile.crystal.name=Celestial Crystal tile.crystal.name=Celestial Crystal
tile.rocks.limestone.name=Limestone tile.rocks.limestone.name=Limestone

Binary file not shown.

After

Width:  |  Height:  |  Size: 811 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B