Fixed a rendering bug and some issues with block placement
This commit is contained in:
parent
46fefd716b
commit
2c7cd8e8a3
7 changed files with 62 additions and 61 deletions
|
@ -73,40 +73,40 @@ public class PlantsRenderer implements ISimpleBlockRenderingHandler
|
|||
return RenderUtils.plantsModel;
|
||||
}
|
||||
|
||||
private boolean renderBlockCrops(Block par1Block, int par2, int par3, int par4, RenderBlocks renderer)
|
||||
private boolean renderBlockCrops(Block block, int x, int y, int z, RenderBlocks renderer)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
//TODO: blockAccess
|
||||
IBlockAccess world = renderer.field_147845_a;
|
||||
//TODO: getMixedBrightnessForBlock()
|
||||
tessellator.setBrightness(par1Block.func_149677_c(world, par2, par3, par4));
|
||||
tessellator.setBrightness(block.func_149677_c(world, x, y, z));
|
||||
tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
|
||||
|
||||
double d0 = par2;
|
||||
double d1 = par3;
|
||||
double d2 = par4;
|
||||
double d0 = x;
|
||||
double d1 = y;
|
||||
double d2 = z;
|
||||
|
||||
long i1 = par2 * 3129871 ^ par4 * 116129781L ^ par3;
|
||||
long i1 = x * 3129871 ^ z * 116129781L ^ y;
|
||||
|
||||
i1 = i1 * i1 * 42317861L + i1 * 11L;
|
||||
d0 += ((i1 >> 16 & 15L) / 15.0F - 0.5D) * 0.125D;
|
||||
d2 += ((i1 >> 24 & 15L) / 15.0F - 0.5D) * 0.125D;
|
||||
|
||||
//TODO: renderCropBlocksImpl()
|
||||
renderer.func_147795_a(par1Block, world.getBlockMetadata(par2, par3, par4), d0, par3 - 0.0625F, d2);
|
||||
renderer.func_147795_a(block, world.getBlockMetadata(x, y, z), d0, y - 0.0625F, d2);
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean renderCrossedSquares(Block par1Block, int par2, int par3, int par4, RenderBlocks renderer, boolean colourMultiply)
|
||||
private boolean renderCrossedSquares(Block block, int x, int y, int z, RenderBlocks renderer, boolean colourMultiply)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
//TODO: blockAccess
|
||||
IBlockAccess world = renderer.field_147845_a;
|
||||
//TODO: getMixedBrightnessForBlock()
|
||||
tessellator.setBrightness(par1Block.func_149677_c(world, par2, par3, par4));
|
||||
tessellator.setBrightness(block.func_149677_c(world, x, y, z));
|
||||
float f = 1.0F;
|
||||
//TODO: colorMultiplier()
|
||||
int l = par1Block.func_149720_d(world, par2, par3, par4);
|
||||
int l = block.func_149720_d(world, x, y, z);
|
||||
float f1 = (l >> 16 & 255) / 255.0F;
|
||||
float f2 = (l >> 8 & 255) / 255.0F;
|
||||
float f3 = (l & 255) / 255.0F;
|
||||
|
@ -129,13 +129,13 @@ public class PlantsRenderer implements ISimpleBlockRenderingHandler
|
|||
}
|
||||
|
||||
tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
|
||||
double d0 = par2;
|
||||
double d1 = par3;
|
||||
double d2 = par4;
|
||||
double d0 = x;
|
||||
double d1 = y;
|
||||
double d2 = z;
|
||||
|
||||
long i1 = par2 * 3129871 ^ par4 * 116129781L ^ par3;
|
||||
long i1 = x * 3129871 ^ z * 116129781L ^ y;
|
||||
|
||||
int meta = world.getBlockMetadata(par2, par3, par4);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if (meta == 15)
|
||||
{
|
||||
|
@ -155,14 +155,14 @@ public class PlantsRenderer implements ISimpleBlockRenderingHandler
|
|||
if (meta == 14)
|
||||
{
|
||||
//TODO: drawCrossedSquares()
|
||||
renderer.func_147765_a(par1Block.func_149691_a(0, world.getBlockMetadata(par2, par3, par4)), d0, d1, d2, 1.0F);
|
||||
renderer.func_147765_a(block.func_149691_a(0, world.getBlockMetadata(x, y, z)), d0, d1, d2, 1.0F);
|
||||
//TODO: drawCrossedSquares()
|
||||
renderer.func_147765_a(((BlockBOPPlant)BOPBlockHelper.get("plants")).reedbottom, d0, d1 - 1, d2, 1.0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO: drawCrossedSquares()
|
||||
renderer.func_147730_a(par1Block, meta, d0, d1, d2, 1.0F);
|
||||
renderer.func_147765_a(block.func_149691_a(0, world.getBlockMetadata(x, y, z)), d0, d1, d2, 1.0F);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -89,11 +89,10 @@ public class BlockBOPCoral extends BlockBush
|
|||
}
|
||||
}
|
||||
|
||||
public boolean isValidPosition(World world, int x, int y, int z)
|
||||
public boolean isValidPosition(World world, int x, int y, int z, int metadata)
|
||||
{
|
||||
//TODO: getBlock()
|
||||
Block block = world.func_147439_a(x, y - 1, z);
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
|
||||
switch (metadata)
|
||||
{
|
||||
|
@ -109,10 +108,10 @@ public class BlockBOPCoral extends BlockBush
|
|||
}
|
||||
|
||||
@Override
|
||||
//TODO: canPlaceBlockOnSide
|
||||
public boolean func_149707_d(World world, int x, int y, int z, int side)
|
||||
//TODO: canReplace()
|
||||
public boolean func_149705_a(World world, int x, int y, int z, int side, ItemStack itemStack)
|
||||
{
|
||||
return isValidPosition(world, x, y, z);
|
||||
return isValidPosition(world, x, y, z, itemStack.getItemDamage());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -208,7 +207,7 @@ public class BlockBOPCoral extends BlockBush
|
|||
//TODO: canBlockStay()
|
||||
public boolean func_149718_j(World world, int x, int y, int z)
|
||||
{
|
||||
return isValidPosition(world, x, y, z);
|
||||
return isValidPosition(world, x, y, z, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -211,11 +211,10 @@ public class BlockBOPFlower extends BlockBush
|
|||
}
|
||||
}
|
||||
|
||||
public boolean isValidPosition(World world, int x, int y, int z)
|
||||
public boolean isValidPosition(World world, int x, int y, int z, int metadata)
|
||||
{
|
||||
//TODO: getBlock()
|
||||
Block block = world.func_147439_a(x, y - 1, z);
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
|
||||
switch (metadata)
|
||||
{
|
||||
|
@ -240,10 +239,10 @@ public class BlockBOPFlower extends BlockBush
|
|||
}
|
||||
|
||||
@Override
|
||||
//TODO: canPlaceBlockOnSide
|
||||
public boolean func_149707_d(World world, int x, int y, int z, int side)
|
||||
//TODO: canReplace()
|
||||
public boolean func_149705_a(World world, int x, int y, int z, int side, ItemStack itemStack)
|
||||
{
|
||||
return isValidPosition(world, x, y, z);
|
||||
return isValidPosition(world, x, y, z, itemStack.getItemDamage());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -253,9 +252,9 @@ public class BlockBOPFlower extends BlockBush
|
|||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if (meta == 11)
|
||||
return this.isValidPosition(world, x, y, z);
|
||||
return this.isValidPosition(world, x, y, z, meta);
|
||||
else
|
||||
return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) && isValidPosition(world, x, y, z);
|
||||
return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) && isValidPosition(world, x, y, z, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -180,11 +180,10 @@ public class BlockBOPFlower2 extends BlockBush
|
|||
}
|
||||
}
|
||||
|
||||
public boolean isValidPosition(World world, int x, int y, int z)
|
||||
public boolean isValidPosition(World world, int x, int y, int z, int metadata)
|
||||
{
|
||||
//TODO: getBlock()
|
||||
Block block = world.func_147439_a(x, y - 1, z);
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
|
||||
switch (metadata)
|
||||
{
|
||||
|
@ -200,10 +199,10 @@ public class BlockBOPFlower2 extends BlockBush
|
|||
}
|
||||
|
||||
@Override
|
||||
//TODO: canPlaceBlockOnSide
|
||||
public boolean func_149707_d(World world, int x, int y, int z, int side)
|
||||
//TODO: canReplace()
|
||||
public boolean func_149705_a(World world, int x, int y, int z, int side, ItemStack itemStack)
|
||||
{
|
||||
return isValidPosition(world, x, y, z);
|
||||
return isValidPosition(world, x, y, z, itemStack.getItemDamage());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -229,8 +228,8 @@ public class BlockBOPFlower2 extends BlockBush
|
|||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if (meta == 2 || meta == 6)
|
||||
return this.isValidPosition(world, x, y, z);
|
||||
return this.isValidPosition(world, x, y, z, meta);
|
||||
else
|
||||
return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) && this.isValidPosition(world, x, y, z);
|
||||
return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) && this.isValidPosition(world, x, y, z, meta);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -155,18 +155,17 @@ public class BlockBOPFoliage extends BlockTallGrass implements IShearable
|
|||
return ret;
|
||||
}
|
||||
|
||||
public boolean isValidPosition(World world, int x, int y, int z)
|
||||
public boolean isValidPosition(World world, int x, int y, int z, int metadata)
|
||||
{
|
||||
//TODO: getBlock()
|
||||
Block block = world.func_147439_a(x, y - 1, z);
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
|
||||
switch (metadata)
|
||||
{
|
||||
case GRASSTOP:
|
||||
return block == this;
|
||||
|
||||
case ALGAE: // Dead Grass
|
||||
case ALGAE: // Algae
|
||||
return block == Blocks.water;
|
||||
|
||||
default:
|
||||
|
@ -175,17 +174,17 @@ public class BlockBOPFoliage extends BlockTallGrass implements IShearable
|
|||
}
|
||||
|
||||
@Override
|
||||
//TODO: canPlaceBlockOnSide
|
||||
public boolean func_149707_d(World world, int x, int y, int z, int side)
|
||||
//TODO: canReplace()
|
||||
public boolean func_149705_a(World world, int x, int y, int z, int side, ItemStack itemStack)
|
||||
{
|
||||
return isValidPosition(world, x, y, z);
|
||||
return isValidPosition(world, x, y, z, itemStack.getItemDamage());
|
||||
}
|
||||
|
||||
@Override
|
||||
//TODO: canBlockStay()
|
||||
public boolean func_149718_j(World world, int x, int y, int z)
|
||||
{
|
||||
return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) && this.isValidPosition(world, x, y, z);
|
||||
return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) && this.isValidPosition(world, x, y, z, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -203,7 +202,7 @@ public class BlockBOPFoliage extends BlockTallGrass implements IShearable
|
|||
world.func_147465_d(x, y, z, Blocks.tallgrass, 1, 2);
|
||||
}
|
||||
//TODO: getBlock()
|
||||
else if (!this.isValidPosition(world, x, y, z))
|
||||
else if (!this.isValidPosition(world, x, y, z, metadata))
|
||||
{
|
||||
//TODO: dropBlockAsItem()
|
||||
this.func_149697_b(world, x, y + 1, z, world.getBlockMetadata(x, y + 1, z), 0);
|
||||
|
|
|
@ -186,10 +186,10 @@ public class BlockBOPPlant extends BlockBush implements IShearable
|
|||
}
|
||||
|
||||
@Override
|
||||
//TODO: canPlaceBlockOnSide
|
||||
public boolean func_149707_d(World world, int x, int y, int z, int side)
|
||||
//TODO: canReplace()
|
||||
public boolean func_149705_a(World world, int x, int y, int z, int side, ItemStack itemStack)
|
||||
{
|
||||
return this.isValidPosition(world, x, y, z, world.getBlockMetadata(x, y, z));
|
||||
return isValidPosition(world, x, y, z, itemStack.getItemDamage());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,6 +15,7 @@ import net.minecraft.world.World;
|
|||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import biomesoplenty.BiomesOPlenty;
|
||||
import biomesoplenty.api.BOPBlockHelper;
|
||||
|
||||
public class BlockBOPSapling extends BlockSapling
|
||||
{
|
||||
|
@ -65,23 +66,27 @@ public class BlockBOPSapling extends BlockSapling
|
|||
list.add(new ItemStack(block, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isValidPosition(World world, int x, int y, int z, int metadata)
|
||||
{
|
||||
//TODO: getBlock()
|
||||
Block block = world.func_147439_a(x, y - 1, z);
|
||||
|
||||
switch (metadata)
|
||||
{
|
||||
case 7: // Loftwood
|
||||
return block == BOPBlockHelper.get("holyGrass") || block == BOPBlockHelper.get("holyDirt");
|
||||
|
||||
default:
|
||||
return block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland || block.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
//TODO: canPlaceBlockOnSide
|
||||
public boolean func_149707_d(World world, int x, int y, int z, int side)
|
||||
{
|
||||
//TODO: getBlock()
|
||||
Block block = world.func_147439_a(x, y - 1, z);
|
||||
int meta = world.getBlockMetadata(x, y - 1, z);
|
||||
|
||||
switch (meta)
|
||||
{
|
||||
/*TODO FEATURE case 7: // Loftwood
|
||||
return id == Blocks.holyGrass.get().blockID || id == Blocks.holyDirt.get().blockID;*/
|
||||
|
||||
default:
|
||||
return block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland || block.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, this);
|
||||
}
|
||||
return isValidPosition(world, x, y, z, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -96,7 +101,7 @@ public class BlockBOPSapling extends BlockSapling
|
|||
(soil != null && soil.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, this));
|
||||
else
|
||||
return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) &&
|
||||
(soil != null && (soil.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, this) /*TODO FEATURE || soil == Blocks.holyGrass*/));
|
||||
(soil != null && (soil.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, this) || soil == BOPBlockHelper.get("holyGrass")));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue