Java Code Examples for net.minecraft.client.renderer.RenderBlocks#setOverrideBlockTexture()

The following examples show how to use net.minecraft.client.renderer.RenderBlocks#setOverrideBlockTexture() . 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: RenderCarvableBeacon.java    From Chisel-2 with GNU General Public License v2.0 6 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.1875F;
       renderer.setOverrideBlockTexture(renderer.getBlockIcon(Blocks.glass));
       renderer.renderStandardBlockWithAmbientOcclusion(block, x, y, z, 1, 1, 1);
       renderer.renderAllFaces = true;
       renderer.setOverrideBlockTexture(renderer.getBlockIcon(Blocks.obsidian));
       renderer.setRenderBounds(0.125D, 0.00625D, 0.125D, 0.875D, (double)f, 0.875D);
       renderer.renderStandardBlockWithAmbientOcclusion(block, x, y, z, 1, 1, 1);
       renderer.setOverrideBlockTexture(renderer.getBlockIcon(Blocks.beacon));
       renderer.setRenderBounds(0.1875D, (double)f, 0.1875D, 0.8125D, 0.875D, 0.8125D);
       renderer.renderStandardBlockWithAmbientOcclusion(block, x, y, z, 1, 1, 1);
       renderer.renderAllFaces = false;
       renderer.clearOverrideBlockTexture();
       return true;
}
 
Example 2
Source File: RenderChargingStationPad.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer){
    TileEntity te = world.getTileEntity(x, y, z);
    if(te instanceof TileEntityChargingStation) {
        TileEntityChargingStation station = (TileEntityChargingStation)te;
        if(station.getUpgrades(ItemMachineUpgrade.UPGRADE_DISPENSER_DAMAGE) > 0) {
            ItemStack camo = station.getCamoStack();
            Block camoBlock = ((ItemBlock)camo.getItem()).field_150939_a;
            renderer.renderAllFaces = true;
            renderer.setOverrideBlockTexture(camoBlock.getIcon(0, camo.getItemDamage()));
            renderer.setRenderBounds(0, 15 / 16D, 0, 1, 1, 1);
            renderer.renderStandardBlock(block, x, y, z);
            renderer.setOverrideBlockTexture(null);
            renderer.renderAllFaces = false;
            return true;
        }
    }
    return false;
}
 
Example 3
Source File: RendererSimpleLayered.java    From Chisel-2 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
	renderer.setOverrideBlockTexture(((BlockCarvableLayered) block).getBaseTex());
	renderer.renderStandardBlock(block, x, y, z);
	renderer.clearOverrideBlockTexture();
	renderer.renderStandardBlock(block, x, y, z);
	return true;
}
 
Example 4
Source File: RenderElevatorFrame.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer){
    boolean frameXPos = world.getBlock(x + 1, y, z) == Blockss.elevatorFrame;
    boolean frameXNeg = world.getBlock(x - 1, y, z) == Blockss.elevatorFrame;
    boolean frameZPos = world.getBlock(x, y, z + 1) == Blockss.elevatorFrame;
    boolean frameZNeg = world.getBlock(x, y, z - 1) == Blockss.elevatorFrame;
    TileEntityElevatorBase base = BlockElevatorFrame.getElevatorTE(world, x, y, z);
    renderer.renderAllFaces = true;
    if(base != null && base.frameCamo != null && PneumaticCraftUtils.isRenderIDCamo(base.frameCamo.getRenderType())) {
        renderer.setOverrideBlockTexture(base.frameCamo.getIcon(0, base.getStackInSlot(5).getItemDamage()));
    }
    if(!frameXPos && !frameZPos) {
        renderer.setRenderBounds(14 / 16D, 0, 14 / 16D, 15 / 16D, 1, 15 / 16D);
        renderer.renderStandardBlock(block, x, y, z);
    }
    if(!frameXNeg && !frameZPos) {
        renderer.setRenderBounds(1 / 16D, 0, 14 / 16D, 2 / 16D, 1, 15 / 16D);
        renderer.renderStandardBlock(block, x, y, z);
    }
    if(!frameXPos && !frameZNeg) {
        renderer.setRenderBounds(14 / 16D, 0, 1 / 16D, 15 / 16D, 1, 2 / 16D);
        renderer.renderStandardBlock(block, x, y, z);
    }
    if(!frameXNeg && !frameZNeg) {
        renderer.setRenderBounds(1 / 16D, 0, 1 / 16D, 2 / 16D, 1, 2 / 16D);
        renderer.renderStandardBlock(block, x, y, z);
    }
    renderer.setOverrideBlockTexture(null);
    renderer.renderAllFaces = false;
    return true;
}
 
Example 5
Source File: BlockPIMRenderer.java    From OpenPeripheral-Addons with MIT License 5 votes vote down vote up
@Override
public void renderInventoryBlock(BlockPIM block, int metadata, int modelID, RenderBlocks renderer) {
	RenderUtils.renderInventoryBlock(renderer, block, 0);

	renderer.setOverrideBlockTexture(BlockPIM.Icons.black);
	setTopPartBounds(renderer, false);
	RenderUtils.renderInventoryBlockNoBounds(renderer, block, 0);
	renderer.clearOverrideBlockTexture();
}
 
Example 6
Source File: BlockPIMRenderer.java    From OpenPeripheral-Addons with MIT License 5 votes vote down vote up
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, BlockPIM block, int modelId, RenderBlocks renderer) {
	renderer.setRenderBoundsFromBlock(block);
	renderer.renderStandardBlock(block, x, y, z);

	final boolean isBreaking = renderer.hasOverrideBlockTexture();
	if (!isBreaking) renderer.setOverrideBlockTexture(BlockPIM.Icons.black);

	final boolean hasPlayer = hasPlayer(world, x, y, z);
	setTopPartBounds(renderer, hasPlayer);
	renderer.renderStandardBlock(block, x, y, z);

	if (!isBreaking) renderer.clearOverrideBlockTexture();
	return true;
}
 
Example 7
Source File: RotorSimpleRenderer.java    From BigReactors with MIT License 5 votes vote down vote up
public static void renderBlade(RenderBlocks renderer, int x, int y, int z, Block block, int metadata, ForgeDirection rotorDir) {
	if(rotorDir == ForgeDirection.UNKNOWN) {
		rotorDir = ForgeDirection.UP;
	}
	
	double xMin, yMin, zMin, xMax, yMax, zMax;
	xMin = yMin = zMin = 0D;
	xMax = yMax = zMax = 1D;
	
	if(rotorDir.offsetX != 0) {
		xMin = 0.45D;
		xMax = 0.55D;
	}
	else if(rotorDir.offsetY != 0) {
		yMin = 0.45D;
		yMax = 0.55D;
	}
	else if(rotorDir.offsetZ != 0) {
		zMin = 0.45D;
		zMax = 0.55D;
	}
	
       Tessellator.instance.setColorRGBA(255, 255, 255, 255);
       renderer.setRenderBoundsFromBlock(block);
       renderer.setOverrideBlockTexture(null);
	
       renderer.setRenderBounds(xMin, yMin, zMin, xMax, yMax, zMax);
       renderer.renderFaceYNeg(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 0, metadata));
       renderer.setRenderBounds(xMin, yMin, zMin, xMax, yMax, zMax);
       renderer.renderFaceYPos(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 1, metadata));
       renderer.setRenderBounds(xMin, yMin, zMin, xMax, yMax, zMax);
       renderer.renderFaceZNeg(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 2, metadata));
       renderer.setRenderBounds(xMin, yMin, zMin, xMax, yMax, zMax);
       renderer.renderFaceZPos(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 3, metadata));
       renderer.setRenderBounds(xMin, yMin, zMin, xMax, yMax, zMax);
       renderer.renderFaceXNeg(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 4, metadata));
       renderer.setRenderBounds(xMin, yMin, zMin, xMax, yMax, zMax);
       renderer.renderFaceXPos(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 5, metadata));
       renderer.setRenderBounds(0D, 0D, 0D, 1D, 1D, 1D);
}
 
Example 8
Source File: RotorSimpleRenderer.java    From BigReactors with MIT License 4 votes vote down vote up
public static void renderRotorShaft(Block block, RenderBlocks renderer, int metadata, ForgeDirection majorAxis, boolean[] hasBlades, int x, int y, int z, boolean drawOuterRectangle) {
	double xMin, yMin, zMin;
	double xMax, yMax, zMax;
	xMin = yMin = zMin = 0.5D - rotorSize;
	xMax = yMax = zMax = 0.5D + rotorSize;
	
	if(majorAxis.offsetX != 0) {
		xMax = 1D;
		xMin = 0D;
	}
	if(majorAxis.offsetY != 0) {
		yMax = 1D;
		yMin = 0D;
	}
	if(majorAxis.offsetZ != 0) {
		zMax = 1D;
		zMin = 0D;
	}

       Tessellator.instance.setColorRGBA(255, 255, 255, 255);
       renderer.setRenderBoundsFromBlock(block);
       renderer.setOverrideBlockTexture(null);
	
       renderer.setRenderBounds(xMin, yMin, zMin, xMax, yMax, zMax);
       renderer.renderFaceYNeg(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 0, metadata));
       renderer.setRenderBounds(xMin, yMin, zMin, xMax, yMax, zMax);
       renderer.renderFaceYPos(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 1, metadata));
       renderer.setRenderBounds(xMin, yMin, zMin, xMax, yMax, zMax);
       renderer.renderFaceZNeg(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 2, metadata));
       renderer.setRenderBounds(xMin, yMin, zMin, xMax, yMax, zMax);
       renderer.renderFaceZPos(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 3, metadata));
       renderer.setRenderBounds(xMin, yMin, zMin, xMax, yMax, zMax);
       renderer.renderFaceXNeg(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 4, metadata));
       renderer.setRenderBounds(xMin, yMin, zMin, xMax, yMax, zMax);
       renderer.renderFaceXPos(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 5, metadata));
       renderer.setRenderBounds(0D, 0D, 0D, 1D, 1D, 1D);
       
       // Render blade surfaces, if present
       ForgeDirection[] bladeDirs = StaticUtils.neighborsBySide[majorAxis.ordinal()];
       for(int i = 0; i < bladeDirs.length; i++) {
       	if(hasBlades[i]) {
       		renderRotorBladeConnection(renderer, block, metadata, majorAxis, bladeDirs[i], x, y, z, drawOuterRectangle);
       	}
       }

       renderer.setRenderBounds(0D, 0D, 0D, 1D, 1D, 1D);
}