Fixed flowers/thorns once and for all

This commit is contained in:
Adubbz 2013-05-07 18:19:09 +10:00
parent f68fd802b9
commit 40c2847366
3 changed files with 13 additions and 14 deletions

View file

@ -150,31 +150,31 @@ public class BlockBOPFlower extends BlockFlower
{ {
int id = world.getBlockId(x, y - 1, z); int id = world.getBlockId(x, y - 1, z);
int meta = itemStack.getItemDamage(); int meta = itemStack.getItemDamage();
boolean sky = world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z); //boolean sky = world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z);
if (itemStack.itemID == this.blockID) if (itemStack.itemID == this.blockID)
switch (meta) switch (meta)
{ {
case 10: // Toadstool case 10: // Toadstool
return sky && id == Block.grass.blockID || id == Block.dirt.blockID || id == Block.mycelium.blockID; return id == Block.grass.blockID || id == Block.dirt.blockID || id == Block.mycelium.blockID;
case 11: // Cactus case 11: // Cactus
return sky && id == Blocks.redRock.get().blockID || id == Block.sand.blockID; return id == Blocks.redRock.get().blockID || id == Block.sand.blockID;
case 12: // Yucca case 12: // Yucca
return sky && id == Blocks.hardDirt.get().blockID || id == Blocks.redRock.get().blockID || id == Block.sand.blockID; return id == Blocks.hardDirt.get().blockID || id == Blocks.redRock.get().blockID || id == Block.sand.blockID;
case 13: // Portobello case 13: // Portobello
return sky && id == Block.grass.blockID || id == Block.dirt.blockID || id == Block.mycelium.blockID; return id == Block.grass.blockID || id == Block.dirt.blockID || id == Block.mycelium.blockID;
case 14: // Blue Milk Cap case 14: // Blue Milk Cap
return sky && id == Block.grass.blockID || id == Block.dirt.blockID || id == Block.mycelium.blockID || id == Blocks.holyGrass.get().blockID; return id == Block.grass.blockID || id == Block.dirt.blockID || id == Block.mycelium.blockID || id == Blocks.holyGrass.get().blockID;
default: default:
return sky && id == Block.grass.blockID || id == Block.dirt.blockID || id == Block.tilledField.blockID; return id == Block.grass.blockID || id == Block.dirt.blockID || id == Block.tilledField.blockID;
} }
else else
return sky && this.canPlaceBlockOnSide(world, x, y, z, side); return this.canPlaceBlockOnSide(world, x, y, z, side);
} }
/*@Override /*@Override

View file

@ -169,9 +169,8 @@ public class BlockBOPFoliage extends BlockFlower implements IShearable
{ {
int meta = par1World.getBlockMetadata(x, y, z); int meta = par1World.getBlockMetadata(x, y, z);
if (!par1World.isRemote) if (!par1World.isRemote && meta == 6)
if (meta == 6) ((EntityLiving)par5Entity).addPotionEffect(new PotionEffect(Potion.poison.id, 200));
((EntityLiving)par5Entity).addPotionEffect(new PotionEffect(Potion.poison.id, 200));
} }
@Override @Override

View file

@ -144,7 +144,7 @@ public class BlockBOPPlant extends BlockFlower implements IShearable
return id == Blocks.holyGrass.get().blockID; return id == Blocks.holyGrass.get().blockID;
case 5: // Thorns case 5: // Thorns
return true; return id == Block.grass.blockID || id == Block.dirt.blockID;
case 7: // Cattail case 7: // Cattail
return id != Block.grass.blockID ? false : (world.getBlockMaterial(x - 1, y - 1, z) == Material.water ? true : (world.getBlockMaterial(x + 1, y - 1, z) == Material.water ? true : (world.getBlockMaterial(x, y - 1, z - 1) == Material.water ? true : world.getBlockMaterial(x, y - 1, z + 1) == Material.water))); return id != Block.grass.blockID ? false : (world.getBlockMaterial(x - 1, y - 1, z) == Material.water ? true : (world.getBlockMaterial(x + 1, y - 1, z) == Material.water ? true : (world.getBlockMaterial(x, y - 1, z - 1) == Material.water ? true : world.getBlockMaterial(x, y - 1, z + 1) == Material.water)));
@ -162,7 +162,7 @@ public class BlockBOPPlant extends BlockFlower implements IShearable
return this.canPlaceBlockOnSide(world, x, y, z, side); return this.canPlaceBlockOnSide(world, x, y, z, side);
} }
@Override /*@Override
public boolean canBlockStay(World world, int x, int y, int z) public boolean canBlockStay(World world, int x, int y, int z)
{ {
if (world.getBlockId(x, y, z) != this.blockID) if (world.getBlockId(x, y, z) != this.blockID)
@ -171,7 +171,7 @@ public class BlockBOPPlant extends BlockFlower implements IShearable
else else
return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z))
&& this.canThisPlantGrowOnThisBlockID(world.getBlockId(x, y - 1, z), world.getBlockMetadata(x, y, z)); && this.canThisPlantGrowOnThisBlockID(world.getBlockId(x, y - 1, z), world.getBlockMetadata(x, y, z));
} }*/
@Override @Override
public void onNeighborBlockChange(World world, int x, int y, int z, int neighborID) public void onNeighborBlockChange(World world, int x, int y, int z, int neighborID)