Search in sources :

Example 11 with TextureManager

use of net.minecraft.client.renderer.texture.TextureManager in project SecurityCraft by Geforce132.

the class ItemCameraMonitorRenderer method renderItem.

public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    if (type == ItemRenderType.FIRST_PERSON_MAP) {
        //Draw the base monitor texture.
        ((TextureManager) data[1]).bindTexture(new ResourceLocation("securitycraft:textures/gui/camera/cameraBackground.png"));
        Tessellator tessellator = Tessellator.instance;
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(0 - 7, 128 + 7, 0.0D, 0.0D, 1.0D);
        tessellator.addVertexWithUV(128 + 7, 128 + 7, 0.0D, 1.0D, 1.0D);
        tessellator.addVertexWithUV(128 + 7, 0 - 7, 0.0D, 1.0D, 0.0D);
        tessellator.addVertexWithUV(0 - 7, 0 - 7, 0.0D, 0.0D, 0.0D);
        tessellator.draw();
        if (item != null && item.getItem() instanceof ItemCameraMonitor && ((ItemCameraMonitor) item.getItem()).hasCameraAdded(item.getTagCompound())) {
            CameraView view = ((ItemCameraMonitor) item.getItem()).getCameraView(item.getTagCompound());
            if (mod_SecurityCraft.instance.hasViewForCoords(view.toNBTString())) {
                IWorldView worldView = mod_SecurityCraft.instance.getViewFromCoords(view.toNBTString()).getView();
                if (worldView.isReady() && worldView.getTexture() != 0) {
                    //Bind the IWorldView texture then draw it.
                    GL11.glDisable(3008);
                    GL11.glDisable(2896);
                    GL11.glBindTexture(GL11.GL_TEXTURE_2D, worldView.getTexture());
                    tessellator.startDrawingQuads();
                    tessellator.addVertexWithUV(128 + 7, 0 - 7, 0.0D, 0.0D, 1.0D);
                    tessellator.addVertexWithUV(0 - 7, 0 - 7, 0.0D, -1.0D, 1.0D);
                    tessellator.addVertexWithUV(0 - 7, 128 + 7, 0.0D, -1.0D, 0.0D);
                    tessellator.addVertexWithUV(128 + 7, 128 + 7, 0.0D, 0.0D, 0.0D);
                    tessellator.draw();
                    GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
                    GL11.glEnable(3008);
                    GL11.glEnable(2896);
                //
                }
                //Update the camera.
                worldView.markDirty();
            }
        }
    }
}
Also used : TextureManager(net.minecraft.client.renderer.texture.TextureManager) Tessellator(net.minecraft.client.renderer.Tessellator) ItemCameraMonitor(net.geforcemods.securitycraft.items.ItemCameraMonitor) ResourceLocation(net.minecraft.util.ResourceLocation) CameraView(net.geforcemods.securitycraft.misc.CameraView) IWorldView(com.xcompwiz.lookingglass.api.view.IWorldView)

Example 12 with TextureManager

use of net.minecraft.client.renderer.texture.TextureManager in project BetterStorage by copygirl.

the class RenderFrienderman method shouldRenderPass.

@Override
protected int shouldRenderPass(EntityEnderman entity, int slot, float partialTicks) {
    if (slot == 0) {
        setRenderPassModel(mainModel);
        return super.shouldRenderPass(entity, slot, partialTicks);
    } else if (slot != 1)
        return -1;
    ItemStack stack = entity.getEquipmentInSlot(EquipmentSlot.CHEST);
    if (stack == null)
        return -1;
    Item item = stack.getItem();
    if (!(item instanceof ItemArmor))
        return -1;
    ItemArmor itemarmor = (ItemArmor) item;
    TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
    textureManager.bindTexture(RenderBiped.getArmorResource(entity, stack, slot, null));
    ModelBiped modelBiped = ForgeHooksClient.getArmorModel(entity, stack, slot, null);
    setRenderPassModel(modelBiped);
    if (modelBiped != null) {
        modelBiped.onGround = mainModel.onGround;
        modelBiped.isRiding = mainModel.isRiding;
        modelBiped.isChild = mainModel.isChild;
    }
    int color = itemarmor.getColor(stack);
    if (color != -1) {
        RenderUtils.setColorFromInt(color);
        if (stack.isItemEnchanted())
            return 31;
        return 16;
    }
    GL11.glColor3f(1.0F, 1.0F, 1.0F);
    return (stack.isItemEnchanted() ? 15 : 1);
}
Also used : Item(net.minecraft.item.Item) TextureManager(net.minecraft.client.renderer.texture.TextureManager) ModelBiped(net.minecraft.client.model.ModelBiped) ItemArmor(net.minecraft.item.ItemArmor) ItemStack(net.minecraft.item.ItemStack)

Example 13 with TextureManager

use of net.minecraft.client.renderer.texture.TextureManager in project MinecraftForge by MinecraftForge.

the class GuiModList method updateCache.

private void updateCache() {
    configModButton.visible = false;
    disableModButton.visible = false;
    modInfo = null;
    if (selectedMod == null)
        return;
    ResourceLocation logoPath = null;
    Dimension logoDims = new Dimension(0, 0);
    List<String> lines = new ArrayList<String>();
    CheckResult vercheck = ForgeVersion.getResult(selectedMod);
    String logoFile = selectedMod.getMetadata().logoFile;
    if (!logoFile.isEmpty()) {
        TextureManager tm = mc.getTextureManager();
        IResourcePack pack = FMLClientHandler.instance().getResourcePackFor(selectedMod.getModId());
        try {
            BufferedImage logo = null;
            if (pack != null) {
                logo = pack.getPackImage();
            } else {
                InputStream logoResource = getClass().getResourceAsStream(logoFile);
                if (logoResource != null)
                    logo = ImageIO.read(logoResource);
            }
            if (logo != null) {
                logoPath = tm.getDynamicTextureLocation("modlogo", new DynamicTexture(logo));
                logoDims = new Dimension(logo.getWidth(), logo.getHeight());
            }
        } catch (IOException e) {
        }
    }
    if (!selectedMod.getMetadata().autogenerated) {
        disableModButton.visible = true;
        disableModButton.enabled = true;
        disableModButton.packedFGColour = 0;
        Disableable disableable = selectedMod.canBeDisabled();
        if (disableable == Disableable.RESTART) {
            disableModButton.packedFGColour = 0xFF3377;
        } else if (disableable != Disableable.YES) {
            disableModButton.enabled = false;
        }
        IModGuiFactory guiFactory = FMLClientHandler.instance().getGuiFactoryFor(selectedMod);
        configModButton.visible = true;
        configModButton.enabled = guiFactory != null && guiFactory.mainConfigGuiClass() != null;
        lines.add(selectedMod.getMetadata().name);
        lines.add(String.format("Version: %s (%s)", selectedMod.getDisplayVersion(), selectedMod.getVersion()));
        lines.add(String.format("Mod ID: '%s' Mod State: %s", selectedMod.getModId(), Loader.instance().getModState(selectedMod)));
        if (!selectedMod.getMetadata().credits.isEmpty()) {
            lines.add("Credits: " + selectedMod.getMetadata().credits);
        }
        lines.add("Authors: " + selectedMod.getMetadata().getAuthorList());
        lines.add("URL: " + selectedMod.getMetadata().url);
        if (selectedMod.getMetadata().childMods.isEmpty())
            lines.add("No child mods for this mod");
        else
            lines.add("Child mods: " + selectedMod.getMetadata().getChildModList());
        if (vercheck.status == Status.OUTDATED || vercheck.status == Status.BETA_OUTDATED)
            lines.add("Update Available: " + (vercheck.url == null ? "" : vercheck.url));
        lines.add(null);
        lines.add(selectedMod.getMetadata().description);
    } else {
        lines.add(WHITE + selectedMod.getName());
        lines.add(WHITE + "Version: " + selectedMod.getVersion());
        lines.add(WHITE + "Mod State: " + Loader.instance().getModState(selectedMod));
        if (vercheck.status == Status.OUTDATED || vercheck.status == Status.BETA_OUTDATED)
            lines.add("Update Available: " + (vercheck.url == null ? "" : vercheck.url));
        lines.add(null);
        lines.add(RED + "No mod information found");
        lines.add(RED + "Ask your mod author to provide a mod mcmod.info file");
    }
    if ((vercheck.status == Status.OUTDATED || vercheck.status == Status.BETA_OUTDATED) && vercheck.changes.size() > 0) {
        lines.add(null);
        lines.add("Changes:");
        for (Entry<ComparableVersion, String> entry : vercheck.changes.entrySet()) {
            lines.add("  " + entry.getKey() + ":");
            lines.add(entry.getValue());
            lines.add(null);
        }
    }
    modInfo = new Info(this.width - this.listWidth - 30, lines, logoPath, logoDims);
}
Also used : InputStream(java.io.InputStream) ArrayList(java.util.ArrayList) DynamicTexture(net.minecraft.client.renderer.texture.DynamicTexture) Dimension(java.awt.Dimension) TextComponentString(net.minecraft.util.text.TextComponentString) IOException(java.io.IOException) ComparableVersion(net.minecraftforge.fml.common.versioning.ComparableVersion) IResourcePack(net.minecraft.client.resources.IResourcePack) BufferedImage(java.awt.image.BufferedImage) TextureManager(net.minecraft.client.renderer.texture.TextureManager) ResourceLocation(net.minecraft.util.ResourceLocation) CheckResult(net.minecraftforge.common.ForgeVersion.CheckResult) Disableable(net.minecraftforge.fml.common.ModContainer.Disableable)

Example 14 with TextureManager

use of net.minecraft.client.renderer.texture.TextureManager in project RFToolsDimensions by McJty.

the class SkyRenderer method renderEnderSky.

@SideOnly(Side.CLIENT)
private static void renderEnderSky() {
    TextureManager renderEngine = Minecraft.getMinecraft().getTextureManager();
    GlStateManager.disableFog();
    GlStateManager.disableAlpha();
    GlStateManager.enableBlend();
    GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
    RenderHelper.disableStandardItemLighting();
    GlStateManager.depthMask(false);
    renderEngine.bindTexture(locationEndSkyPng);
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer renderer = tessellator.getBuffer();
    for (int i = 0; i < 6; ++i) {
        GlStateManager.pushMatrix();
        if (i == 1) {
            GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
        }
        if (i == 2) {
            GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F);
        }
        if (i == 3) {
            GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F);
        }
        if (i == 4) {
            GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
        }
        if (i == 5) {
            GlStateManager.rotate(-90.0F, 0.0F, 0.0F, 1.0F);
        }
        renderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
        // @todo: decode 2631720 into rgb
        int cc = 255;
        renderer.pos(-100.0D, -100.0D, -100.0D).tex(0, 0).color(cc, cc, cc, 255).endVertex();
        renderer.pos(-100.0D, -100.0D, 100.0D).tex(0, 16).color(cc, cc, cc, 255).endVertex();
        renderer.pos(100.0D, -100.0D, 100.0D).tex(16, 16).color(cc, cc, cc, 255).endVertex();
        renderer.pos(100.0D, -100.0D, -100.0D).tex(16, 0).color(cc, cc, cc, 255).endVertex();
        tessellator.draw();
        GlStateManager.popMatrix();
    }
    GlStateManager.depthMask(true);
    GlStateManager.enableTexture2D();
    GlStateManager.enableAlpha();
}
Also used : TextureManager(net.minecraft.client.renderer.texture.TextureManager) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 15 with TextureManager

use of net.minecraft.client.renderer.texture.TextureManager in project ArsMagica2 by Mithion.

the class ShadowSkinHelper method getDownloadImage.

private static ThreadDownloadImageData getDownloadImage(ResourceLocation par0ResourceLocation, String par1Str, ResourceLocation par2ResourceLocation, IImageBuffer par3IImageBuffer) {
    TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
    Object object = texturemanager.getTexture(par0ResourceLocation);
    if (object == null) {
        object = new ThreadDownloadImageData((File) null, par1Str, par2ResourceLocation, par3IImageBuffer);
        texturemanager.loadTexture(par0ResourceLocation, (ITextureObject) object);
    }
    return (ThreadDownloadImageData) object;
}
Also used : TextureManager(net.minecraft.client.renderer.texture.TextureManager) ITextureObject(net.minecraft.client.renderer.texture.ITextureObject) File(java.io.File) ThreadDownloadImageData(net.minecraft.client.renderer.ThreadDownloadImageData)

Aggregations

TextureManager (net.minecraft.client.renderer.texture.TextureManager)19 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)4 ThreadDownloadImageData (net.minecraft.client.renderer.ThreadDownloadImageData)3 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)3 Minecraft (net.minecraft.client.Minecraft)2 Tessellator (net.minecraft.client.renderer.Tessellator)2 ITextureObject (net.minecraft.client.renderer.texture.ITextureObject)2 Item (net.minecraft.item.Item)2 ResourceLocation (net.minecraft.util.ResourceLocation)2 Vec3d (net.minecraft.util.math.Vec3d)2 Fluid (net.minecraftforge.fluids.Fluid)2 IWorldView (com.xcompwiz.lookingglass.api.view.IWorldView)1 Dimension (java.awt.Dimension)1 BufferedImage (java.awt.image.BufferedImage)1 File (java.io.File)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1 ItemCameraMonitor (net.geforcemods.securitycraft.items.ItemCameraMonitor)1 CameraView (net.geforcemods.securitycraft.misc.CameraView)1