Search in sources :

Example 6 with IIcon

use of net.minecraft.util.IIcon in project BluePower by Qmunity.

the class GateSupported method renderStatic.

// Redwire connectivity
// Rendering
@Override
@SideOnly(Side.CLIENT)
public boolean renderStatic(Vec3i translation, RenderHelper renderer, RenderBlocks renderBlocks, int pass) {
    super.renderStatic(translation, renderer, renderBlocks, pass);
    IIcon planks = Blocks.planks.getIcon(0, 0);
    renderer.renderBox(new Vec3dCube(2 / 16D, 2 / 16D, 2 / 16D, 3 / 16D, 10 / 16D, 3 / 16D), planks);
    renderer.renderBox(new Vec3dCube(2 / 16D, 2 / 16D, 13 / 16D, 3 / 16D, 10 / 16D, 14 / 16D), planks);
    renderer.renderBox(new Vec3dCube(2 / 16D, 9 / 16D, 3 / 16D, 3 / 16D, 10 / 16D, 13 / 16D), planks);
    renderer.renderBox(new Vec3dCube(13 / 16D, 2 / 16D, 2 / 16D, 14 / 16D, 10 / 16D, 3 / 16D), planks);
    renderer.renderBox(new Vec3dCube(13 / 16D, 2 / 16D, 13 / 16D, 14 / 16D, 10 / 16D, 14 / 16D), planks);
    renderer.renderBox(new Vec3dCube(13 / 16D, 9 / 16D, 3 / 16D, 14 / 16D, 10 / 16D, 13 / 16D), planks);
    renderer.setColor(0xFFFFFF);
    return true;
}
Also used : IIcon(net.minecraft.util.IIcon) Vec3dCube(uk.co.qmunity.lib.vec.Vec3dCube) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 7 with IIcon

use of net.minecraft.util.IIcon in project BluePower by Qmunity.

the class PartCageLamp method renderLamp.

@Override
@SideOnly(Side.CLIENT)
public void renderLamp(RenderHelper renderer) {
    Vec3dCube vector = new Vec3dCube(3 / 16D, 0.0, 3 / 16D, 13 / 16D, 2 / 16D, 13 / 16D);
    IIcon topIcon = IconSupplier.cagedLampFootTop;
    IIcon sideIcon = IconSupplier.cagedLampFootSide;
    renderer.renderBox(vector, topIcon, topIcon, sideIcon, sideIcon, sideIcon, sideIcon);
    vector = new Vec3dCube(4 / 16D, 2 / 16D, 4 / 16D, 12 / 16D, 12 / 16D, 12 / 16D);
    topIcon = IconSupplier.cagedLampCageTop;
    sideIcon = IconSupplier.cagedLampCageSide;
    renderer.setRenderSide(ForgeDirection.DOWN, false);
    for (int i = 0; i < 2; i++) {
        renderer.setRenderFromInside(i == 1);
        renderer.renderBox(vector, topIcon, topIcon, sideIcon, sideIcon, sideIcon, sideIcon);
    }
    renderer.setRenderFromInside(false);
    vector = new Vec3dCube(5 / 16D, 2 / 16D, 5 / 16D, 11 / 16D, 11 / 16D, 11 / 16D);
    if (inverted ? (power & 0xFF) == 255 : power == 0) {
        sideIcon = IconSupplier.cagedLampLampInactive;
        topIcon = IconSupplier.cagedLampLampInactiveTop;
    } else {
        sideIcon = IconSupplier.cagedLampLampActive;
        topIcon = IconSupplier.cagedLampLampActiveTop;
    }
    renderer.setColor(color.getHex());
    renderer.renderBox(vector, topIcon, topIcon, sideIcon, sideIcon, sideIcon, sideIcon);
    renderer.setColor(0xFFFFFF);
}
Also used : IIcon(net.minecraft.util.IIcon) Vec3dCube(uk.co.qmunity.lib.vec.Vec3dCube) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 8 with IIcon

use of net.minecraft.util.IIcon in project LogisticsPipes by RS485.

the class LogicLayoutGui method drawMap.

private void drawMap(int par1, int par2) {
    tooltip = null;
    int mapX = MathHelper.floor_double(guiMapX);
    int mapY = MathHelper.floor_double(guiMapY - zoom.moveY);
    int leftSide = ((width - xSize) / 2);
    int topSide = ((height - ySize) / 2);
    GL11.glTranslatef(0.0F, 0.0F, 100.0F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.getTextureManager().bindTexture(LogicLayoutGui.achievementTextures);
    drawTexturedModalRect(leftSide, topSide, 0, 0, 256, 202);
    GL11.glTranslatef(0.0F, 0.0F, -100.0F);
    guiTop *= 1 / zoom.zoom;
    guiLeft *= 1 / zoom.zoom;
    xSize *= 1 / zoom.zoom;
    ySize *= 1 / zoom.zoom;
    leftSide *= 1 / zoom.zoom;
    topSide *= 1 / zoom.zoom;
    par1 *= 1 / zoom.zoom;
    par2 *= 1 / zoom.zoom;
    int innerLeftSide = leftSide + 16;
    int innerTopSide = topSide + 17;
    zLevel = 0.0F;
    GL11.glDepthFunc(GL11.GL_GEQUAL);
    GL11.glPushMatrix();
    GL11.glScalef(zoom.zoom, zoom.zoom, 1);
    GL11.glTranslatef(0.0F, 0.0F, -100.0F);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    int moveBackgroundX = (mapX) % 16 + (mapX < 0 ? 16 : 0);
    int moveBackgroundY = (mapY) % 16 + (mapY < 0 ? 16 : 0);
    GL11.glColor4f(0.7F, 0.7F, 0.7F, 1.0F);
    for (int yVar = 0; yVar * 16 - moveBackgroundY < zoom.bottomRenderBorder; yVar++) {
        for (int xVar = 0; xVar * 16 - moveBackgroundX < zoom.rightRenderBorder; xVar++) {
            IIcon icon = Blocks.stone.getIcon(0, 0);
            mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
            drawTexturedModelRectFromIcon(innerLeftSide + xVar * 16 - moveBackgroundX, innerTopSide + yVar * 16 - moveBackgroundY, icon, 16, 16);
        }
    }
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    //Draw Content
    //Lines
    //Draw Background
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
    RenderHelper.enableGUIStandardItemLighting();
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    GL11.glColor4f(0.7F, 0.7F, 0.7F, 1.0F);
    mc.getTextureManager().bindTexture(LogicLayoutGui.achievementTextures);
    //Draw Content
    //Items
    GL11.glPopMatrix();
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    guiTop *= zoom.zoom;
    guiLeft *= zoom.zoom;
    xSize *= zoom.zoom;
    ySize *= zoom.zoom;
    leftSide *= zoom.zoom;
    topSide *= zoom.zoom;
    GL11.glScalef(1 / zoom.zoom, 1 / zoom.zoom, 1);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.getTextureManager().bindTexture(LogicLayoutGui.achievementTextures);
    drawTexturedModalRect(leftSide, topSide, 0, 0, 256, 202);
    GL11.glPopMatrix();
    zLevel = 0.0F;
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    //GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_LIGHTING);
    RenderHelper.disableStandardItemLighting();
}
Also used : IIcon(net.minecraft.util.IIcon)

Example 9 with IIcon

use of net.minecraft.util.IIcon in project LogisticsPipes by RS485.

the class LogisticsBlockGenericPipe method addHitEffects.

/**
	 * Spawn a digging particle effect in the world, this is a wrapper around
	 * EffectRenderer.addBlockHitEffects to allow the block more control over
	 * the particles. Useful when you have entirely different texture sheets for
	 * different sides/locations in the world.
	 *
	 * @param worldObj
	 *            The current world
	 * @param target
	 *            The target the player is looking at {x/y/z/side/sub}
	 * @param effectRenderer
	 *            A reference to the current effect renderer.
	 * @return True to prevent vanilla digging particles form spawning.
	 */
@SideOnly(Side.CLIENT)
@Override
public boolean addHitEffects(World worldObj, MovingObjectPosition target, EffectRenderer effectRenderer) {
    int x = target.blockX;
    int y = target.blockY;
    int z = target.blockZ;
    CoreUnroutedPipe pipe = LogisticsBlockGenericPipe.getPipe(worldObj, x, y, z);
    if (pipe == null) {
        return false;
    }
    IIcon icon = pipe.getIconProvider().getIcon(pipe.getIconIndexForItem());
    int sideHit = target.sideHit;
    Block block = LogisticsPipes.LogisticsPipeBlock;
    float b = 0.1F;
    double px = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - (b * 2.0F)) + b + block.getBlockBoundsMinX();
    double py = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - (b * 2.0F)) + b + block.getBlockBoundsMinY();
    double pz = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - (b * 2.0F)) + b + block.getBlockBoundsMinZ();
    if (sideHit == 0) {
        py = y + block.getBlockBoundsMinY() - b;
    }
    if (sideHit == 1) {
        py = y + block.getBlockBoundsMaxY() + b;
    }
    if (sideHit == 2) {
        pz = z + block.getBlockBoundsMinZ() - b;
    }
    if (sideHit == 3) {
        pz = z + block.getBlockBoundsMaxZ() + b;
    }
    if (sideHit == 4) {
        px = x + block.getBlockBoundsMinX() - b;
    }
    if (sideHit == 5) {
        px = x + block.getBlockBoundsMaxX() + b;
    }
    EntityDiggingFX fx = new EntityDiggingFX(worldObj, px, py, pz, 0.0D, 0.0D, 0.0D, block, sideHit, worldObj.getBlockMetadata(x, y, z));
    fx.setParticleIcon(icon);
    effectRenderer.addEffect(fx.applyColourMultiplier(x, y, z).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F));
    return true;
}
Also used : EntityDiggingFX(net.minecraft.client.particle.EntityDiggingFX) IIcon(net.minecraft.util.IIcon) Block(net.minecraft.block.Block) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 10 with IIcon

use of net.minecraft.util.IIcon in project LogisticsPipes by RS485.

the class LogisticsBlockGenericSubMultiBlock method addHitEffects.

@Override
public boolean addHitEffects(World worldObj, MovingObjectPosition target, EffectRenderer effectRenderer) {
    int x = target.blockX;
    int y = target.blockY;
    int z = target.blockZ;
    DoubleCoordinates pos = new DoubleCoordinates(x, y, z);
    TileEntity tile = pos.getTileEntity(worldObj);
    if (tile instanceof LogisticsTileGenericSubMultiBlock) {
        List<LogisticsTileGenericPipe> mainPipeList = ((LogisticsTileGenericSubMultiBlock) tile).getMainPipe();
        for (LogisticsTileGenericPipe mainPipe : mainPipeList) {
            if (mainPipe != null && mainPipe.pipe != null && mainPipe.pipe.isMultiBlock()) {
                if (LogisticsPipes.LogisticsPipeBlock.doRayTrace(worldObj, mainPipe.xCoord, mainPipe.yCoord, mainPipe.zCoord, Minecraft.getMinecraft().thePlayer) != null) {
                    CoreUnroutedPipe pipe = mainPipe.pipe;
                    if (pipe == null) {
                        return false;
                    }
                    IIcon icon = pipe.getIconProvider().getIcon(pipe.getIconIndexForItem());
                    int sideHit = target.sideHit;
                    Block block = LogisticsPipes.LogisticsPipeBlock;
                    float b = 0.1F;
                    double px = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - (b * 2.0F)) + b + block.getBlockBoundsMinX();
                    double py = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - (b * 2.0F)) + b + block.getBlockBoundsMinY();
                    double pz = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - (b * 2.0F)) + b + block.getBlockBoundsMinZ();
                    if (sideHit == 0) {
                        py = y + block.getBlockBoundsMinY() - b;
                    }
                    if (sideHit == 1) {
                        py = y + block.getBlockBoundsMaxY() + b;
                    }
                    if (sideHit == 2) {
                        pz = z + block.getBlockBoundsMinZ() - b;
                    }
                    if (sideHit == 3) {
                        pz = z + block.getBlockBoundsMaxZ() + b;
                    }
                    if (sideHit == 4) {
                        px = x + block.getBlockBoundsMinX() - b;
                    }
                    if (sideHit == 5) {
                        px = x + block.getBlockBoundsMaxX() + b;
                    }
                    EntityDiggingFX fx = new EntityDiggingFX(worldObj, px, py, pz, 0.0D, 0.0D, 0.0D, block, sideHit, worldObj.getBlockMetadata(x, y, z));
                    fx.setParticleIcon(icon);
                    effectRenderer.addEffect(fx.applyColourMultiplier(x, y, z).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F));
                    return true;
                }
            }
        }
    }
    return super.addHitEffects(worldObj, target, effectRenderer);
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) EntityDiggingFX(net.minecraft.client.particle.EntityDiggingFX) IIcon(net.minecraft.util.IIcon) Block(net.minecraft.block.Block) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates)

Aggregations

IIcon (net.minecraft.util.IIcon)79 Tessellator (net.minecraft.client.renderer.Tessellator)19 SideOnly (cpw.mods.fml.relauncher.SideOnly)17 Vec3dCube (uk.co.qmunity.lib.vec.Vec3dCube)11 ItemStack (net.minecraft.item.ItemStack)6 EntityItem (net.minecraft.entity.item.EntityItem)5 Fluid (net.minecraftforge.fluids.Fluid)5 Rotation (uk.co.qmunity.lib.transform.Rotation)5 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)4 AMVector2 (am2.api.math.AMVector2)3 Block (net.minecraft.block.Block)3 EntityDiggingFX (net.minecraft.client.particle.EntityDiggingFX)3 TubeColor (com.bluepowermod.api.tube.IPneumaticTube.TubeColor)2 IExplosiveHandler (com.builtbroken.mc.api.explosive.IExplosiveHandler)2 ITexturedExplosiveHandler (com.builtbroken.mc.api.explosive.ITexturedExplosiveHandler)2 IExplosiveContainerItem (com.builtbroken.mc.api.items.explosives.IExplosiveContainerItem)2 ItemStackWrapper (com.builtbroken.mc.prefab.items.ItemStackWrapper)2 ResourceLocation (net.minecraft.util.ResourceLocation)2 FluidStack (net.minecraftforge.fluids.FluidStack)2 DoubleCoordinates (network.rs485.logisticspipes.world.DoubleCoordinates)2