Search in sources :

Example 51 with TextureMap

use of net.minecraft.client.renderer.texture.TextureMap in project kull by Sxmurai.

the class BlockFluidRenderer method initAtlasSprites.

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");
}
Also used : TextureMap(net.minecraft.client.renderer.texture.TextureMap)

Example 52 with TextureMap

use of net.minecraft.client.renderer.texture.TextureMap in project kull by Sxmurai.

the class Render method renderEntityOnFire.

/**
 * Renders fire on top of the entity. Args: entity, x, y, z, partialTickTime
 */
private void renderEntityOnFire(Entity entity, double x, double y, double z, float partialTicks) {
    GlStateManager.disableLighting();
    TextureMap texturemap = Minecraft.getMinecraft().getTextureMapBlocks();
    TextureAtlasSprite textureatlassprite = texturemap.getAtlasSprite("minecraft:blocks/fire_layer_0");
    TextureAtlasSprite textureatlassprite1 = texturemap.getAtlasSprite("minecraft:blocks/fire_layer_1");
    GlStateManager.pushMatrix();
    GlStateManager.translate((float) x, (float) y, (float) z);
    float f = entity.width * 1.4F;
    GlStateManager.scale(f, f, f);
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    float f1 = 0.5F;
    float f2 = 0.0F;
    float f3 = entity.height / f;
    float f4 = (float) (entity.posY - entity.getEntityBoundingBox().minY);
    GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
    GlStateManager.translate(0.0F, 0.0F, -0.3F + (float) ((int) f3) * 0.02F);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    float f5 = 0.0F;
    int i = 0;
    worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
    while (f3 > 0.0F) {
        TextureAtlasSprite textureatlassprite2 = i % 2 == 0 ? textureatlassprite : textureatlassprite1;
        this.bindTexture(TextureMap.locationBlocksTexture);
        float f6 = textureatlassprite2.getMinU();
        float f7 = textureatlassprite2.getMinV();
        float f8 = textureatlassprite2.getMaxU();
        float f9 = textureatlassprite2.getMaxV();
        if (i / 2 % 2 == 0) {
            float f10 = f8;
            f8 = f6;
            f6 = f10;
        }
        worldrenderer.pos((double) (f1 - f2), (double) (0.0F - f4), (double) f5).tex((double) f8, (double) f9).endVertex();
        worldrenderer.pos((double) (-f1 - f2), (double) (0.0F - f4), (double) f5).tex((double) f6, (double) f9).endVertex();
        worldrenderer.pos((double) (-f1 - f2), (double) (1.4F - f4), (double) f5).tex((double) f6, (double) f7).endVertex();
        worldrenderer.pos((double) (f1 - f2), (double) (1.4F - f4), (double) f5).tex((double) f8, (double) f7).endVertex();
        f3 -= 0.45F;
        f4 -= 0.45F;
        f1 *= 0.9F;
        f5 += 0.03F;
        ++i;
    }
    tessellator.draw();
    GlStateManager.popMatrix();
    GlStateManager.enableLighting();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) TextureMap(net.minecraft.client.renderer.texture.TextureMap) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) WorldRenderer(net.minecraft.client.renderer.WorldRenderer)

Example 53 with TextureMap

use of net.minecraft.client.renderer.texture.TextureMap in project kull by Sxmurai.

the class Minecraft method startGame.

/**
 * Starts the game: initializes the canvas, the title, the settings, etcetera.
 */
private void startGame() throws LWJGLException, IOException {
    this.gameSettings = new GameSettings(this, this.mcDataDir);
    this.defaultResourcePacks.add(this.mcDefaultResourcePack);
    this.startTimerHackThread();
    if (this.gameSettings.overrideHeight > 0 && this.gameSettings.overrideWidth > 0) {
        this.displayWidth = this.gameSettings.overrideWidth;
        this.displayHeight = this.gameSettings.overrideHeight;
    }
    logger.info("LWJGL Version: " + Sys.getVersion());
    this.setWindowIcon();
    this.setInitialDisplayMode();
    this.createDisplay();
    OpenGlHelper.initializeTextures();
    this.framebufferMc = new Framebuffer(this.displayWidth, this.displayHeight, true);
    this.framebufferMc.setFramebufferColor(0.0F, 0.0F, 0.0F, 0.0F);
    this.registerMetadataSerializers();
    this.mcResourcePackRepository = new ResourcePackRepository(this.fileResourcepacks, new File(this.mcDataDir, "server-resource-packs"), this.mcDefaultResourcePack, this.metadataSerializer_, this.gameSettings);
    this.mcResourceManager = new SimpleReloadableResourceManager(this.metadataSerializer_);
    this.mcLanguageManager = new LanguageManager(this.metadataSerializer_, this.gameSettings.language);
    this.mcResourceManager.registerReloadListener(this.mcLanguageManager);
    this.refreshResources();
    this.renderEngine = new TextureManager(this.mcResourceManager);
    this.mcResourceManager.registerReloadListener(this.renderEngine);
    this.drawSplashScreen(this.renderEngine);
    this.initStream();
    this.skinManager = new SkinManager(this.renderEngine, new File(this.fileAssets, "skins"), this.sessionService);
    this.saveLoader = new AnvilSaveConverter(new File(this.mcDataDir, "saves"));
    this.mcSoundHandler = new SoundHandler(this.mcResourceManager, this.gameSettings);
    this.mcResourceManager.registerReloadListener(this.mcSoundHandler);
    this.mcMusicTicker = new MusicTicker(this);
    this.fontRendererObj = new FontRenderer(this.gameSettings, new ResourceLocation("textures/font/ascii.png"), this.renderEngine, false);
    if (this.gameSettings.language != null) {
        this.fontRendererObj.setUnicodeFlag(this.isUnicode());
        this.fontRendererObj.setBidiFlag(this.mcLanguageManager.isCurrentLanguageBidirectional());
    }
    this.standardGalacticFontRenderer = new FontRenderer(this.gameSettings, new ResourceLocation("textures/font/ascii_sga.png"), this.renderEngine, false);
    this.mcResourceManager.registerReloadListener(this.fontRendererObj);
    this.mcResourceManager.registerReloadListener(this.standardGalacticFontRenderer);
    this.mcResourceManager.registerReloadListener(new GrassColorReloadListener());
    this.mcResourceManager.registerReloadListener(new FoliageColorReloadListener());
    AchievementList.openInventory.setStatStringFormatter(new IStatStringFormat() {

        public String formatString(String p_74535_1_) {
            try {
                return String.format(p_74535_1_, new Object[] { GameSettings.getKeyDisplayString(Minecraft.this.gameSettings.keyBindInventory.getKeyCode()) });
            } catch (Exception exception) {
                return "Error: " + exception.getLocalizedMessage();
            }
        }
    });
    this.mouseHelper = new MouseHelper();
    this.checkGLError("Pre startup");
    GlStateManager.enableTexture2D();
    GlStateManager.shadeModel(7425);
    GlStateManager.clearDepth(1.0D);
    GlStateManager.enableDepth();
    GlStateManager.depthFunc(515);
    GlStateManager.enableAlpha();
    GlStateManager.alphaFunc(516, 0.1F);
    GlStateManager.cullFace(1029);
    GlStateManager.matrixMode(5889);
    GlStateManager.loadIdentity();
    GlStateManager.matrixMode(5888);
    this.checkGLError("Startup");
    this.textureMapBlocks = new TextureMap("textures");
    this.textureMapBlocks.setMipmapLevels(this.gameSettings.mipmapLevels);
    this.renderEngine.loadTickableTexture(TextureMap.locationBlocksTexture, this.textureMapBlocks);
    this.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
    this.textureMapBlocks.setBlurMipmapDirect(false, this.gameSettings.mipmapLevels > 0);
    this.modelManager = new ModelManager(this.textureMapBlocks);
    this.mcResourceManager.registerReloadListener(this.modelManager);
    this.renderItem = new RenderItem(this.renderEngine, this.modelManager);
    this.renderManager = new RenderManager(this.renderEngine, this.renderItem);
    this.itemRenderer = new ItemRenderer(this);
    this.mcResourceManager.registerReloadListener(this.renderItem);
    this.entityRenderer = new EntityRenderer(this, this.mcResourceManager);
    this.mcResourceManager.registerReloadListener(this.entityRenderer);
    this.blockRenderDispatcher = new BlockRendererDispatcher(this.modelManager.getBlockModelShapes(), this.gameSettings);
    this.mcResourceManager.registerReloadListener(this.blockRenderDispatcher);
    this.renderGlobal = new RenderGlobal(this);
    this.mcResourceManager.registerReloadListener(this.renderGlobal);
    this.guiAchievement = new GuiAchievement(this);
    GlStateManager.viewport(0, 0, this.displayWidth, this.displayHeight);
    this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine);
    this.checkGLError("Post startup");
    this.ingameGUI = new GuiIngame(this);
    if (this.serverName != null) {
        this.displayGuiScreen(new GuiConnecting(new GuiMainMenu(), this, this.serverName, this.serverPort));
    } else {
        this.displayGuiScreen(new GuiMainMenu());
    }
    this.renderEngine.deleteTexture(this.mojangLogo);
    this.mojangLogo = null;
    this.loadingScreen = new LoadingScreenRenderer(this);
    if (this.gameSettings.fullScreen && !this.fullscreen) {
        this.toggleFullscreen();
    }
    try {
        Display.setVSyncEnabled(this.gameSettings.enableVsync);
    } catch (OpenGLException var2) {
        this.gameSettings.enableVsync = false;
        this.gameSettings.saveOptions();
    }
    this.renderGlobal.makeEntityOutlineShader();
    try {
        Kull.init();
    } catch (Exception e) {
        e.printStackTrace();
        logger.info("my bad g");
    }
}
Also used : GuiAchievement(net.minecraft.client.gui.achievement.GuiAchievement) OpenGLException(org.lwjgl.opengl.OpenGLException) AnvilSaveConverter(net.minecraft.world.chunk.storage.AnvilSaveConverter) NBTTagString(net.minecraft.nbt.NBTTagString) RenderItem(net.minecraft.client.renderer.entity.RenderItem) GuiMainMenu(net.minecraft.client.gui.GuiMainMenu) ResourceLocation(net.minecraft.util.ResourceLocation) MouseHelper(net.minecraft.util.MouseHelper) ItemRenderer(net.minecraft.client.renderer.ItemRenderer) EffectRenderer(net.minecraft.client.particle.EffectRenderer) GuiConnecting(net.minecraft.client.multiplayer.GuiConnecting) GameSettings(net.minecraft.client.settings.GameSettings) RenderManager(net.minecraft.client.renderer.entity.RenderManager) BlockRendererDispatcher(net.minecraft.client.renderer.BlockRendererDispatcher) MusicTicker(net.minecraft.client.audio.MusicTicker) SoundHandler(net.minecraft.client.audio.SoundHandler) SimpleReloadableResourceManager(net.minecraft.client.resources.SimpleReloadableResourceManager) ModelManager(net.minecraft.client.resources.model.ModelManager) ReportedException(net.minecraft.util.ReportedException) LWJGLException(org.lwjgl.LWJGLException) OpenGLException(org.lwjgl.opengl.OpenGLException) IOException(java.io.IOException) RenderGlobal(net.minecraft.client.renderer.RenderGlobal) GuiIngame(net.minecraft.client.gui.GuiIngame) Framebuffer(net.minecraft.client.shader.Framebuffer) TextureManager(net.minecraft.client.renderer.texture.TextureManager) IStatStringFormat(net.minecraft.stats.IStatStringFormat) GrassColorReloadListener(net.minecraft.client.resources.GrassColorReloadListener) TextureMap(net.minecraft.client.renderer.texture.TextureMap) ResourcePackRepository(net.minecraft.client.resources.ResourcePackRepository) FoliageColorReloadListener(net.minecraft.client.resources.FoliageColorReloadListener) LanguageManager(net.minecraft.client.resources.LanguageManager) FontRenderer(net.minecraft.client.gui.FontRenderer) SkinManager(net.minecraft.client.resources.SkinManager) File(java.io.File) EntityRenderer(net.minecraft.client.renderer.EntityRenderer)

Example 54 with TextureMap

use of net.minecraft.client.renderer.texture.TextureMap in project UtilityClient2 by Utility-Client.

the class BlockFluidRenderer method initAtlasSprites.

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");
}
Also used : TextureMap(net.minecraft.client.renderer.texture.TextureMap)

Example 55 with TextureMap

use of net.minecraft.client.renderer.texture.TextureMap in project UtilityClient2 by Utility-Client.

the class Render method renderEntityOnFire.

/**
 * Renders fire on top of the entity. Args: entity, x, y, z, partialTickTime
 */
private void renderEntityOnFire(Entity entity, double x, double y, double z, float partialTicks) {
    GlStateManager.disableLighting();
    TextureMap texturemap = Minecraft.getMinecraft().getTextureMapBlocks();
    TextureAtlasSprite textureatlassprite = texturemap.getAtlasSprite("minecraft:blocks/fire_layer_0");
    TextureAtlasSprite textureatlassprite1 = texturemap.getAtlasSprite("minecraft:blocks/fire_layer_1");
    GlStateManager.pushMatrix();
    GlStateManager.translate((float) x, (float) y, (float) z);
    float f = entity.width * 1.4F;
    GlStateManager.scale(f, f, f);
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    float f1 = 0.5F;
    float f2 = 0.0F;
    float f3 = entity.height / f;
    float f4 = (float) (entity.posY - entity.getEntityBoundingBox().minY);
    GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
    GlStateManager.translate(0.0F, 0.0F, -0.3F + (float) ((int) f3) * 0.02F);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    float f5 = 0.0F;
    int i = 0;
    worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
    while (f3 > 0.0F) {
        TextureAtlasSprite textureatlassprite2 = i % 2 == 0 ? textureatlassprite : textureatlassprite1;
        this.bindTexture(TextureMap.locationBlocksTexture);
        float f6 = textureatlassprite2.getMinU();
        float f7 = textureatlassprite2.getMinV();
        float f8 = textureatlassprite2.getMaxU();
        float f9 = textureatlassprite2.getMaxV();
        if (i / 2 % 2 == 0) {
            float f10 = f8;
            f8 = f6;
            f6 = f10;
        }
        worldrenderer.pos((double) (f1 - f2), (double) (0.0F - f4), (double) f5).tex((double) f8, (double) f9).endVertex();
        worldrenderer.pos((double) (-f1 - f2), (double) (0.0F - f4), (double) f5).tex((double) f6, (double) f9).endVertex();
        worldrenderer.pos((double) (-f1 - f2), (double) (1.4F - f4), (double) f5).tex((double) f6, (double) f7).endVertex();
        worldrenderer.pos((double) (f1 - f2), (double) (1.4F - f4), (double) f5).tex((double) f8, (double) f7).endVertex();
        f3 -= 0.45F;
        f4 -= 0.45F;
        f1 *= 0.9F;
        f5 += 0.03F;
        ++i;
    }
    tessellator.draw();
    GlStateManager.popMatrix();
    GlStateManager.enableLighting();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) TextureMap(net.minecraft.client.renderer.texture.TextureMap) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) WorldRenderer(net.minecraft.client.renderer.WorldRenderer)

Aggregations

TextureMap (net.minecraft.client.renderer.texture.TextureMap)107 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)54 ResourceLocation (net.minecraft.util.ResourceLocation)49 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)20 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)19 BlockPos (net.minecraft.util.math.BlockPos)13 Fluid (net.minecraftforge.fluids.Fluid)10 FluidStack (net.minecraftforge.fluids.FluidStack)9 Tessellator (net.minecraft.client.renderer.Tessellator)8 IAlleleTreeSpecies (forestry.api.arboriculture.IAlleleTreeSpecies)6 ILeafSpriteProvider (forestry.api.arboriculture.ILeafSpriteProvider)6 ITreeGenome (forestry.api.arboriculture.ITreeGenome)6 EnumFacing (net.minecraft.util.EnumFacing)6 File (java.io.File)5 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)5 TextureManager (net.minecraft.client.renderer.texture.TextureManager)5 World (net.minecraft.world.World)5 SideOnly (cpw.mods.fml.relauncher.SideOnly)4 IBlockState (net.minecraft.block.state.IBlockState)4 BufferBuilder (net.minecraft.client.renderer.BufferBuilder)4