public void renderKamuiBlack() { // Modified copy of RenderItem.renderItem(stack, transformtype) Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); Minecraft.getMinecraft().renderEngine.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false); IBakedModel model = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(renderStack); GlStateManager.enableRescaleNormal(); GlStateManager.alphaFunc(516, 0.1F); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.pushMatrix(); model = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(model, ItemCameraTransforms.TransformType.NONE, false); renderModel(model, renderStack, 0xFF00004C); GlStateManager.cullFace(GlStateManager.CullFace.BACK); GlStateManager.popMatrix(); GlStateManager.disableRescaleNormal(); GlStateManager.disableBlend(); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); Minecraft.getMinecraft().renderEngine.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap(); }
public TextureImageRenderer(final ResourceLocation location) { this.location = location; final TextureManager manager = Minecraft.getMinecraft().getTextureManager(); final ITextureObject image = manager.getTexture(location); if (image instanceof ImageTexture) { this.texture = (ImageTexture) image; } else { if (image != null && image.getGlTextureId() != -1) { TextureUtil.deleteTexture(image.getGlTextureId()); } this.texture = new ImageTexture(location); manager.loadTexture(location, texture); } }
private void startBreaking(TileEntityRendererDispatcher rendererDispatcher) { GlStateManager.pushMatrix(); GlStateManager.tryBlendFuncSeparate(774, 768, 1, 0); GlStateManager.enableBlend(); GlStateManager.color(1.0F, 1.0F, 1.0F, 0.5F); GlStateManager.doPolygonOffset(-3.0F, -3.0F); GlStateManager.enablePolygonOffset(); GlStateManager.alphaFunc(516, 0.1F); GlStateManager.enableAlpha(); Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false); }
private void finishBreaking() { Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap(); GlStateManager.disableAlpha(); GlStateManager.doPolygonOffset(0.0F, 0.0F); GlStateManager.disablePolygonOffset(); GlStateManager.enableAlpha(); GlStateManager.depthMask(true); GlStateManager.popMatrix(); }
private void doWorldRenderPass(Multiblock mb, Iterable<? extends BlockPos> blocks, final @Nonnull BlockRenderLayer layer, Vector4f eye) { mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false); ForgeHooksClient.setRenderLayer(layer); setGlStateForPass(layer); BufferBuilder wr = Tessellator.getInstance().getBuffer(); wr.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); for (BlockPos pos : blocks) { IBlockState bs = mb.getBlockState(pos); Block block = bs.getBlock(); bs = bs.getActualState(mb, pos); if (block.canRenderInLayer(bs, layer)) { renderBlock(bs, pos, mb, Tessellator.getInstance().getBuffer()); } } if (layer == BlockRenderLayer.TRANSLUCENT) { wr.sortVertexData(eye.x, eye.y, eye.z); } Tessellator.getInstance().draw(); }
private static void finishBreaking() { GlStateManager.disableAlpha(); GlStateManager.doPolygonOffset(0.0F, 0.0F); GlStateManager.disablePolygonOffset(); GlStateManager.enableAlpha(); GlStateManager.depthMask(true); GlStateManager.popMatrix(); Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap(); }
@SideOnly(Side.CLIENT) public static void renderItemWithoutScrewingWithColors(ItemStack stack){ if(StackUtil.isValid(stack)){ Minecraft mc = Minecraft.getMinecraft(); RenderItem renderer = mc.getRenderItem(); TextureManager manager = mc.getTextureManager(); IBakedModel model = renderer.getItemModelWithOverrides(stack, null, null); manager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); manager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false); GlStateManager.enableRescaleNormal(); GlStateManager.enableBlend(); GlStateManager.pushMatrix(); model = ForgeHooksClient.handleCameraTransforms(model, TransformType.FIXED, false); renderer.renderItem(stack, model); GlStateManager.cullFace(GlStateManager.CullFace.BACK); GlStateManager.popMatrix(); GlStateManager.disableRescaleNormal(); GlStateManager.disableBlend(); manager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); manager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap(); } }
private static void startBreaking() { // For some reason I still don't understand, this works. Don't question it. Blame vanilla. GlStateManager.disableLighting(); Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.DST_COLOR, GlStateManager.DestFactor.SRC_COLOR, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.color(1.0F, 1.0F, 1.0F, 0.5F); GlStateManager.doPolygonOffset(-3.0F, -3.0F); GlStateManager.enablePolygonOffset(); GlStateManager.alphaFunc(516, 0.1F); GlStateManager.enableAlpha(); GlStateManager.pushMatrix(); }
private void renderElements(Multiblock mb, Iterable<? extends BlockPos> blocks, Vector4f eye) { GlStateManager.pushMatrix(); GlStateManager.color(1F, 1F, 1F, 1F); GlStateManager.translate(0, 0, -1); TileEntityRendererDispatcher.instance.entityX = eye.x; TileEntityRendererDispatcher.instance.entityY = eye.y; TileEntityRendererDispatcher.instance.entityZ = eye.z; TileEntityRendererDispatcher.staticPlayerX = eye.x; TileEntityRendererDispatcher.staticPlayerY = eye.y; TileEntityRendererDispatcher.staticPlayerZ = eye.z; BlockRenderLayer oldRenderLayer = MinecraftForgeClient.getRenderLayer(); for (BlockRenderLayer layer : BlockRenderLayer.values()) { if (layer == BlockRenderLayer.TRANSLUCENT) { doTileEntityRenderPass(mb, blocks, 0); } doWorldRenderPass(mb, blocks, layer, eye); if (layer == BlockRenderLayer.TRANSLUCENT) { doTileEntityRenderPass(mb, blocks, 1); } } ForgeHooksClient.setRenderLayer(oldRenderLayer); ForgeHooksClient.setRenderPass(-1); setGlStateForPass(0); mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap(); GlStateManager.popMatrix(); }
@SideOnly(Side.CLIENT) private static Consumer<Integer> generateCallback(final float percentile, final boolean shatter, final boolean overflowed) { Minecraft mc = Minecraft.getMinecraft(); return (Integer shader) -> { int percentileUniform = ARBShaderObjects.glGetUniformLocationARB(shader, "percentile"); int overflowedUniform = ARBShaderObjects.glGetUniformLocationARB(shader, "overflowed"); int imageUniform = ARBShaderObjects.glGetUniformLocationARB(shader, "image"); int maskUniform = ARBShaderObjects.glGetUniformLocationARB(shader, "mask"); OpenGlHelper.setActiveTexture(ARBMultitexture.GL_TEXTURE0_ARB); GL11.glBindTexture(GL11.GL_TEXTURE_2D, mc.renderEngine.getTexture(psiBar).getGlTextureId()); ARBShaderObjects.glUniform1iARB(imageUniform, 0); OpenGlHelper.setActiveTexture(ARBMultitexture.GL_TEXTURE0_ARB + secondaryTextureUnit); GlStateManager.enableTexture2D(); GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D); GL11.glBindTexture(GL11.GL_TEXTURE_2D, mc.renderEngine.getTexture(shatter ? psiBarShatter : psiBarMask).getGlTextureId()); ARBShaderObjects.glUniform1iARB(maskUniform, secondaryTextureUnit); ARBShaderObjects.glUniform1fARB(percentileUniform, percentile); ARBShaderObjects.glUniform1iARB(overflowedUniform, overflowed ? 1 : 0); }; }
@SideOnly(Side.CLIENT) private static void renderItemModelIntoGUI(RenderItem render, ItemStack stack, int x, int y, IBakedModel bakedmodel) { GlStateManager.pushMatrix(); textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); textureManager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false); GlStateManager.enableRescaleNormal(); GlStateManager.enableAlpha(); GlStateManager.alphaFunc(516, 0.1F); GlStateManager.enableBlend(); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); render.setupGuiTransform(x, y, bakedmodel.isGui3d()); bakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(bakedmodel, ItemCameraTransforms.TransformType.GUI, false); renderItem(render, stack, bakedmodel); GlStateManager.disableAlpha(); GlStateManager.disableRescaleNormal(); GlStateManager.disableLighting(); GlStateManager.popMatrix(); textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); textureManager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap(); }
@Override public CachedImage load(Image image) { ITextureObject textureObj = Minecraft.getMinecraft().getTextureManager().getTexture(resource); if(textureObj != null) { return new CachedImage(textureObj.getGlTextureId(), 0, 0, false); } else { AbstractTexture texture = new SimpleTexture(resource); if(Minecraft.getMinecraft().getTextureManager().loadTexture(resource, texture)) { return new CachedImage(texture.getGlTextureId(), 0, 0, false); } return new CachedImage(TextureUtil.MISSING_TEXTURE.getGlTextureId(), 0, 0, false); } } }
public void draw(BuildingVertexUploader vertexUploader) { GlStateManager.disableAlpha(); vertexUploader.draw(renderer.getWorldRendererByLayer(BlockRenderLayer.SOLID)); GlStateManager.enableAlpha(); vertexUploader.draw(renderer.getWorldRendererByLayer(BlockRenderLayer.CUTOUT_MIPPED)); Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false); vertexUploader.draw(renderer.getWorldRendererByLayer(BlockRenderLayer.CUTOUT)); Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap(); GlStateManager.disableBlend(); GlStateManager.enableCull(); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.alphaFunc(516, 0.1F); GlStateManager.enableBlend(); GlStateManager.depthMask(false); Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); GlStateManager.shadeModel(7425); vertexUploader.draw(renderer.getWorldRendererByLayer(BlockRenderLayer.TRANSLUCENT)); GlStateManager.disableBlend(); GlStateManager.depthMask(true); }
mc.renderEngine.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false); GlStateManager.enableRescaleNormal(); GlStateManager.enableAlpha(); GlStateManager.popMatrix(); mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); mc.renderEngine.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap();
textureManager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false); GlStateManager.enableRescaleNormal(); GlStateManager.enableAlpha(); textureManager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap();
this.renderManager.renderEngine.getTexture(this.getEntityTexture(entity)).setBlurMipmap(false, false); flag = true; this.renderManager.renderEngine.getTexture(this.getEntityTexture(entity)).restoreLastBlurMipmap();
Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false); GlStateManager.enableRescaleNormal(); GlStateManager.enableAlpha(); Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap(); GlStateManager.disableRescaleNormal(); RenderHelper.disableStandardItemLighting();
textureManager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false); textureManager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap();
GlStateManager.pushMatrix(); mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false); GlStateManager.enableRescaleNormal(); GlStateManager.enableAlpha(); GlStateManager.popMatrix(); mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap();
TextureManager textureManager = Minecraft.getMinecraft().getTextureManager(); textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); textureManager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false); GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); textureManager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap();