use of net.minecraft.client.renderer.texture.TextureMap in project ImmersiveEngineering by BluSunrize.
the class ClientEventHandler method onResourceManagerReload.
@Override
public void onResourceManagerReload(IResourceManager resourceManager) {
TextureMap texturemap = Minecraft.getMinecraft().getTextureMapBlocks();
for (int i = 0; i < ClientUtils.destroyBlockIcons.length; i++) ClientUtils.destroyBlockIcons[i] = texturemap.getAtlasSprite("minecraft:blocks/destroy_stage_" + i);
ImmersiveEngineering.proxy.clearRenderCaches();
}
use of net.minecraft.client.renderer.texture.TextureMap in project AgriCraft by AgriCraft.
the class IconHelper method findMatches.
/**
* Pure hack to find icons...
*
* @param name
* @return
*/
public static Deque<String> findMatches(String name) {
name = name.toLowerCase();
if (findCache.containsKey(name)) {
return findCache.get(name);
}
Deque<String> matches = new ArrayDeque<>();
try {
Field f = TextureMap.class.getDeclaredField("mapRegisteredSprites");
f.setAccessible(true);
Map<String, TextureAtlasSprite> textureMap = (Map<String, TextureAtlasSprite>) f.get(Minecraft.getMinecraft().getTextureMapBlocks());
for (String e : textureMap.keySet()) {
if (e.contains(name)) {
matches.add(e);
}
}
if (!findCache.isEmpty()) {
findCache.put(name, matches);
} else {
matches.add("missingno");
}
} catch (NoSuchFieldException | IllegalAccessException e) {
// Shoot
AgriCore.getLogger("agricraft").debug("Something strange is going on with the Minecraft TextureMap!");
} catch (SecurityException e) {
AgriCore.getLogger("agricraft").debug("Locked out of TextureMap...");
}
return matches;
}
use of net.minecraft.client.renderer.texture.TextureMap in project Railcraft by Railcraft.
the class FluidModelRenderer method loadTextures.
@SubscribeEvent
public void loadTextures(TextureStitchEvent.Pre event) {
final TextureMap map = event.getMap();
FluidRegistry.getRegisteredFluids().values().forEach(f -> {
map.registerSprite(f.getFlowing());
map.registerSprite(f.getStill());
});
}
use of net.minecraft.client.renderer.texture.TextureMap in project Railcraft by Railcraft.
the class JSONModelRenderer method bakeModels.
@SubscribeEvent
public void bakeModels(TextureStitchEvent.Post event) {
final TextureMap map = event.getMap();
for (Map.Entry<ResourceLocation, IModel> model : models.entrySet()) {
IBakedModel bakedModel = model.getValue().bake(TRSRTransformation.identity(), DefaultVertexFormats.BLOCK, l -> l == null ? RenderTools.getMissingTexture() : map.getAtlasSprite(l.toString()));
bakedModels.put(model.getKey(), bakedModel);
}
}
Aggregations