Java Code Examples for net.minecraft.client.renderer.texture.TextureMap#setTextureEntry()

The following examples show how to use net.minecraft.client.renderer.texture.TextureMap#setTextureEntry() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SpriteSheetManager.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void registerIcons(TextureMap textureMap) {
    if (TextureUtils.refreshTexture(textureMap, resource.getResourcePath())) {
        reloadTexture();
        for (TextureSpecial sprite : sprites)
            if (sprite != null)
                textureMap.setTextureEntry(sprite.getIconName(), sprite);
    } else {
        for (int i : newSprites)
            textureMap.setTextureEntry(sprites[i].getIconName(), sprites[i]);
    }
    newSprites.clear();
}
 
Example 2
Source File: TextureUtils.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static TextureAtlasSprite getBlankIcon(int size, TextureMap textureMap) {
    String s = "blank_" + size;
    TextureAtlasSprite icon = textureMap.getTextureExtry(s);
    if (icon == null)
        textureMap.setTextureEntry(s, icon = new TextureSpecial(s).blank(size));

    return icon;
}
 
Example 3
Source File: TextureUtils.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static TextureSpecial getTextureSpecial(TextureMap textureMap, String name) {
    if (textureMap.getTextureExtry(name) != null)
        throw new IllegalStateException("Texture: " + name + " is already registered");

    TextureSpecial icon = new TextureSpecial(name);
    textureMap.setTextureEntry(name, icon);
    return icon;
}
 
Example 4
Source File: TextureUtils.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Uses an empty placeholder texture to tell if the map has been reloaded since the last call to refresh texture and the texture with name needs to be reacquired to be valid
 */
public static boolean refreshTexture(TextureMap map, String name) {
    if (map.getTextureExtry(name) == null) {
        map.setTextureEntry(name, new PlaceholderTexture(name));
        return true;
    }
    return false;
}
 
Example 5
Source File: TextureSpecial.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void registerIcons(TextureMap textureMap) {
    textureMap.setTextureEntry(getIconName(), this);
}