Java Code Examples for net.minecraft.world.IBlockAccess#getBlock()

The following examples show how to use net.minecraft.world.IBlockAccess#getBlock() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RotorSimpleRenderer.java    From BigReactors with MIT License 6 votes vote down vote up
private static boolean[] findBlades(IBlockAccess world, int x, int y, int z, Block block, ForgeDirection majorAxis) {
	boolean[] ret = new boolean[4];
	ForgeDirection[] dirsToCheck = StaticUtils.neighborsBySide[majorAxis.ordinal()];
	
	for(int i = 0; i < dirsToCheck.length; i++) {
		ForgeDirection dir = dirsToCheck[i];
		if(world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ) == block &&
				BlockTurbineRotorPart.isRotorBlade(world.getBlockMetadata(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ))) {
			ret[i] = true;
		}
		else {
			ret[i] = false;
		}
	}
	
	return ret;
}
 
Example 2
Source File: BlockQuantumPortal.java    From qcraft-mod with Apache License 2.0 6 votes vote down vote up
@Override
public boolean shouldSideBeRendered( IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5 )
{
    if( par1IBlockAccess.getBlock( par2, par3, par4 ) == this )
    {
        return false;
    }
    else
    {
        boolean flag = par1IBlockAccess.getBlock( par2 - 1, par3, par4 ) == this && par1IBlockAccess.getBlock( par2 - 2, par3, par4 ) != this;
        boolean flag1 = par1IBlockAccess.getBlock( par2 + 1, par3, par4 ) == this && par1IBlockAccess.getBlock( par2 + 2, par3, par4 ) != this;
        boolean flag2 = par1IBlockAccess.getBlock( par2, par3, par4 - 1 ) == this && par1IBlockAccess.getBlock( par2, par3, par4 - 2 ) != this;
        boolean flag3 = par1IBlockAccess.getBlock( par2, par3, par4 + 1 ) == this && par1IBlockAccess.getBlock( par2, par3, par4 + 2 ) != this;
        boolean flag4 = flag || flag1;
        boolean flag5 = flag2 || flag3;
        return flag4 && par5 == 4 ? true : ( flag4 && par5 == 5 ? true : ( flag5 && par5 == 2 ? true : flag5 && par5 == 3 ) );
    }
}
 
Example 3
Source File: BlockLaserBeam.java    From Artifacts with MIT License 6 votes vote down vote up
public static boolean func_72148_a(IBlockAccess world, int x, int y, int z, int l, int i) {
	int j1 = x + Direction.offsetX[i];
       int k1 = z + Direction.offsetZ[i];
       Block l1 = world.getBlock(j1, y, k1);
       boolean flag = (l & 2) == 2;
       
       int i2;

       if (l1 == BlockLaserBeamSource.instance)
       {
       	i2 = world.getBlockMetadata(j1, y, k1);
           int j2 = i2 & 3;
           return j2 == Direction.rotateOpposite[i];
           //return true;
       }
       else if (l1 == BlockLaserBeam.instance)
       {
           i2 = world.getBlockMetadata(j1, y, k1);
           boolean flag1 = (i2 & 2) == 2;
           return flag == flag1;
       }
       else
       {
           return false;
       }
}
 
Example 4
Source File: BlockLightChain.java    From GardenCollection with MIT License 6 votes vote down vote up
public Vec3[] getAttachPoints (IBlockAccess world, int x, int y, int z) {
    int yMin = findMinY(world, x, y, z);
    Block bottomBlock = world.getBlock(x, yMin - 1, z);

    IAttachable attachable = GardenAPI.instance().registries().attachable().getAttachable(bottomBlock, world.getBlockMetadata(x, y - 1, z));

    Vec3[] attachPoints = singleAttachPoint;
    if (bottomBlock instanceof IChainAttachable)
        attachPoints = ((IChainAttachable) bottomBlock).getChainAttachPoints(1);
    else if (attachable != null && attachable.isAttachable(world, x, y - 1, z, 1))
        attachPoints = new Vec3[] { Vec3.createVectorHelper(.5, attachable.getAttachDepth(world, x, y - 1, z, 1), .5) };
    else if (bottomBlock instanceof IChainSingleAttachable) {
        Vec3 attachPoint = ((IChainSingleAttachable) bottomBlock).getChainAttachPoint(world, x, y, z, 1);
        if (attachPoint != null)
            attachPoints = new Vec3[] { attachPoint };
    }
    else if (bottomBlock.renderAsNormalBlock() && bottomBlock.getMaterial() != Material.air)
        attachPoints = defaultAttachPoints;

    return attachPoints;
}
 
Example 5
Source File: BasicConnectionProfile.java    From GardenCollection with MIT License 5 votes vote down vote up
@Override
public boolean isAttachedNeighbor (IBlockAccess blockAccess, int x, int y, int z, int nx, int ny, int nz) {
    if (y != ny || Math.abs(nx - x) > 1 || Math.abs(nz - z) > 1)
        return false;

    Block sBlock = blockAccess.getBlock(x, y, z);
    Block nBlock = blockAccess.getBlock(nx, ny, nz);
    if (sBlock != nBlock)
        return false;

    int sData = blockAccess.getBlockMetadata(x, y, z);
    int nData = blockAccess.getBlockMetadata(nx, ny, nz);
    if (sData != nData)
        return false;

    TileEntity sEntity = blockAccess.getTileEntity(x, y, z);
    TileEntity nEntity = blockAccess.getTileEntity(nx, ny, nz);
    if (sEntity == null || nEntity == null || sEntity.getClass() != nEntity.getClass())
        return false;

    if (!(sEntity instanceof TileEntityGarden))
        return false;

    /*TileEntityGarden nGarden = (TileEntityGarden) nEntity;
    if ((substrate == null || nGarden.substrate == null) && substrate != nGarden.substrate)
        return false;

    if (substrate != null) {
        if (substrate.getItem() != nGarden.substrate.getItem() || substrate.getItemDamage() != nGarden.substrate.getItemDamage())
            return false;
    }*/

    return true;
}
 
Example 6
Source File: RendererSwitchingColorFluid.java    From bartworks with MIT License 5 votes vote down vote up
private float getFluidHeightForRender(IBlockAccess world, int x, int y, int z, BlockFluidBase block) {

        if (world.getBlock(x, y, z) == block) {
            Block vOrigin = world.getBlock(x, y + 1, z);
            if (vOrigin.getMaterial().isLiquid() || vOrigin instanceof IFluidBlock) {
                return RendererSwitchingColorFluid.LIGHT_Y_POS;
            }
            if (world.getBlockMetadata(x, y, z) == block.getMaxRenderHeightMeta()) {
                return RendererSwitchingColorFluid.THREE_QUARTERS_FILLED;
            }
        }
        return (!world.getBlock(x, y, z).getMaterial().isSolid() && world.getBlock(x, y + 1, z) == block) ? RendererSwitchingColorFluid.LIGHT_Y_POS : (block.getQuantaPercentage(world, x, y, z) * RendererSwitchingColorFluid.THREE_QUARTERS_FILLED);
    }
 
Example 7
Source File: CTM.java    From Chisel with GNU General Public License v2.0 5 votes vote down vote up
private static Block getBlockOrFacade(IBlockAccess world, int x, int y, int z, int side) {
  Block blk = world.getBlock(x, y, z);
  if(blk instanceof IFacade) {
    blk = ((IFacade)blk).getFacade(world, x, y, z, side);
  }
  return blk;
}
 
Example 8
Source File: BlockThinLogFence.java    From GardenCollection with MIT License 5 votes vote down vote up
public boolean canConnectFenceTo (IBlockAccess world, int x, int y, int z) {
    Block block = world.getBlock(x, y, z);
    if (block != this)
        return (block.getMaterial().isOpaque() && block.renderAsNormalBlock()) ? block.getMaterial() != Material.gourd : false;

    return true;
}
 
Example 9
Source File: BlockGardenProxy.java    From GardenCollection with MIT License 5 votes vote down vote up
public BlockGarden getGardenBlock (IBlockAccess world, int x, int y, int z) {
    if (y == 0)
        return null;

    y = getBaseBlockYCoord(world, x, y, z);
    Block underBlock = world.getBlock(x, y, z);

    if (!(underBlock instanceof BlockGarden))
        return null;

    return (BlockGarden) underBlock;
}
 
Example 10
Source File: BlockThinLog.java    From GardenCollection with MIT License 5 votes vote down vote up
private BlockThinLog getBlock (IBlockAccess blockAccess, int x, int y, int z) {
    Block block = blockAccess.getBlock(x, y, z);
    if (block != null && block instanceof BlockThinLog)
        return (BlockThinLog)block;

    return null;
}
 
Example 11
Source File: BlockIllusionary.java    From Artifacts with MIT License 5 votes vote down vote up
@Override
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side)
{
	if(world.getBlock(x, y, z) == this || world.getBlock(x, y, z).isOpaqueCube())
		return false;
    return true;
}
 
Example 12
Source File: BlockGarden.java    From GardenCollection with MIT License 5 votes vote down vote up
protected boolean enoughSpaceAround (IBlockAccess blockAccess, int x, int y, int z, int slot, PlantItem plant) {
    int height = plant.getPlantHeight();

    boolean enough = true;
    for (int i = 0; i < height; i++)
        enough &= blockAccess.isAirBlock(x, y + 1 + i, z) || blockAccess.getBlock(x, y + 1 + i, z) instanceof IPlantProxy;

    return enough;
}
 
Example 13
Source File: BlockPressureChamberWall.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
private boolean isGlass(IBlockAccess world, int x, int y, int z){
    return world.getBlock(x, y, z) == this && world.getBlockMetadata(x, y, z) > 5;
}
 
Example 14
Source File: BlockWallPlate.java    From Artifacts with MIT License 4 votes vote down vote up
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
{
	if(this.camouflage) {
		
		IIcon icon = this.blockIcon;
		Block block = Blocks.air;
		int bMeta = 0;
		int bx = x;
		int bz = z;
		int meta = world.getBlockMetadata(x, y, z) & 0x07;

		if (meta == 2 && side == 2)
		{
			block = world.getBlock(x, y, z+1);
			bMeta = world.getBlockMetadata(x, y, z+1);
			bz = z+1;
		}
		else if (meta == 3 && side == 3)
		{
			block = world.getBlock(x, y, z-1);
			bMeta = world.getBlockMetadata(x, y, z-1);
			bz = z-1;
		}
		else if (meta == 4 && side == 4)
		{
			block = world.getBlock(x+1, y, z);
			bMeta = world.getBlockMetadata(x+1, y, z);
			bx = x+1;
		}
		else if (meta == 5 && side == 5)
		{
			block = world.getBlock(x-1, y, z);
			bMeta = world.getBlockMetadata(x-1, y, z);
			bx = x-1;
		}
		else {
			block = this == camoStone ? Blocks.stone : this == camoObsidian ? Blocks.obsidian : Blocks.planks;
			bMeta = 0;
		}
		
		if(block != null) {
			if(block == BlockTrap.instance) {
				int[] blockToCopyLocation = BlockTrap.getNeighbourBlockPosition(world, bx, y, bz, block, bMeta);
				Block blockToCopy = Blocks.stonebrick;
				int metaToCopy = 0;
				if(! (blockToCopyLocation[0] == x && blockToCopyLocation[1] == y && blockToCopyLocation[2] == z )) {
					blockToCopy = world.getBlock(blockToCopyLocation[0], blockToCopyLocation[1], blockToCopyLocation[2]);
					metaToCopy = world.getBlockMetadata(blockToCopyLocation[0], blockToCopyLocation[1], blockToCopyLocation[2]);
				}
				return blockToCopy.getIcon(side, metaToCopy);
			}
			else if(block != this && block.isOpaqueCube()) {
				icon = block.getIcon(side, bMeta);
				if(icon != null) {
					return icon;
				}
			}
			else if(block == BlockIllusionary.instance) {
				return block.getIcon(world, bx, y, bz, side);
			}
		}
	}
	
	//If it fails, return default icon.
	return super.getIcon(world, x, y, z, side);

}
 
Example 15
Source File: BlockDoorRenderer.java    From Et-Futurum with The Unlicense 4 votes vote down vote up
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
	Tessellator tessellator = Tessellator.instance;
	int meta = world.getBlockMetadata(x, y, z);

	if ((meta & 8) != 0) {
		if (world.getBlock(x, y - 1, z) != block)
			return false;
	} else if (world.getBlock(x, y + 1, z) != block)
		return false;

	int brightness = block.getMixedBrightnessForBlock(world, x, y, z);

	tessellator.setBrightness(renderer.renderMinY > 0.0D ? brightness : block.getMixedBrightnessForBlock(world, x, y - 1, z));
	tessellator.setColorOpaque_F(0.5F, 0.5F, 0.5F);
	renderer.renderFaceYNeg(block, x, y, z, renderer.getBlockIcon(block, world, x, y, z, 0));

	if ((meta & 8) != 0) {
		tessellator.setBrightness(renderer.renderMaxY < 1.0D ? brightness : block.getMixedBrightnessForBlock(world, x, y + 1, z));
		tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
		renderer.uvRotateTop = 2;
		renderer.renderFaceYPos(block, x, y, z, renderer.getBlockIcon(block, world, x, y, z, 1));
		renderer.uvRotateTop = 0;
	}

	tessellator.setBrightness(renderer.renderMinZ > 0.0D ? brightness : block.getMixedBrightnessForBlock(world, x, y, z - 1));
	tessellator.setColorOpaque_F(0.8F, 0.8F, 0.8F);
	renderer.renderFaceZNeg(block, x, y, z, renderer.getBlockIcon(block, world, x, y, z, 2));

	renderer.flipTexture = false;
	tessellator.setBrightness(renderer.renderMaxZ < 1.0D ? brightness : block.getMixedBrightnessForBlock(world, x, y, z + 1));
	tessellator.setColorOpaque_F(0.8F, 0.8F, 0.8F);
	renderer.renderFaceZPos(block, x, y, z, renderer.getBlockIcon(block, world, x, y, z, 3));

	renderer.flipTexture = false;
	tessellator.setBrightness(renderer.renderMinX > 0.0D ? brightness : block.getMixedBrightnessForBlock(world, x - 1, y, z));
	tessellator.setColorOpaque_F(0.6F, 0.6F, 0.6F);
	renderer.renderFaceXNeg(block, x, y, z, renderer.getBlockIcon(block, world, x, y, z, 4));

	renderer.flipTexture = false;
	tessellator.setBrightness(renderer.renderMaxX < 1.0D ? brightness : block.getMixedBrightnessForBlock(world, x + 1, y, z));
	tessellator.setColorOpaque_F(0.6F, 0.6F, 0.6F);
	renderer.renderFaceXPos(block, x, y, z, renderer.getBlockIcon(block, world, x, y, z, 5));

	renderer.flipTexture = false;
	return true;
}
 
Example 16
Source File: LightChainRenderer.java    From GardenCollection with MIT License 4 votes vote down vote up
private boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, BlockLightChain block, int modelId, RenderBlocks renderer) {
    Tessellator tessellator = Tessellator.instance;
    tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));

    int color = block.colorMultiplier(world, x, y, z);
    float r = (float)(color >> 16 & 255) / 255f;
    float g = (float)(color >> 8 & 255) / 255f;
    float b = (float)(color & 255) / 255f;

    tessellator.setColorOpaque_F(r, g, b);

    IIcon icon = block.getIcon(0, world.getBlockMetadata(x, y, z));
    if (renderer.hasOverrideBlockTexture())
        icon = renderer.overrideBlockTexture;

    int yMin = block.findMinY(world, x, y, z);
    int yMax = block.findMaxY(world, x, y, z);

    double upperDepth = 0;
    double lowerDepth = 0;

    Block blockTop = world.getBlock(x, yMax + 1, z);
    if (blockTop instanceof IChainSingleAttachable) {
        Vec3 topAttach = ((IChainSingleAttachable) blockTop).getChainAttachPoint(world, x, yMax + 1, z, 0);
        if (topAttach != null)
            upperDepth = topAttach.yCoord;
    }

    if (upperDepth == 0) {
        IAttachable attachable = GardenAPI.instance().registries().attachable().getAttachable(blockTop, world.getBlockMetadata(x, y + 1, z));
        if (attachable != null && attachable.isAttachable(world, x, y + 1, z, 0))
            upperDepth = attachable.getAttachDepth(world, x, y + 1, z, 0);
    }

    for (Vec3 point : block.getAttachPoints(world, x, y, z)) {
        float height = yMax - yMin + 2 - (float)point.yCoord + (float)upperDepth;

        double cx = .5f;
        double cz = .5f;
        double dx = cx - point.xCoord;
        double dz = cz - point.zCoord;
        double yt = y + 1;
        double yb = y;

        double localYMin = yMin + point.yCoord - 1;

        if (y == yMin)
            yb = y - 1 + point.yCoord;
        if (y == yMax)
            yt = y + 1 + upperDepth;

        double lerpB = 1 - ((yb - localYMin) / height);
        double lerpT = 1 - ((yt - localYMin) / height);

        drawBetween(renderer, icon, x + dx * lerpB + cx, yb, z + dz * lerpB + cz, x + dx * lerpT + cx, yt, z + dz * lerpT + cz);
    }


    /*double lerpB = ((y - yMin) / height) * .5f;
    double lerpT = ((y + 1 - yMin) / height) * .5f;

    drawBetween(renderer, icon, .005 + x + lerpB, y, z + lerpB, x + lerpT, y + 1, z + lerpT);
    drawBetween(renderer, icon, .005 + x + 1 - lerpB, y, z + lerpB, x + 1 - lerpT, y + 1, z + lerpT);
    drawBetween(renderer, icon, .005 + x + lerpB, y, z + 1 - lerpB, x + lerpT, y + 1, z + 1 - lerpT);
    drawBetween(renderer, icon, .005 + x + 1 - lerpB, y, z + 1 - lerpB, x + 1 - lerpT, y + 1, z + 1 - lerpT);*/

    gardenProxyRenderer.renderWorldBlock(world, x, y, z, ModBlocks.gardenProxy, ModBlocks.gardenProxy.getRenderType(), renderer);

    return true;
}
 
Example 17
Source File: RenderFakeBlock.java    From Artifacts with MIT License 4 votes vote down vote up
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
	float f = 0.03125F;
	float xn = 0F;
	float xp = 1F;
	float yn = 0F;
	float yp = 1F;
	float zn = 0F;
	float zp = 1F;
	if(!world.getBlock(x-1, y, z).isOpaqueCube()) {
		if(world.getBlock(x-1, y, z) != block)
			xn = f;
	}
	if(!world.getBlock(x+1, y, z).isOpaqueCube()) {
		if(world.getBlock(x+1, y, z) != block)
			xp = 1F-f;
	}
	if(!world.getBlock(x, y-1, z).isOpaqueCube()) {
		if(world.getBlock(x, y-1, z) != block)
			yn = f;
	}
	if(!world.getBlock(x, y+1, z).isOpaqueCube()) {
		if(world.getBlock(x, y+1, z) != block)
			yp = 1F-f;
	}
	if(!world.getBlock(x, y, z-1).isOpaqueCube()) {
		if(world.getBlock(x, y, z-1) != block)
			zn = f;
	}
	if(!world.getBlock(x, y, z+1).isOpaqueCube()) {
		if(world.getBlock(x, y, z+1) != block)
			zp = 1F-f;
	}
	//block.setBlockBounds(xn, yn, zn, xp, yp, zp);
	renderer.setRenderBounds(xn, yn, zn, xp, yp, zp);
	
	int l = block.colorMultiplier(world, x, y, z);
       float f0 = (float)(l >> 16 & 255) / 255.0F;
       float f1 = (float)(l >> 8 & 255) / 255.0F;
       float f2 = (float)(l & 255) / 255.0F;

       if (EntityRenderer.anaglyphEnable)
       {
           float f3 = (f * 30.0F + f1 * 59.0F + f2 * 11.0F) / 100.0F;
           float f4 = (f * 30.0F + f1 * 70.0F) / 100.0F;
           float f5 = (f * 30.0F + f2 * 70.0F) / 100.0F;
           f0 = f3;
           f1 = f4;
           f2 = f5;
       }
       
       //if() {
       /*f0 *= 1.5;
       f1 *= 1.5;
       f2 *= 1.5;*/
       //}

       return renderer.renderStandardBlockWithColorMultiplier(block, x, y, z, f0, f1, f2);
}
 
Example 18
Source File: BlockLaserBeam.java    From Artifacts with MIT License 4 votes vote down vote up
public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
	int l = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
	int i1 = 0;
    boolean[] flag = new boolean[4];
    while (i1 < 4)
    {
        int j1 = 1;

        while (true)
        {
            if (j1 < 16)
            {
                int k1 = par2 + Direction.offsetX[i1] * j1;
                int l1 = par4 + Direction.offsetZ[i1] * j1;
                
                Block i2 = par1IBlockAccess.getBlock(k1, par3, l1);

                if (i2 == BlockLaserBeamSource.instance)
                {
                    flag[i1] = true;
                }
                else if (i2 == this.instance || !par1IBlockAccess.getBlock(k1, par3, l1).isOpaqueCube())
                {
                    ++j1;
                    continue;
                }
            }

            ++i1;
            break;
        }
    }
	if(flag[0] || flag[2]) {
		l = l|2;
	}
	else {
		l = (l|2)-2;
	}
	if(flag[1] || flag[3]) {
		l = l|4;
	}
	else {
		l = (l|4)-4;
	}
	
	boolean flag1 = (l & 4) == 4;
    boolean flag2 = (l & 2) == 2;

    if (flag2 && !flag1)
    {
        this.setBlockBounds(0.4F, 0.5F, 0.0F, 0.6F, 0.59375F, 1.0F);
    }
    else if (flag1 && !flag2)
    {
        this.setBlockBounds(0.0F, 0.5F, 0.4F, 1.0F, 0.59375F, 0.6F);
    }
    else
    {
        this.setBlockBounds(0.0F, 0.5F, 0.0F, 1.0F, 0.59375F, 1.0F);
    }
}
 
Example 19
Source File: ThinLogRenderer.java    From GardenCollection with MIT License 4 votes vote down vote up
private boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, BlockThinLog block, int modelId, RenderBlocks renderer) {
        float margin = block.getMargin();
        int connectFlags = block.calcConnectionFlags(world, x, y, z);

        boolean connectYNeg = (connectFlags & 1) != 0;
        boolean connectYPos = (connectFlags & 2) != 0;
        boolean connectZNeg = (connectFlags & 4) != 0;
        boolean connectZPos = (connectFlags & 8) != 0;
        boolean connectXNeg = (connectFlags & 16) != 0;
        boolean connectXPos = (connectFlags & 32) != 0;

        boolean connectY = connectYNeg | connectYPos;
        boolean connectZ = connectZNeg | connectZPos;
        boolean connectX = connectXNeg | connectXPos;

        if (!(connectYNeg && connectYPos) && !(connectZNeg && connectZPos) && !(connectXNeg && connectXPos)) {
            if (connectY && !connectX && !connectZ)
                block.setOrientation(0);
            else if (connectZ && !connectY && !connectX)
                block.setOrientation(1);
            else if (connectX && !connectY && !connectZ)
                block.setOrientation(2);
            else
                block.setOrientation(3);

            renderer.setRenderBounds(margin, margin, margin, 1 - margin, 1 - margin, 1 - margin);
            renderer.renderStandardBlock(block, x, y, z);
        }

        if (connectY) {
            block.setOrientation(0);
            if (connectYNeg && connectYPos)
                renderer.setRenderBounds(margin, 0, margin, 1 - margin, 1, 1 - margin);
            else if (connectYNeg)
                renderer.setRenderBounds(margin, 0, margin, 1 - margin, margin, 1 - margin);
            else if (connectYPos)
                renderer.setRenderBounds(margin, 1 - margin, margin, 1 - margin, 1, 1 - margin);
            renderer.renderStandardBlock(block, x, y, z);
        }

        if (connectZ) {
            block.setOrientation(1);
            if (connectZNeg && connectZPos)
                renderer.setRenderBounds(margin, margin, 0, 1 - margin, 1 - margin, 1);
            else if (connectZNeg)
                renderer.setRenderBounds(margin, margin, 0, 1 - margin, 1 - margin, margin);
            else if (connectZPos)
                renderer.setRenderBounds(margin, margin, 1 - margin, 1 - margin, 1 - margin, 1);
            renderer.renderStandardBlock(block, x, y, z);
        }

        if (connectX) {
            block.setOrientation(2);
            if (connectXNeg && connectXPos)
                renderer.setRenderBounds(0, margin, margin, 1, 1 - margin, 1 - margin);
            else if (connectXNeg)
                renderer.setRenderBounds(0, margin, margin, margin, 1 - margin, 1 - margin);
            else if (connectXPos)
                renderer.setRenderBounds(1 - margin, margin, margin, 1, 1 - margin, 1 - margin);
            renderer.renderStandardBlock(block, x, y, z);
        }

        block.setOrientation(0);

        //renderer.renderStandardBlock(block, x, y, z);

        Block blockUnder = world.getBlock(x, y - 1, z);
        if (blockUnder instanceof BlockGarden) {
            float yDiff = ((BlockGarden) blockUnder).getSlotProfile().getPlantOffsetY(world, x, y, z, 0);
            if (yDiff >= (1 - .0625f) * 2) {
                //Tessellator tessellator = Tessellator.instance;
                //tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
                //tessellator.setColorOpaque_F(1f, 1f, 1f);

//            block.setBlockBounds(margin, -.0625f, margin, 1 - margin, 0, 1 - margin);
                renderer.setRenderBounds(margin, yDiff, margin, 1 - margin, 1, 1 - margin);
                renderer.renderStandardBlock(block, x, y - 1, z);

                //IIcon sideIcon = block.getIcon(2, world.getBlockMetadata(x, y, z));
                //renderer.renderFaceXNeg(block, x, y - 1, z, sideIcon);
                //renderer.renderFaceXPos(block, x, y - 1, z, sideIcon);
                //renderer.renderFaceZNeg(block, x, y - 1, z, sideIcon);
                //renderer.renderFaceZPos(block, x, y - 1, z, sideIcon);
//            block.setBlockBoundsForItemRender();
                renderer.setRenderBoundsFromBlock(block);
            }
        }

        return true;
    }
 
Example 20
Source File: CameraAnimatorPivot.java    From LookingGlass with GNU General Public License v3.0 4 votes vote down vote up
private boolean isBlockNormalCube(IBlockAccess blockData, int x, int y, int z) {
	Block block = blockData.getBlock(x, y, z);
	return block.isNormalCube(blockData, x, y, z);
}