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();
}
}
}
}
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);
}
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);
}
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();
}
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;
}
Aggregations