Fixed wood names.

Fixed bonemeal use.
This commit is contained in:
Amnet 2013-04-20 14:18:54 +02:00
parent f1fabb9da2
commit 42a6f82010
6 changed files with 69 additions and 52 deletions

View file

@ -145,4 +145,10 @@ public class BlockBOPAppleLeaves extends BlockLeavesBase implements IShearable
{
return true;
}
@Override
public boolean isLeaves(World world, int x, int y, int z)
{
return true;
}
}

View file

@ -155,4 +155,10 @@ public class BlockBOPColorizedLeaves extends BlockLeavesBase implements IShearab
{
return true;
}
@Override
public boolean isLeaves(World world, int x, int y, int z)
{
return true;
}
}

View file

@ -129,4 +129,10 @@ public class BlockBOPLeaves extends BlockLeavesBase implements IShearable
{
return true;
}
@Override
public boolean isLeaves(World world, int x, int y, int z)
{
return true;
}
}

View file

@ -5,6 +5,7 @@ import net.minecraftforge.event.Event.Result;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.player.BonemealEvent;
import biomesoplenty.api.Blocks;
import biomesoplenty.blocks.BlockBOPColorizedSapling;
import biomesoplenty.blocks.BlockBOPSapling;
import biomesoplenty.worldgen.WorldGenGiantFlowerRed;
import biomesoplenty.worldgen.WorldGenGiantFlowerYellow;
@ -15,57 +16,53 @@ public class BonemealUse
@ForgeSubscribe
public void onUseBonemeal(BonemealEvent event)
{
int meta = event.world.getBlockMetadata(event.X, event.Y, event.Z);
if (event.ID == Blocks.saplings.get().blockID)
{
event.setResult(Result.ALLOW);
if (!event.world.isRemote)
{
switch (meta)
{
case 3: // Magic Sapling
if ((double)event.world.rand.nextFloat() < 0.10D)
((BlockBOPSapling)Blocks.saplings.get()).growTree(event.world, event.X, event.Y, event.Z, event.world.rand);
break;
case 7: // Holy Sapling
if ((double)event.world.rand.nextFloat() < 0.15D)
((BlockBOPSapling)Blocks.saplings.get()).growTree(event.world, event.X, event.Y, event.Z, event.world.rand);
break;
case 9: // Origin Sapling
((BlockBOPSapling)Blocks.saplings.get()).growTree(event.world, event.X, event.Y, event.Z, event.world.rand);
break;
default:
if ((double)event.world.rand.nextFloat() < 0.45D)
((BlockBOPSapling)Blocks.saplings.get()).growTree(event.world, event.X, event.Y, event.Z, event.world.rand);
break;
}
}
}
else if (event.ID == Blocks.colorizedSaplings.get().blockID)
{
event.setResult(Result.ALLOW);
if (!event.world.isRemote)
{
if ((double)event.world.rand.nextFloat() < 0.45D)
{
((BlockBOPSapling)Blocks.saplings.get()).growTree(event.world, event.X, event.Y, event.Z, event.world.rand);
((BlockBOPColorizedSapling)Blocks.colorizedSaplings.get()).growTree(event.world, event.X, event.Y, event.Z, event.world.rand);
}
}
}
if (event.ID == Blocks.saplings.get().blockID) // Origin
{
event.setResult(Result.ALLOW);
if (!event.world.isRemote)
{
((BlockBOPSapling)Blocks.saplings.get()).growTree(event.world, event.X, event.Y, event.Z, event.world.rand);
}
}
if (event.ID == Blocks.saplings.get().blockID) // Holy
{
event.setResult(Result.ALLOW);
if (!event.world.isRemote)
{
if ((double)event.world.rand.nextFloat() < 0.15D)
{
((BlockBOPSapling)Blocks.saplings.get()).growTree(event.world, event.X, event.Y, event.Z, event.world.rand);
}
}
}
if (event.ID == Blocks.saplings.get().blockID) // MAGIC
{
event.setResult(Result.ALLOW);
if (!event.world.isRemote)
{
if ((double)event.world.rand.nextFloat() < 0.10D)
{
((BlockBOPSapling)Blocks.saplings.get()).growTree(event.world, event.X, event.Y, event.Z, event.world.rand);
}
}
}
if (event.ID == Block.plantRed.blockID)
else if (event.ID == Block.plantRed.blockID)
{
event.setResult(Result.ALLOW);
@ -78,8 +75,7 @@ public class BonemealUse
}
}
}
if (event.ID == Block.plantYellow.blockID)
else if (event.ID == Block.plantYellow.blockID)
{
event.setResult(Result.ALLOW);
@ -92,8 +88,7 @@ public class BonemealUse
}
}
}
if (event.ID == Blocks.holyGrass.get().blockID)
else if (event.ID == Blocks.holyGrass.get().blockID)
{
int var13 = event.X;
int var14 = event.Y + 1;

View file

@ -24,6 +24,6 @@ public class ItemBOPLog extends ItemBlock
public String getUnlocalizedName(ItemStack itemStack)
{
BlockBOPLog block = (BlockBOPLog)Block.blocksList[itemStack.itemID];
return block.getWoodType(itemStack.getItemDamage());
return block.getWoodType(itemStack.getItemDamage()) + "Wood";
}
}

View file

@ -19,7 +19,7 @@ public class WorldGenApple extends WorldGenerator
public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)
{
int var6 = par2Random.nextInt(3) + 5;
boolean var7 = true;
boolean flag = true;
if (par4 >= 1 && par4 + var6 + 1 <= 256)
{
@ -43,28 +43,30 @@ public class WorldGenApple extends WorldGenerator
var9 = 2;
}
for (var10 = par3 - var9; var10 <= par3 + var9 && var7; ++var10)
for (var10 = par3 - var9; var10 <= par3 + var9 && flag; ++var10)
{
for (var11 = par5 - var9; var11 <= par5 + var9 && var7; ++var11)
for (var11 = par5 - var9; var11 <= par5 + var9 && flag; ++var11)
{
if (var8 >= 0 && var8 < 256)
{
var12 = par1World.getBlockId(var10, var8, var11);
if (var12 != 0 && var12 != Blocks.leavesFruit.get().blockID)
Block block = Block.blocksList[var12];
if (var12 != 0 && (block != null && !block.isLeaves(par1World, var10, var8, var11)))
{
var7 = false;
flag = false;
}
}
else
{
var7 = false;
flag = false;
}
}
}
}
if (!var7)
if (!flag)
{
return false;
}
@ -111,7 +113,9 @@ public class WorldGenApple extends WorldGenerator
{
var10 = par1World.getBlockId(par3, par4 + var16, par5);
if (var10 == 0 || var10 == Blocks.leavesFruit.get().blockID)
Block block = Block.blocksList[var10];
if (var10 == 0 || block == null || block.isLeaves(par1World, par3, par4 + var16, par5))
{
this.setBlockAndMetadata(par1World, par3, par4 + var16, par5, Block.wood.blockID, 0);
}