Example usage for net.minecraftforge.client.event TextureStitchEvent.Post getMap

List of usage examples for net.minecraftforge.client.event TextureStitchEvent.Post getMap

Introduction

In this page you can find the example usage for net.minecraftforge.client.event TextureStitchEvent.Post getMap.

Prototype

public AtlasTexture getMap() 

Source Link

Usage

From source file:buildcraft.core.lib.client.render.FluidRenderer.java

License:Minecraft Mod Public

@SubscribeEvent
public void textureStitchPost(TextureStitchEvent.Post event) {
    flowingRenderCache.clear();/*  www.  ja v a2  s  . co m*/
    stillRenderCache.clear();
    frozenRenderCache.clear();
    TextureMap map = event.getMap();
    missingIcon = map.getMissingSprite();

    textureMap.clear();

    for (FluidType type : FluidType.values()) {
        textureMap.put(type, new HashMap<Fluid, TextureAtlasSprite>());
    }

    for (Fluid fluid : FluidRegistry.getRegisteredFluids().values()) {
        // TextureAtlasSprite toUse = null;

        if (fluid.getFlowing() != null) {
            String flow = fluid.getFlowing().toString();
            TextureAtlasSprite sprite;
            if (map.getTextureExtry(flow) != null) {
                sprite = map.getTextureExtry(flow);
            } else {
                sprite = map.registerSprite(fluid.getFlowing());
            }
            // toUse = sprite;
            textureMap.get(FluidType.FLOWING).put(fluid, sprite);
        }

        if (fluid.getStill() != null) {
            String still = fluid.getStill().toString();
            TextureAtlasSprite sprite;
            if (map.getTextureExtry(still) != null) {
                sprite = map.getTextureExtry(still);
            } else {
                sprite = map.registerSprite(fluid.getStill());
            }
            // toUse = sprite;
            textureMap.get(FluidType.STILL).put(fluid, sprite);
        }
        // if (toUse != null) {
        // textureMap.get(FluidType.FROZEN).put(fluid, toUse);
        // }
    }
}

From source file:buildcraft.lib.BCLibEventDist.java

License:Mozilla Public License

@SubscribeEvent
@SideOnly(Side.CLIENT)//from ww w  .j a  va2  s . c o  m
public void textureStitchPost(TextureStitchEvent.Post event) {
    TextureMap map = event.getMap();
    SpriteHolderRegistry.onTextureStitchPost();
}

From source file:com.techshroom.mods.craftorio.block.entity.TESRRailSegmentDisplay.java

License:MIT License

@SubscribeEvent
public void onReload(TextureStitchEvent.Post postStitch) {
    TextureMap textureMapBlocks = Minecraft.getMinecraft().getTextureMapBlocks();
    if (postStitch.getMap() == textureMapBlocks) {
        this.whiteness = textureMapBlocks.getAtlasSprite("minecraft:white");
    }/*from  w ww.ja  v a  2s.  c  o m*/
}