static void updateTextureMinMagFilter() { TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager(); ITextureObject itextureobject = texturemanager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); if (itextureobject != null) { MultiTexID multitexid = itextureobject.getMultiTexID(); GlStateManager.bindTexture(multitexid.base); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, Shaders.texMinFilValue[Shaders.configTexMinFilB]); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, Shaders.texMagFilValue[Shaders.configTexMagFilB]); GlStateManager.bindTexture(multitexid.norm); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, Shaders.texMinFilValue[Shaders.configTexMinFilN]); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, Shaders.texMagFilValue[Shaders.configTexMagFilN]); GlStateManager.bindTexture(multitexid.spec); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, Shaders.texMinFilValue[Shaders.configTexMinFilS]); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, Shaders.texMagFilValue[Shaders.configTexMagFilS]); GlStateManager.bindTexture(0); } }
private void loadSprites() { final Set<ResourceLocation> set = this.getVariantsTextureLocations(); set.addAll(this.getItemsTextureLocations()); set.remove(TextureMap.LOCATION_MISSING_TEXTURE); ITextureMapPopulator itexturemappopulator = new ITextureMapPopulator() { public void registerSprites(TextureMap textureMapIn) { for (ResourceLocation resourcelocation : set) { TextureAtlasSprite textureatlassprite = textureMapIn.registerSprite(resourcelocation); ModelBakery.this.sprites.put(resourcelocation, textureatlassprite); } } }; this.textureMap.loadSprites(this.resourceManager, itexturemappopulator); this.sprites.put(new ResourceLocation("missingno"), this.textureMap.getMissingSprite()); }
public static void updateModels() { if (itemProperties != null) { for (int i = 0; i < itemProperties.length; ++i) { CustomItemProperties[] acustomitemproperties = itemProperties[i]; if (acustomitemproperties != null) { for (int j = 0; j < acustomitemproperties.length; ++j) { CustomItemProperties customitemproperties = acustomitemproperties[j]; if (customitemproperties != null && customitemproperties.type == 1) { TextureMap texturemap = Minecraft.getMinecraft().getTextureMapBlocks(); customitemproperties.updateModel(texturemap, itemModelGenerator); } } } } } }
@SideOnly(Side.CLIENT) public static void renderItemInWorld(ItemStack stack){ if(!stack.isEmpty()){ 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, ItemCameraTransforms.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(); } }
public static void updateIcons(TextureMap p_updateIcons_0_) { blockProperties = (ConnectedProperties[][])null; tileProperties = (ConnectedProperties[][])null; if (Config.isConnectedTextures()) { IResourcePack[] airesourcepack = Config.getResourcePacks(); for (int i = airesourcepack.length - 1; i >= 0; --i) { IResourcePack iresourcepack = airesourcepack[i]; updateIcons(p_updateIcons_0_, iresourcepack); } updateIcons(p_updateIcons_0_, Config.getDefaultResourcePack()); ResourceLocation resourcelocation = new ResourceLocation("mcpatcher/ctm/default/empty"); emptySprite = p_updateIcons_0_.registerSprite(resourcelocation); spriteQuadMaps = new Map[p_updateIcons_0_.getCountRegisteredSprites() + 1]; } }
@Override public void doRenderLayer(EntityMeeCreeps entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { IBlockState iblockstate = entitylivingbaseIn.getHeldBlockState(); if (iblockstate != null) { BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); GlStateManager.enableRescaleNormal(); GlStateManager.pushMatrix(); GlStateManager.translate(0.0F, 0.6875F, -0.75F); GlStateManager.rotate(20.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(45.0F, 0.0F, 1.0F, 0.0F); GlStateManager.translate(0.25F, 0.1875F, 0.25F); float f = 0.5F; GlStateManager.scale(-0.5F, -0.5F, 0.5F); int i = entitylivingbaseIn.getBrightnessForRender(); int j = i % 65536; int k = i / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j, k); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.endermanRenderer.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); blockrendererdispatcher.renderBlockBrightness(iblockstate, 1.0F); GlStateManager.popMatrix(); GlStateManager.disableRescaleNormal(); } }
public void updateIcons(TextureMap p_updateIcons_1_) { if (this.matchTiles != null) { this.matchTileIcons = registerIcons(this.matchTiles, p_updateIcons_1_); } if (this.connectTiles != null) { this.connectTileIcons = registerIcons(this.connectTiles, p_updateIcons_1_); } if (this.tiles != null) { this.tileIcons = registerIcons(this.tiles, p_updateIcons_1_); } }
@SubscribeEvent public void onPreRenderBlockLayer(RenderBlockLayerEvent.Pre event) { if(!isInternalCall) { if (!event.getRenderLayer().equals(BlockRenderLayer.TRANSLUCENT)) { event.setCanceled(true); } else if (event.getRenderLayer().equals(BlockRenderLayer.TRANSLUCENT)) { isInternalCall = true; Entity renderEntity = MC.getRenderViewEntity(); GlStateManager.disableAlpha(); MC.renderGlobal.renderBlockLayer(BlockRenderLayer.SOLID, event.getPartialTicks(), 0, renderEntity); GlStateManager.enableAlpha(); MC.renderGlobal.renderBlockLayer(BlockRenderLayer.CUTOUT_MIPPED, event.getPartialTicks(), 0, renderEntity); MC.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false); MC.renderGlobal.renderBlockLayer(BlockRenderLayer.CUTOUT, event.getPartialTicks(), 0, renderEntity); MC.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap(); GlStateManager.disableAlpha(); isInternalCall = false; } } }
@Override public void doRenderLayer(EntityEvolvedEnderman entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { IBlockState iblockstate = entitylivingbaseIn.getHeldBlockState(); if (iblockstate != null) { BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); GlStateManager.enableRescaleNormal(); GlStateManager.pushMatrix(); GlStateManager.translate(0.0F, 0.6875F, -0.75F); GlStateManager.rotate(20.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(45.0F, 0.0F, 1.0F, 0.0F); GlStateManager.translate(0.25F, 0.1875F, 0.25F); GlStateManager.scale(-0.5F, -0.5F, 0.5F); int i = entitylivingbaseIn.getBrightnessForRender(); int j = i % 65536; int k = i / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j, k); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); endermanRenderer.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); blockrendererdispatcher.renderBlockBrightness(iblockstate, 1.0F); GlStateManager.popMatrix(); GlStateManager.disableRescaleNormal(); } }
private void loadSprites() { final Set<ResourceLocation> set = this.getVariantsTextureLocations(); set.addAll(this.getItemsTextureLocations()); set.remove(TextureMap.LOCATION_MISSING_TEXTURE); IIconCreator iiconcreator = new IIconCreator() { public void registerSprites(TextureMap iconRegistry) { for (ResourceLocation resourcelocation : set) { TextureAtlasSprite textureatlassprite = iconRegistry.registerSprite(resourcelocation); ModelBakery.this.sprites.put(resourcelocation, textureatlassprite); } } }; this.textureMap.loadSprites(this.resourceManager, iiconcreator); this.sprites.put(new ResourceLocation("missingno"), this.textureMap.getMissingSprite()); }
private static TextureAtlasSprite registerSprite(Properties p_registerSprite_0_, String p_registerSprite_1_, String p_registerSprite_2_, TextureMap p_registerSprite_3_) { String s = p_registerSprite_0_.getProperty(p_registerSprite_1_); if (s == null) { s = p_registerSprite_2_; } ResourceLocation resourcelocation = new ResourceLocation("textures/" + s + ".png"); if (!Config.hasResource(resourcelocation)) { Config.warn("BetterGrass texture not found: " + resourcelocation); s = p_registerSprite_2_; } ResourceLocation resourcelocation1 = new ResourceLocation(s); TextureAtlasSprite textureatlassprite = p_registerSprite_3_.registerSprite(resourcelocation1); return textureatlassprite; }
public void doRenderLayer(EntityEnderman entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) { IBlockState iblockstate = entitylivingbaseIn.getHeldBlockState(); if (iblockstate.getBlock().getMaterial() != Material.air) { BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); GlStateManager.enableRescaleNormal(); GlStateManager.pushMatrix(); GlStateManager.translate(0.0F, 0.6875F, -0.75F); GlStateManager.rotate(20.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(45.0F, 0.0F, 1.0F, 0.0F); GlStateManager.translate(0.25F, 0.1875F, 0.25F); float f = 0.5F; GlStateManager.scale(-f, -f, f); int i = entitylivingbaseIn.getBrightnessForRender(partialTicks); int j = i % 65536; int k = i / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.endermanRenderer.bindTexture(TextureMap.locationBlocksTexture); blockrendererdispatcher.renderBlockBrightness(iblockstate, 1.0F); GlStateManager.popMatrix(); GlStateManager.disableRescaleNormal(); } }
public void renderItemIntoGUI(ItemStack stack, int x, int y) { IBakedModel ibakedmodel = this.itemModelMesher.getItemModel(stack); GlStateManager.pushMatrix(); this.textureManager.bindTexture(TextureMap.locationBlocksTexture); this.textureManager.getTexture(TextureMap.locationBlocksTexture).setBlurMipmap(false, false); GlStateManager.enableRescaleNormal(); GlStateManager.enableAlpha(); GlStateManager.alphaFunc(516, 0.1F); GlStateManager.enableBlend(); GlStateManager.blendFunc(770, 771); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.setupGuiTransform(x, y, ibakedmodel.isGui3d()); ibakedmodel.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GUI); this.renderItem(stack, ibakedmodel); GlStateManager.disableAlpha(); GlStateManager.disableRescaleNormal(); GlStateManager.disableLighting(); GlStateManager.popMatrix(); this.textureManager.bindTexture(TextureMap.locationBlocksTexture); this.textureManager.getTexture(TextureMap.locationBlocksTexture).restoreLastBlurMipmap(); }
private void func_178108_a(float p_178108_1_, TextureAtlasSprite p_178108_2_) { this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); float f = 0.1F; GlStateManager.color(0.1F, 0.1F, 0.1F, 0.5F); GlStateManager.pushMatrix(); float f1 = -1.0F; float f2 = 1.0F; float f3 = -1.0F; float f4 = 1.0F; float f5 = -0.5F; float f6 = p_178108_2_.getMinU(); float f7 = p_178108_2_.getMaxU(); float f8 = p_178108_2_.getMinV(); float f9 = p_178108_2_.getMaxV(); worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); worldrenderer.pos(-1.0D, -1.0D, -0.5D).tex((double)f7, (double)f9).endVertex(); worldrenderer.pos(1.0D, -1.0D, -0.5D).tex((double)f6, (double)f9).endVertex(); worldrenderer.pos(1.0D, 1.0D, -0.5D).tex((double)f6, (double)f8).endVertex(); worldrenderer.pos(-1.0D, 1.0D, -0.5D).tex((double)f7, (double)f8).endVertex(); tessellator.draw(); GlStateManager.popMatrix(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); }
public static void allocateTextureMap(int texID, int mipmapLevels, int width, int height, Stitcher stitcher, TextureMap tex) { SMCLog.info("allocateTextureMap " + mipmapLevels + " " + width + " " + height + " "); updatingTextureMap = tex; tex.atlasWidth = width; tex.atlasHeight = height; MultiTexID multitexid = getMultiTexID(tex); updatingTex = multitexid; TextureUtil.allocateTextureImpl(multitexid.base, mipmapLevels, width, height); if (Shaders.configNormalMap) { TextureUtil.allocateTextureImpl(multitexid.norm, mipmapLevels, width, height); } if (Shaders.configSpecularMap) { TextureUtil.allocateTextureImpl(multitexid.spec, mipmapLevels, width, height); } GlStateManager.bindTexture(texID); }
static void updateTextureMinMagFilter() { TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager(); ITextureObject itextureobject = texturemanager.getTexture(TextureMap.locationBlocksTexture); if (itextureobject != null) { MultiTexID multitexid = itextureobject.getMultiTexID(); GlStateManager.bindTexture(multitexid.base); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, Shaders.texMinFilValue[Shaders.configTexMinFilB]); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, Shaders.texMagFilValue[Shaders.configTexMagFilB]); GlStateManager.bindTexture(multitexid.norm); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, Shaders.texMinFilValue[Shaders.configTexMinFilN]); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, Shaders.texMagFilValue[Shaders.configTexMagFilN]); GlStateManager.bindTexture(multitexid.spec); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, Shaders.texMinFilValue[Shaders.configTexMinFilS]); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, Shaders.texMagFilValue[Shaders.configTexMagFilS]); GlStateManager.bindTexture(0); } }
@Override protected ResourceLocation getEntityTexture(Entity entity) { _ProjectileBase shot = (_ProjectileBase) entity; String loc = shot.getEntityTexturePath(); if (loc != null) { return new ResourceLocation("quiverchevsky", loc); } else // Texture path is null. Is this using an MC-internal texture? { byte[] type = shot.getRenderType(); if (type[0] == 1) { return new ResourceLocation("textures/entity/arrow.png"); } // Regular arrow } return TextureMap.locationItemsTexture; // Fallback. Can't remember the damn texture map location, which is what I need for items }
protected void initAtlasSprites() { TextureMap texturemap = Minecraft.getMinecraft().getTextureMapBlocks(); this.atlasSpritesLava[0] = texturemap.getAtlasSprite("minecraft:blocks/lava_still"); this.atlasSpritesLava[1] = texturemap.getAtlasSprite("minecraft:blocks/lava_flow"); this.atlasSpritesWater[0] = texturemap.getAtlasSprite("minecraft:blocks/water_still"); this.atlasSpritesWater[1] = texturemap.getAtlasSprite("minecraft:blocks/water_flow"); this.atlasSpriteWaterOverlay = texturemap.getAtlasSprite("minecraft:blocks/water_overlay"); }
public void doRenderLayer(EntityMooshroom entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) { if (!entitylivingbaseIn.isChild() && !entitylivingbaseIn.isInvisible()) { BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); this.mooshroomRenderer.bindTexture(TextureMap.locationBlocksTexture); GlStateManager.enableCull(); GlStateManager.cullFace(1028); GlStateManager.pushMatrix(); GlStateManager.scale(1.0F, -1.0F, 1.0F); GlStateManager.translate(0.2F, 0.35F, 0.5F); GlStateManager.rotate(42.0F, 0.0F, 1.0F, 0.0F); GlStateManager.pushMatrix(); GlStateManager.translate(-0.5F, -0.5F, 0.5F); blockrendererdispatcher.renderBlockBrightness(Blocks.red_mushroom.getDefaultState(), 1.0F); GlStateManager.popMatrix(); GlStateManager.pushMatrix(); GlStateManager.translate(0.1F, 0.0F, -0.6F); GlStateManager.rotate(42.0F, 0.0F, 1.0F, 0.0F); GlStateManager.translate(-0.5F, -0.5F, 0.5F); blockrendererdispatcher.renderBlockBrightness(Blocks.red_mushroom.getDefaultState(), 1.0F); GlStateManager.popMatrix(); GlStateManager.popMatrix(); GlStateManager.pushMatrix(); ((ModelQuadruped)this.mooshroomRenderer.getMainModel()).head.postRender(0.0625F); GlStateManager.scale(1.0F, -1.0F, 1.0F); GlStateManager.translate(0.0F, 0.7F, -0.2F); GlStateManager.rotate(12.0F, 0.0F, 1.0F, 0.0F); GlStateManager.translate(-0.5F, -0.5F, 0.5F); blockrendererdispatcher.renderBlockBrightness(Blocks.red_mushroom.getDefaultState(), 1.0F); GlStateManager.popMatrix(); GlStateManager.cullFace(1029); GlStateManager.disableCull(); } }
protected void initAtlasSprites() { TextureMap texturemap = Minecraft.getMinecraft().getTextureMapBlocks(); this.atlasSpritesLava[0] = texturemap.getAtlasSprite("minecraft:blocks/lava_still"); this.atlasSpritesLava[1] = texturemap.getAtlasSprite("minecraft:blocks/lava_flow"); this.atlasSpritesWater[0] = texturemap.getAtlasSprite("minecraft:blocks/water_still"); this.atlasSpritesWater[1] = texturemap.getAtlasSprite("minecraft:blocks/water_flow"); }
@Override protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { this.drawDefaultBackground(); if (te != null) { FluidStack fstack = te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null).drain(1000, false); Minecraft.getMinecraft().renderEngine.bindTexture(texture); drawTexturedModalRect(guiLeft + 62, guiTop + 17, 176, 32, 52, 16); if (fstack == null) { drawTexturedModalRect(guiLeft + 80, guiTop + 17, xSize, 0, 16, 16); } else { TextureMap map = Minecraft.getMinecraft().getTextureMapBlocks(); TextureAtlasSprite sprite = map.getTextureExtry(fstack.getFluid().getStill().toString()); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); for (int i = 0; i < 4; i++) drawTexturedModalRect(guiLeft + 62 + (16 * i), guiTop + 17, sprite, 16, 16); } } Minecraft.getMinecraft().renderEngine.bindTexture(texture); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); if (te != null) { int[] data = ((ContainerBarrel) inventorySlots).data_a; if (data[2] > 0) { double progress = (double) data[0] / (double) data[2]; if (progress > 1) progress = 1; int dy = (int) Math.ceil(31 * progress); drawTexturedModalRect(guiLeft + 29, guiTop + 27 + 31 - dy, 0, ySize + 31 - dy, 11, dy); } float absorption = 1; if (data[3] > 0) absorption = (float) data[1] / (float) data[3]; GlStateManager.pushMatrix(); { GlStateManager.color(2 * (1f - absorption), 2 * absorption, 0f); drawTexturedModalRect(guiLeft + 134, guiTop + 20, xSize, 16, 16, 16); GlStateManager.color(1f, 1f, 1f); } GlStateManager.popMatrix(); } }
@Override protected void drawMore(Minecraft minecraft) { if(currentFluid != null) currentFluid.draw(minecraft, 6, 46); else { Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); TextureAtlasSprite textureSprite = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture((IBlockState) catalyst.getStateOrLoc()); Minecraft.getMinecraft().currentScreen.drawTexturedModalRect(6, 46, textureSprite, 17, 17); } ritualFront.draw(minecraft); }
public static void customRenderItem(ItemStack is, boolean normal) { RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); TextureManager textureManager = Minecraft.getMinecraft().getTextureManager(); // IBakedModel ibakedmodel = renderItem.getItemModelMesher().getItemModel(is); EntityPlayerSP player = MinecraftTools.getPlayer(Minecraft.getMinecraft()); IBakedModel ibakedmodel = renderItem.getItemModelWithOverrides(is, player.getEntityWorld(), player); textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); textureManager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false); preTransform(renderItem, is); GlStateManager.enableRescaleNormal(); GlStateManager.alphaFunc(516, 0.1F); if (normal) { GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); } GlStateManager.pushMatrix(); ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.NONE, false); renderItem.renderItem(is, ibakedmodel); GlStateManager.cullFace(GlStateManager.CullFace.BACK); GlStateManager.popMatrix(); GlStateManager.disableRescaleNormal(); if (normal) { GlStateManager.disableBlend(); } textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); textureManager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap(); }
@Override public void render(TileEntityGlassTerminal te, double x, double y, double z, float partialTick, int destroyStage, float alpha1) { if(WorldPortalRenderer.renderLevel == 0) { bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); GlStateManager.pushMatrix(); GlStateManager.disableLighting(); GlStateManager.color(1F, 1F, 1F, 1F); GlStateManager.translate(x, y, z); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); bufferbuilder.begin(7, DefaultVertexFormats.BLOCK); blockrendererdispatcher.getBlockModelRenderer().renderModel(te.getWorld(), blockrendererdispatcher.getModelForState(Blocks.OBSIDIAN.getDefaultState()), Blocks.OBSIDIAN.getDefaultState(), BlockPos.ORIGIN, bufferbuilder, false); tessellator.draw(); GlStateManager.pushMatrix(); float scale = 0.25F; GlStateManager.translate(0.5D, 0.5D, 0.5D); GlStateManager.rotate(45F, te.facing.getFrontOffsetX(), te.facing.getFrontOffsetY(), te.facing.getFrontOffsetZ()); GlStateManager.translate(-0.5D, -0.5D, -0.5D); GlStateManager.translate(0.375D, 0.375D, 0.375D); GlStateManager.translate(te.facing.getFrontOffsetX() * -0.4D, te.facing.getFrontOffsetY() * -0.4D, te.facing.getFrontOffsetZ() * -0.4D); GlStateManager.scale(scale, scale, scale); bufferbuilder.begin(7, DefaultVertexFormats.BLOCK); blockrendererdispatcher.getBlockModelRenderer().renderModel(te.getWorld(), blockrendererdispatcher.getModelForState(Blocks.GLASS.getDefaultState()), Blocks.GLASS.getDefaultState(), BlockPos.ORIGIN, bufferbuilder, false); tessellator.draw(); GlStateManager.popMatrix(); GlStateManager.enableLighting(); GlStateManager.popMatrix(); } }
@SubscribeEvent public void renderBlockBreakAnim(RenderWorldLastEvent event) { GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); this.mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false); this.drawBlockDamageTexture(Tessellator.getInstance(), Tessellator.getInstance().getBuffer(), this.mc.getRenderViewEntity(), event.getPartialTicks()); this.mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap(); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.disableBlend(); }
private void renderModel(EnumFacing facing, double x, double y, double z, float partialTicks) { float tick = RenderHelper.getRenderWorldTime(partialTicks); final float prevU = OpenGlHelper.lastBrightnessX; final float prevV = OpenGlHelper.lastBrightnessY; bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); //Top GlStateManager.pushMatrix(); GlStateManager.translate(x + 0.5D, y + 0.5D, z + 0.5D); if(facing != null && facing != EnumFacing.UP && facing != EnumFacing.DOWN) { GlStateManager.rotate(90F, facing == EnumFacing.NORTH || facing == EnumFacing.SOUTH ? 1F : 0F, 0F, facing == EnumFacing.EAST || facing == EnumFacing.WEST ? 1F : 0F); } GlStateManager.pushMatrix(); GlStateManager.rotate(partialTicks + tick * 0.5F % 360F, 0F, 1F, 0F); BlockBaker.render(BlockBaker.VACUUM_TOP); GlStateManager.popMatrix(); //Middle GlStateManager.disableLighting(); GLHelper.lightMap(255F, 255F); BlockBaker.render(BlockBaker.VACUUM_PIECE); GLHelper.lightMap(prevU, prevV); GlStateManager.enableLighting(); //Bottom GlStateManager.pushMatrix(); GlStateManager.rotate(partialTicks + tick * 0.5F % 360F, 0F, -1F, 0F); BlockBaker.render(BlockBaker.VACUUM_BOTTOM); GlStateManager.popMatrix(); GlStateManager.popMatrix(); }
protected void renderPortal(float timeInPortal, ScaledResolution scaledRes) { if (timeInPortal < 1.0F) { timeInPortal = timeInPortal * timeInPortal; timeInPortal = timeInPortal * timeInPortal; timeInPortal = timeInPortal * 0.8F + 0.2F; } GlStateManager.disableAlpha(); GlStateManager.disableDepth(); GlStateManager.depthMask(false); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.color(1.0F, 1.0F, 1.0F, timeInPortal); this.mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); TextureAtlasSprite textureatlassprite = this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(Blocks.PORTAL.getDefaultState()); float f = textureatlassprite.getMinU(); float f1 = textureatlassprite.getMinV(); float f2 = textureatlassprite.getMaxU(); float f3 = textureatlassprite.getMaxV(); Tessellator tessellator = Tessellator.getInstance(); VertexBuffer vertexbuffer = tessellator.getBuffer(); vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX); vertexbuffer.pos(0.0D, (double)scaledRes.getScaledHeight(), -90.0D).tex((double)f, (double)f3).endVertex(); vertexbuffer.pos((double)scaledRes.getScaledWidth(), (double)scaledRes.getScaledHeight(), -90.0D).tex((double)f2, (double)f3).endVertex(); vertexbuffer.pos((double)scaledRes.getScaledWidth(), 0.0D, -90.0D).tex((double)f2, (double)f1).endVertex(); vertexbuffer.pos(0.0D, 0.0D, -90.0D).tex((double)f, (double)f1).endVertex(); tessellator.draw(); GlStateManager.depthMask(true); GlStateManager.enableDepth(); GlStateManager.enableAlpha(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); }
private void updateDestroyBlockIcons() { TextureMap texturemap = this.mc.getTextureMapBlocks(); for (int i = 0; i < this.destroyBlockIcons.length; ++i) { this.destroyBlockIcons[i] = texturemap.getAtlasSprite("minecraft:blocks/destroy_stage_" + i); } }
/** * Renders the desired {@code T} type Entity. */ public void doRender(T entity, double x, double y, double z, float entityYaw, float partialTicks) { GlStateManager.pushMatrix(); GlStateManager.translate((float)x, (float)y, (float)z); GlStateManager.enableRescaleNormal(); GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GlStateManager.rotate((float)(this.renderManager.options.thirdPersonView == 2 ? -1 : 1) * this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); if (this.renderOutlines) { GlStateManager.enableColorMaterial(); GlStateManager.enableOutlineMode(this.getTeamColor(entity)); } this.itemRenderer.renderItem(this.getStackToRender(entity), ItemCameraTransforms.TransformType.GROUND); if (this.renderOutlines) { GlStateManager.disableOutlineMode(); GlStateManager.disableColorMaterial(); } GlStateManager.disableRescaleNormal(); GlStateManager.popMatrix(); super.doRender(entity, x, y, z, entityYaw, partialTicks); }
private void renderEffect(IBakedModel model) { if (!Config.isCustomItems() || CustomItems.isUseGlint()) { GlStateManager.depthMask(false); GlStateManager.depthFunc(514); GlStateManager.disableLighting(); GlStateManager.blendFunc(768, 1); this.textureManager.bindTexture(RES_ITEM_GLINT); GlStateManager.matrixMode(5890); GlStateManager.pushMatrix(); GlStateManager.scale(8.0F, 8.0F, 8.0F); float f = (float)(Minecraft.getSystemTime() % 3000L) / 3000.0F / 8.0F; GlStateManager.translate(f, 0.0F, 0.0F); GlStateManager.rotate(-50.0F, 0.0F, 0.0F, 1.0F); this.renderModel(model, -8372020); GlStateManager.popMatrix(); GlStateManager.pushMatrix(); GlStateManager.scale(8.0F, 8.0F, 8.0F); float f1 = (float)(Minecraft.getSystemTime() % 4873L) / 4873.0F / 8.0F; GlStateManager.translate(-f1, 0.0F, 0.0F); GlStateManager.rotate(10.0F, 0.0F, 0.0F, 1.0F); this.renderModel(model, -8372020); GlStateManager.popMatrix(); GlStateManager.matrixMode(5888); GlStateManager.blendFunc(770, 771); GlStateManager.enableLighting(); GlStateManager.depthFunc(515); GlStateManager.depthMask(true); this.textureManager.bindTexture(TextureMap.locationBlocksTexture); } }
/** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity>) and this method has signature public void doRender(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doe */ public void doRender(T entity, double x, double y, double z, float entityYaw, float partialTicks) { GlStateManager.pushMatrix(); GlStateManager.translate((float)x, (float)y, (float)z); GlStateManager.enableRescaleNormal(); GlStateManager.scale(0.5F, 0.5F, 0.5F); GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); this.bindTexture(TextureMap.locationBlocksTexture); this.field_177083_e.func_181564_a(this.func_177082_d(entity), ItemCameraTransforms.TransformType.GROUND); GlStateManager.disableRescaleNormal(); GlStateManager.popMatrix(); super.doRender(entity, x, y, z, entityYaw, partialTicks); }
@Override public void render(TileEntityXPBlock te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { if(GlobalXP.config.renderNameplate) { ITextComponent levelsText = new TextComponentString((int)te.getStoredLevels() + " (" + te.getStoredXP() + ")"); if(te != null && te.getPos() != null && rendererDispatcher.cameraHitResult != null && rendererDispatcher.cameraHitResult.getBlockPos() != null && rendererDispatcher.cameraHitResult.getBlockPos().equals(te.getPos())) { setLightmapDisabled(true); drawNameplate(te, levelsText.getFormattedText(), x, y, z, 12); setLightmapDisabled(false); } } double offset = Math.sin((te.getWorld().getTotalWorldTime() + partialTicks) * GlobalXP.config.bobSpeed / 8.0D) / 10.0D; IBakedModel model = Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(emerald, te.getWorld(), null); GlStateManager.enableRescaleNormal(); GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F); GlStateManager.enableBlend(); RenderHelper.enableStandardItemLighting(); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); GlStateManager.pushMatrix(); GlStateManager.translate(x + 0.5D, y + 0.4D + offset, z + 0.5D); GlStateManager.rotate((te.getWorld().getTotalWorldTime() + partialTicks) * 4.0F * (float)GlobalXP.config.spinSpeed, 0.0F, 1.0F, 0.0F); model = ForgeHooksClient.handleCameraTransforms(model, TransformType.GROUND, false); Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); Minecraft.getMinecraft().getRenderItem().renderItem(emerald, model); GlStateManager.popMatrix(); GlStateManager.disableRescaleNormal(); GlStateManager.disableBlend(); }
/** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity>) and this method has signature public void doRender(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doe */ public void doRender(EntityFallingBlock entity, double x, double y, double z, float entityYaw, float partialTicks) { if (entity.getBlock() != null) { this.bindTexture(TextureMap.locationBlocksTexture); IBlockState iblockstate = entity.getBlock(); Block block = iblockstate.getBlock(); BlockPos blockpos = new BlockPos(entity); World world = entity.getWorldObj(); if (iblockstate != world.getBlockState(blockpos) && block.getRenderType() != -1) { if (block.getRenderType() == 3) { GlStateManager.pushMatrix(); GlStateManager.translate((float)x, (float)y, (float)z); GlStateManager.disableLighting(); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); worldrenderer.begin(7, DefaultVertexFormats.BLOCK); int i = blockpos.getX(); int j = blockpos.getY(); int k = blockpos.getZ(); worldrenderer.setTranslation((double)((float)(-i) - 0.5F), (double)(-j), (double)((float)(-k) - 0.5F)); BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); IBakedModel ibakedmodel = blockrendererdispatcher.getModelFromBlockState(iblockstate, world, (BlockPos)null); blockrendererdispatcher.getBlockModelRenderer().renderModel(world, ibakedmodel, iblockstate, blockpos, worldrenderer, false); worldrenderer.setTranslation(0.0D, 0.0D, 0.0D); tessellator.draw(); GlStateManager.enableLighting(); GlStateManager.popMatrix(); super.doRender(entity, x, y, z, entityYaw, partialTicks); } } } }
public static void bindTextureMapForUpdateAndRender(TextureManager tm, ResourceLocation resLoc) { TextureMap texturemap = (TextureMap)tm.getTexture(resLoc); Shaders.atlasSizeX = texturemap.atlasWidth; Shaders.atlasSizeY = texturemap.atlasHeight; bindTextures(updatingTex = texturemap.getMultiTexID()); }
private void renderEffect(IBakedModel model) { GlStateManager.depthMask(false); GlStateManager.depthFunc(514); GlStateManager.disableLighting(); GlStateManager.blendFunc(768, 1); this.textureManager.bindTexture(RES_ITEM_GLINT); GlStateManager.matrixMode(5890); GlStateManager.pushMatrix(); GlStateManager.scale(8.0F, 8.0F, 8.0F); float f = (float)(Minecraft.getSystemTime() % 3000L) / 3000.0F / 8.0F; GlStateManager.translate(f, 0.0F, 0.0F); GlStateManager.rotate(-50.0F, 0.0F, 0.0F, 1.0F); this.renderModel(model, -8372020); GlStateManager.popMatrix(); GlStateManager.pushMatrix(); GlStateManager.scale(8.0F, 8.0F, 8.0F); float f1 = (float)(Minecraft.getSystemTime() % 4873L) / 4873.0F / 8.0F; GlStateManager.translate(-f1, 0.0F, 0.0F); GlStateManager.rotate(10.0F, 0.0F, 0.0F, 1.0F); this.renderModel(model, -8372020); GlStateManager.popMatrix(); GlStateManager.matrixMode(5888); GlStateManager.blendFunc(770, 771); GlStateManager.enableLighting(); GlStateManager.depthFunc(515); GlStateManager.depthMask(true); this.textureManager.bindTexture(TextureMap.locationBlocksTexture); }
public void renderItem(double x, double y, double z, TileMeltery meltery) { // calculate x/z parameters double x1 = meltery.getPos().getX(); double y1 = meltery.getPos().getY(); double z1 = meltery.getPos().getZ(); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); RenderUtil.pre(x, y, z); GlStateManager.translate(0.5,1/16d,0.5); GlStateManager.disableCull(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); RenderHelper.enableStandardItemLighting(); int brightness = meltery.getWorld().getCombinedLight(meltery.getPos(), 0); ItemStack stack = meltery.inventory.getStackInSlot(0); boolean isItem = !(stack.getItem() instanceof ItemBlock); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) (brightness % 0x10000) / 1f, (float) (brightness / 0x10000) / 1f); if (isItem) { GlStateManager.rotate(-90, 1, 0, 0); } else { GlStateManager.scale(0.5,0.5,0.5); } IBakedModel model = Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(stack, meltery.getWorld(), null); model = ForgeHooksClient.handleCameraTransforms(model, ItemCameraTransforms.TransformType.NONE, false); Minecraft.getMinecraft().getRenderItem().renderItem(stack, model); if (isItem) { GlStateManager.rotate(90, 1, 0, 0); } RenderHelper.enableStandardItemLighting(); GlStateManager.enableCull(); RenderUtil.post(); }
/** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity>) and this method has signature public void doRender(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doe */ public void doRender(EntityItemFrame entity, double x, double y, double z, float entityYaw, float partialTicks) { GlStateManager.pushMatrix(); BlockPos blockpos = entity.getHangingPosition(); double d0 = (double)blockpos.getX() - entity.posX + x; double d1 = (double)blockpos.getY() - entity.posY + y; double d2 = (double)blockpos.getZ() - entity.posZ + z; GlStateManager.translate(d0 + 0.5D, d1 + 0.5D, d2 + 0.5D); GlStateManager.rotate(180.0F - entity.rotationYaw, 0.0F, 1.0F, 0.0F); this.renderManager.renderEngine.bindTexture(TextureMap.locationBlocksTexture); BlockRendererDispatcher blockrendererdispatcher = this.mc.getBlockRendererDispatcher(); ModelManager modelmanager = blockrendererdispatcher.getBlockModelShapes().getModelManager(); IBakedModel ibakedmodel; if (entity.getDisplayedItem() != null && entity.getDisplayedItem().getItem() == Items.filled_map) { ibakedmodel = modelmanager.getModel(this.mapModel); } else { ibakedmodel = modelmanager.getModel(this.itemFrameModel); } GlStateManager.pushMatrix(); GlStateManager.translate(-0.5F, -0.5F, -0.5F); blockrendererdispatcher.getBlockModelRenderer().renderModelBrightnessColor(ibakedmodel, 1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.popMatrix(); GlStateManager.translate(0.0F, 0.0F, 0.4375F); this.renderItem(entity); GlStateManager.popMatrix(); this.renderName(entity, x + (double)((float)entity.facingDirection.getFrontOffsetX() * 0.3F), y - 0.25D, z + (double)((float)entity.facingDirection.getFrontOffsetZ() * 0.3F)); }