Java Code Examples for codechicken.lib.render.CCRenderState#changeTexture()

The following examples show how to use codechicken.lib.render.CCRenderState#changeTexture() . 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: GuiEnderItemStorage.java    From EnderStorage with MIT License 6 votes vote down vote up
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
{
    GL11.glColor4f(1, 1, 1, 1);
    CCRenderState.changeTexture(chestInv.getSize() == 0 ? "textures/gui/container/dispenser.png" : "textures/gui/container/generic_54.png");
    int x = (width - xSize) / 2;
    int y = (height - ySize) / 2;
    
    switch(chestInv.getSize())
    {
        case 0:
        case 2:
            drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
            break;
        case 1:
            drawTexturedModalRect(x, y, 0, 0, xSize, 71);
            drawTexturedModalRect(x, y+71, 0, 126, xSize, 96);
            break;
            
    }
}
 
Example 2
Source File: RenderTracker.java    From WirelessRedstone with MIT License 6 votes vote down vote up
public void renderTracker(int freq)
{
    GL11.glDisable(GL11.GL_LIGHTING);

    TextureUtils.bindAtlas(0);
    CCRenderState.reset();
    CCRenderState.startDrawing(7);
    CCRenderState.setColour(0xFFFFFFFF);
    model.render(new IconTransformation(Blocks.obsidian.getIcon(0, 0)));
    CCRenderState.draw();
    
    Matrix4 pearlMat = CCModelLibrary.getRenderMatrix(
        new Vector3(0, 0.44+RedstoneEther.getSineWave(ClientUtils.getRenderTime(), 7)*0.02, 0),
        new Rotation(RedstoneEther.getRotation(ClientUtils.getRenderTime(), freq), new Vector3(0, 1, 0)),
        0.04);

    CCRenderState.changeTexture("wrcbe_core:textures/hedronmap.png");
    CCRenderState.startDrawing(4);
    CCRenderState.setColour(freq == 0 ? 0xC0C0C0FF : 0xFFFFFFFF);
    CCModelLibrary.icosahedron4.render(pearlMat);
    CCRenderState.draw();
    
    GL11.glEnable(GL11.GL_LIGHTING);
}
 
Example 3
Source File: ItemTranslocatorRenderer.java    From Translocators with MIT License 6 votes vote down vote up
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    Vector3 d = new Vector3();
    if (type != ItemRenderType.EQUIPPED && type != ItemRenderType.EQUIPPED_FIRST_PERSON)
        d.add(-0.5, -0.5, -0.5);
    else
        d.add(0, -0.2, -0.2);
    d.add(0, 0, 0.5);

    GL11.glPushMatrix();
    GL11.glScaled(1.5, 1.5, 1.5);

    CCRenderState.changeTexture("translocator:textures/tex.png");
    CCRenderState.pullLightmap();
    CCRenderState.setColour(-1);
    CCRenderState.useNormals = true;
    CCRenderState.startDrawing(4);
    TileTranslocatorRenderer.renderAttachment(2, item.getItemDamage(), 1, 0, d.x, d.y, d.z);
    CCRenderState.draw();

    GL11.glPopMatrix();
}
 
Example 4
Source File: GuiRecipe.java    From NotEnoughItems with MIT License 6 votes vote down vote up
@Override
protected void drawGuiContainerBackgroundLayer(float f, int mx, int my) {
    GlStateManager.color(1, 1, 1, 1);
    CCRenderState.changeTexture("nei:textures/gui/recipebg.png");
    int j = (width - xSize) / 2;
    int k = (height - ySize) / 2;
    drawTexturedModalRect(j, k, 0, 0, xSize, ySize);

    GlStateManager.pushMatrix();
    GlStateManager.translate(j + 5, k + 16, 0);
    IRecipeHandler recipehandler = currenthandlers.get(recipetype);
    for (int i = page * recipehandler.recipiesPerPage(); i < recipehandler.numRecipes() && i < (page + 1) * recipehandler.recipiesPerPage(); i++) {
        recipehandler.drawBackground(i);
        GlStateManager.translate(0, 65, 0);
    }
    GlStateManager.popMatrix();
}
 
Example 5
Source File: EnderChestRenderer.java    From EnderStorage with MIT License 5 votes vote down vote up
private static void renderButtons(int freq, int rot, double lidAngle) {
    CCRenderState.changeTexture("enderstorage:textures/buttons.png");

    drawButton(0, EnderStorageManager.getColourFromFreq(freq, 0), rot, lidAngle);
    drawButton(1, EnderStorageManager.getColourFromFreq(freq, 1), rot, lidAngle);
    drawButton(2, EnderStorageManager.getColourFromFreq(freq, 2), rot, lidAngle);
}
 
Example 6
Source File: GuiRedstoneWireless.java    From WirelessRedstone with MIT License 5 votes vote down vote up
@Override
public void drawBackground() {
    if (largeGui)
        CCRenderState.changeTexture("wrcbe_core:textures/gui/wirelessLarge.png");
    else
        CCRenderState.changeTexture("wrcbe_core:textures/gui/wirelessSmall.png");
    GL11.glColor4f(1, 1, 1, 1);
    drawTexturedModalRect(0, 0, 0, 0, xSize, ySize);
}
 
Example 7
Source File: GuiButtonArrow.java    From WirelessRedstone with MIT License 5 votes vote down vote up
private void drawArrow(int x, int y, int colour)
{
    CCRenderState.changeTexture("wrcbe_core:textures/gui/arrow.png");
    
    new ColourARGB(colour).glColour();
    Tessellator t = Tessellator.instance;
    t.startDrawingQuads();
    t.addVertexWithUV(x + 0, y + 8, zLevel, arrowdirection * 0.25, 1);
    t.addVertexWithUV(x + 8, y + 8, zLevel, (arrowdirection + 1) * 0.25, 1);
    t.addVertexWithUV(x + 8, y + 0, zLevel, (arrowdirection + 1) * 0.25, 0);
    t.addVertexWithUV(x + 0, y + 0, zLevel, arrowdirection * 0.25, 0);
    t.draw();
}
 
Example 8
Source File: GuiTranslocator.java    From Translocators with MIT License 5 votes vote down vote up
@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    GL11.glPushMatrix();
    GL11.glTranslated(guiLeft, guiTop, 0);
    GL11.glColor4f(1, 1, 1, 1);

    CCRenderState.changeTexture("textures/gui/container/dispenser.png");
    drawTexturedModalRect(0, 0, 0, 0, xSize, ySize);

    fontRendererObj.drawString(StatCollector.translateToLocal(((ContainerItemTranslocator) inventorySlots).getInvName()), 6, 6, 0x404040);
    fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 6, 72, 0x404040);
    GL11.glPopMatrix();
}
 
Example 9
Source File: PatreonButton.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@Override
public void drawButtonTex(int mousex, int mousey) {
    super.drawButtonTex(mousex, mousey);

    GlStateManager.color(1, 1, 1, 1);
    CCRenderState.changeTexture("nei:textures/patreonNeon.png");
    int texh = height-4;
    int texw = texh*4;
    drawModalRectWithCustomSizedTexture(x+width/2-texw/2, y+height/2-texh/2, 0, 0, texw, texh, texw, texh);
}
 
Example 10
Source File: GuiEnchantmentModifier.java    From NotEnoughItems with MIT License 5 votes vote down vote up
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    GlStateManager.color(1, 1, 1, 1);
    CCRenderState.changeTexture("textures/gui/container/enchanting_table.png");
    GlStateManager.translate(guiLeft, guiTop, 0);
    drawTexturedModalRect(0, 0, 0, 0, xSize, ySize);

    container.onUpdate(i, j);
    container.drawSlots(this);
    container.drawScrollBar(this);

    String levelstring = "" + container.level;
    fontRendererObj.drawString(levelstring, 33 - fontRendererObj.getStringWidth(levelstring) / 2, 34, 0xFF606060);

    GlStateManager.translate(-guiLeft, -guiTop, 0);
}
 
Example 11
Source File: GuiExtendedCreativeInv.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@Override
protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) {
    GlStateManager.color(1, 1, 1, 1);
    CCRenderState.changeTexture("nei:textures/gui/inv.png");

    int x = guiLeft;
    int y = guiTop - 4;

    drawTexturedModalRect(x - 23, y, 0, 0, 199, 204);
}
 
Example 12
Source File: ContainerEnchantmentModifier.java    From NotEnoughItems with MIT License 5 votes vote down vote up
public void drawSlots(GuiEnchantmentModifier gui) {
    for (int slot = 0; slot < 3; slot++) {
        int shade = 0;
        String text = "";

        int containerslot = slot + getScrolledSlots();
        if (containerslot + 1 > slotEnchantment.size()) {
            shade = 1;
        } else {
            EnchantmentHash e = slotEnchantment.get(containerslot);
            shade = e.state;
            text = e.enchantment.getTranslatedName(e.level == -1 ? level : e.level);
            if (gui.mc.fontRendererObj.getStringWidth(text) > 95 && text.contains("Projectile")) {
                text = text.replace("Projectile", "Proj");
            }
            if (gui.mc.fontRendererObj.getStringWidth(text) > 95 && text.contains("Protection")) {
                text = text.replace("Protection", "Protect");
            }
            if (gui.mc.fontRendererObj.getStringWidth(text) > 95 && text.contains("Bane of")) {
                text = text.replace("Bane of ", "");
            }
        }

        CCRenderState.changeTexture("textures/gui/container/enchanting_table.png");
        GlStateManager.color(1, 1, 1);
        if (hasScrollBar()) {
            gui.drawTexturedModalRect(relx, rely + slot * slotheight, 0, gui.ySize + slotheight * shade, cwidth - 30, slotheight);
            gui.drawTexturedModalRect(relx + cwidth - 30, rely + slot * slotheight, cwidth - 23, gui.ySize + slotheight * shade, 30, slotheight);
        } else {
            gui.drawTexturedModalRect(relx, rely + slot * slotheight, 0, gui.ySize + slotheight * shade, cwidth + 7, slotheight);
        }

        gui.getFontRenderer().drawString(text, relx + 4, rely + slot * slotheight + 5, textColourFromState(shade));
    }
}
 
Example 13
Source File: GuiPotionCreator.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@Override
public void drawBackground() {
    CCRenderState.changeTexture("nei:textures/gui/potion.png");
    drawTexturedModalRect(0, 0, 0, 0, xSize, ySize);

    FontUtils.drawCenteredString("Favourite Potions", xSize / 2, 4, 0x404040);
    fontRendererObj.drawString("Duration", 12, 40, 0x404040);
    fontRendererObj.drawString("Level", 19, 73, 0x404040);
    FontUtils.drawCenteredString(translateAmplifier(amplifier), 33, 86, 0xFF606060);
}
 
Example 14
Source File: GuiChunkLoader.java    From ChickenChunks with MIT License 5 votes vote down vote up
private void drawContainerBackground() {
    GL11.glColor4f(1, 1, 1, 1);
    CCRenderState.changeTexture("chickenchunks:textures/gui/guiSmall.png");
    int posx = width / 2 - 88;
    int posy = height / 2 - 83;
    drawTexturedModalRect(posx, posy, 0, 0, 176, 166);
}
 
Example 15
Source File: EnderChestRenderer.java    From EnderStorage with MIT License 5 votes vote down vote up
public static void renderChest(int rotation, int freq, boolean owned, double x, double y, double z, int offset, float lidAngle) {
    TileEntityRendererDispatcher info = TileEntityRendererDispatcher.instance;
    renderEndPortal.render(x, y, z, 0, info.field_147560_j, info.field_147560_j, info.field_147561_k, info.field_147553_e);
    GL11.glColor4f(1, 1, 1, 1);

    CCRenderState.changeTexture("enderstorage:textures/enderchest.png");
    GL11.glPushMatrix();
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glColor4f(1, 1, 1, 1);
    GL11.glTranslated(x, y + 1.0, z + 1.0F);
    GL11.glScalef(1.0F, -1F, -1F);
    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
    GL11.glRotatef(rotation * 90, 0.0F, 1.0F, 0.0F);
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    model.chestLid.rotateAngleX = lidAngle;
    model.render(owned);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(x, y, z);
    renderButtons(freq, rotation, lidAngle);
    GL11.glPopMatrix();

    double time = ClientUtils.getRenderTime() + offset;
    Matrix4 pearlMat = CCModelLibrary.getRenderMatrix(
            new Vector3(x + 0.5, y + 0.2 + lidAngle * -0.5 + EnderStorageClientProxy.getPearlBob(time), z + 0.5),
            new Rotation(time / 3, new Vector3(0, 1, 0)),
            0.04);

    GL11.glDisable(GL11.GL_LIGHTING);
    CCRenderState.changeTexture("enderstorage:textures/hedronmap.png");
    CCRenderState.startDrawing(4);
    CCModelLibrary.icosahedron4.render(pearlMat);
    CCRenderState.draw();
    GL11.glEnable(GL11.GL_LIGHTING);
}
 
Example 16
Source File: TileChunkLoaderRenderer.java    From ChickenChunks with MIT License 4 votes vote down vote up
@Override
public void renderTileEntityAt(TileEntity tile, double d, double d1, double d2, float f)
{
    CCRenderState.reset();
    CCRenderState.setBrightness(tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord);
    
    double rot = ClientUtils.getRenderTime()*2;
    double height;
    double size;
    double updown = (ClientUtils.getRenderTime()%50) / 25F;
    
    updown = (float) Math.sin(updown*3.141593);
    updown *= 0.2;
    
    TileChunkLoaderBase chunkLoader = (TileChunkLoaderBase)tile;
    if(chunkLoader instanceof TileChunkLoader)
    {
        TileChunkLoader ctile = (TileChunkLoader)chunkLoader;
        rot /= Math.pow(ctile.radius, 0.2);
        height = 0.9;
        size = 0.08;
    }
    else if(chunkLoader instanceof TileSpotLoader)
    {
        height = 0.5;
        size = 0.05;
    }
    else
        return;
    
    RenderInfo renderInfo = chunkLoader.renderInfo;
    double active = (renderInfo.activationCounter)/20D;
    if(chunkLoader.active && renderInfo.activationCounter < 20)
        active += f/20D;
    else if(!chunkLoader.active && renderInfo.activationCounter > 0)
        active -= f/20D;
    
    if(renderInfo.showLasers)
    {            
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_FOG);
        drawRays(d, d1, d2, rot, updown, tile.xCoord, tile.yCoord, tile.zCoord, chunkLoader.getChunks());
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_FOG);
    }
    rot = ClientUtils.getRenderTime()*active / 3F;

    Matrix4 pearlMat = CCModelLibrary.getRenderMatrix(
        new Vector3(d+0.5, d1+height+(updown + 0.3)*active, d2+0.5),
        new Rotation(rot, new Vector3(0, 1, 0)),
        size);
    
    GL11.glDisable(GL11.GL_LIGHTING);
    CCRenderState.changeTexture("chickenchunks:textures/hedronmap.png");
    CCRenderState.startDrawing(4);
    CCModelLibrary.icosahedron4.render(pearlMat);
    CCRenderState.draw();
    GL11.glEnable(GL11.GL_LIGHTING);
}
 
Example 17
Source File: EnderTankRenderer.java    From EnderStorage with MIT License 4 votes vote down vote up
public static void renderTank(int rotation, float valve, int freq, boolean owned, double x, double y, double z, int offset)
{
    TileEntityRendererDispatcher info = TileEntityRendererDispatcher.instance;
    renderEndPortal.render(x, y, z, 0, info.field_147560_j, info.field_147560_j, info.field_147561_k, info.field_147553_e);
    GL11.glColor4f(1, 1, 1, 1);
    
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glPushMatrix();
        GL11.glTranslated(x+0.5, y, z+0.5);
        GL11.glRotatef(-90*(rotation+2), 0, 1, 0);
        
        CCRenderState.changeTexture("enderstorage:textures/endertank.png");
        CCRenderState.startDrawing(4);
        tankModel.render();
        CCRenderState.draw();

        CCRenderState.changeTexture("enderstorage:textures/buttons.png");
        CCRenderState.startDrawing(7);
        for(int i = 0; i < 3; i++)
        {
            int colour = EnderStorageManager.getColourFromFreq(freq, i);
            buttons[i].render(new UVTranslation(0.25 * (colour % 4), 0.25 * (colour / 4)));
        }
        CCRenderState.draw();
        
        new Rotation(valve, new Vector3(0, 0, 1)).at(new Vector3(0, 0.4165, 0)).glApply();

        CCRenderState.changeTexture("enderstorage:textures/endertank.png");
        CCRenderState.startDrawing(4);
        valveModel.render(new UVTranslation(0, owned ? 13/64D : 0));
        CCRenderState.draw();
    GL11.glPopMatrix();
        
    double time = ClientUtils.getRenderTime()+offset;
    Matrix4 pearlMat = CCModelLibrary.getRenderMatrix(
        new Vector3(x+0.5, y+0.45+EnderStorageClientProxy.getPearlBob(time)*2, z+0.5),
        new Rotation(time/3, new Vector3(0, 1, 0)),
        0.04);
    
    GL11.glDisable(GL11.GL_LIGHTING);
    CCRenderState.changeTexture("enderstorage:textures/hedronmap.png");
    CCRenderState.startDrawing(4);
    CCModelLibrary.icosahedron4.render(pearlMat);
    CCRenderState.draw();
    GL11.glEnable(GL11.GL_LIGHTING);
}
 
Example 18
Source File: GuiDraw.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static void changeTexture(String s) {
    CCRenderState.changeTexture(s);
}
 
Example 19
Source File: GuiDraw.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static void changeTexture(ResourceLocation r) {
    CCRenderState.changeTexture(r);
}