Some bugfixes - array checks for leaves, fix for mangrove and loftwood
saplings.
This commit is contained in:
parent
06cf329d13
commit
e034c02d6f
4 changed files with 34 additions and 2 deletions
|
@ -304,7 +304,10 @@ public class BlockBOPColorizedLeaves extends BlockLeavesBase implements IShearab
|
|||
|
||||
private static int getTypeFromMeta(int meta)
|
||||
{
|
||||
return meta & 7;
|
||||
meta = meta & 7;
|
||||
if (meta < 0 || meta >= leaves.length)
|
||||
meta = 0;
|
||||
return meta;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import biomesoplenty.BiomesOPlenty;
|
||||
import biomesoplenty.worldgen.WorldGenAcacia;
|
||||
import biomesoplenty.worldgen.WorldGenMangrove;
|
||||
|
@ -91,6 +92,18 @@ public class BlockBOPColorizedSapling extends BlockSapling
|
|||
return blockID == Block.grass.blockID || blockID == Block.dirt.blockID || blockID == Block.tilledField.blockID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlockStay(World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
Block soil = blocksList[par1World.getBlockId(par2, par3 - 1, par4)];
|
||||
if (par1World.getBlockMetadata(par2, par3, par4) != 1)
|
||||
return (par1World.getFullBlockLightValue(par2, par3, par4) >= 8 || par1World.canBlockSeeTheSky(par2, par3, par4)) &&
|
||||
(soil != null && soil.canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this));
|
||||
else
|
||||
return (par1World.getFullBlockLightValue(par2, par3, par4) >= 8 || par1World.canBlockSeeTheSky(par2, par3, par4)) &&
|
||||
(soil != null && (soil.canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this) || soil.blockID == Block.sand.blockID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
|
|
|
@ -303,7 +303,10 @@ public class BlockBOPLeaves extends BlockLeavesBase implements IShearable
|
|||
|
||||
private static int getTypeFromMeta(int meta)
|
||||
{
|
||||
return meta & 7;
|
||||
meta = meta & 7;
|
||||
if (meta < 0 || meta >= leaves.length)
|
||||
meta = 0;
|
||||
return meta;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import biomesoplenty.BiomesOPlenty;
|
||||
import biomesoplenty.api.Blocks;
|
||||
import biomesoplenty.worldgen.WorldGenApple;
|
||||
|
@ -98,6 +99,18 @@ public class BlockBOPSapling extends BlockSapling
|
|||
return blockID == Block.grass.blockID || blockID == Block.dirt.blockID || blockID == Block.tilledField.blockID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlockStay(World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
Block soil = blocksList[par1World.getBlockId(par2, par3 - 1, par4)];
|
||||
if (par1World.getBlockMetadata(par2, par3, par4) != 7)
|
||||
return (par1World.getFullBlockLightValue(par2, par3, par4) >= 8 || par1World.canBlockSeeTheSky(par2, par3, par4)) &&
|
||||
(soil != null && soil.canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this));
|
||||
else
|
||||
return (par1World.getFullBlockLightValue(par2, par3, par4) >= 8 || par1World.canBlockSeeTheSky(par2, par3, par4)) &&
|
||||
(soil != null && (soil.canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this) || soil.blockID == Blocks.holyGrass.get().blockID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue