use of net.minecraft.client.renderer.texture.TextureAtlasSprite in project Railcraft by Railcraft.
the class FluidRenderer method setupFluidTexture.
@Nullable
public static ResourceLocation setupFluidTexture(@Nullable FluidStack fluidStack, FlowState flowState, CubeRenderer.RenderInfo renderInfo) {
if (fluidStack == null)
return null;
TextureAtlasSprite capTex = getFluidTexture(fluidStack, FlowState.STILL);
TextureAtlasSprite sideTex = getFluidTexture(fluidStack, flowState);
renderInfo.setTexture(EnumFacing.UP, capTex);
renderInfo.setTexture(EnumFacing.DOWN, capTex);
for (EnumFacing side : EnumFacing.HORIZONTALS) {
renderInfo.setTexture(side, sideTex);
}
return getFluidSheet(fluidStack);
}
use of net.minecraft.client.renderer.texture.TextureAtlasSprite in project Railcraft by Railcraft.
the class TextureAtlasSheet method unstitchIcons.
public static ResourceLocation[] unstitchIcons(TextureMap textureMap, ResourceLocation textureResource, Tuple<Integer, Integer> textureDimensions, String textureFolder) {
int columns = textureDimensions.getFirst();
int rows = textureDimensions.getSecond();
if (columns <= 1 && rows <= 1)
return new ResourceLocation[] { new ResourceLocation(textureResource.getResourceDomain(), textureFolder + textureResource.getResourcePath()) };
if (Game.DEVELOPMENT_ENVIRONMENT)
Game.log(Level.INFO, "Unstitching texture sheet: {0} {1}x{2}", textureResource, columns, rows);
int numIcons = rows * columns;
ResourceLocation[] locations = new ResourceLocation[numIcons];
String domain = textureResource.getResourceDomain();
String name = textureResource.getResourcePath();
Map<String, TextureAtlasSprite> mapRegisteredSprites = ObfuscationReflectionHelper.getPrivateValue(TextureMap.class, textureMap, 5);
for (int i = 0; i < numIcons; i++) {
String texName = domain + ":" + textureFolder + name;
TextureAtlasSheet texture = new TextureAtlasSheet(texName, i, rows, columns);
mapRegisteredSprites.put(texture.getIconName(), texture);
locations[i] = new ResourceLocation(texture.getIconName());
}
return locations;
}
use of net.minecraft.client.renderer.texture.TextureAtlasSprite in project Railcraft by Railcraft.
the class TESRSignalLamp method renderTileEntityAt.
@Override
public void renderTileEntityAt(TileSignalBase tile, double x, double y, double z, float partialTicks, int destroyStage) {
EnumFacing side = tile.getFacing();
SignalAspect aspect = tile.getSignalAspect().getDisplayAspect();
TextureAtlasSprite texture = RenderTools.getTexture(BlockMachineSignalBox.lampTextures[aspect.getTextureIndex()]);
lampInfo.setTexture(side, texture);
lampInfo.lightSource = aspect.getTextureBrightness();
doRenderAspect(x, y, z);
}
use of net.minecraft.client.renderer.texture.TextureAtlasSprite in project Railcraft by Railcraft.
the class LiquidFilter method draw.
@Override
public void draw(Renderer renderer, int x, int y) {
if (liquid != null) {
TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
Fluid fluid = liquid.getFluid();
TextureAtlasSprite icon = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(fluid.getStill(liquid).toString());
if (icon != null) {
textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
double u = icon.getInterpolatedU(3.0);
double u2 = icon.getInterpolatedU(13.0);
double v = icon.getInterpolatedV(1.0);
double v2 = icon.getInterpolatedV(15.0);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
GL11.glBegin(GL11.GL_QUADS);
GL11.glTexCoord2d(u, v);
GL11.glVertex2i(x + 3, y + 1);
GL11.glTexCoord2d(u, v2);
GL11.glVertex2i(x + 3, y + 15);
GL11.glTexCoord2d(u2, v2);
GL11.glVertex2i(x + 13, y + 15);
GL11.glTexCoord2d(u2, v);
GL11.glVertex2i(x + 13, y + 1);
GL11.glEnd();
}
}
renderer.renderRect(x - 1, y - 1, 18, 18, containerTexture);
}
use of net.minecraft.client.renderer.texture.TextureAtlasSprite in project Witchworks by Um-Mitternacht.
the class TileRenderKettle method renderWater.
private void renderWater(ResourceLocation loc) {
final TextureAtlasSprite sprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(loc.toString());
final Tessellator tessellator = Tessellator.getInstance();
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
tessellator.getBuffer().pos(0, 16, 0).tex(sprite.getMinU(), sprite.getMaxV()).endVertex();
tessellator.getBuffer().pos(16, 16, 0).tex(sprite.getMaxU(), sprite.getMaxV()).endVertex();
tessellator.getBuffer().pos(16, 0, 0).tex(sprite.getMaxU(), sprite.getMinV()).endVertex();
tessellator.getBuffer().pos(0, 0, 0).tex(sprite.getMinU(), sprite.getMinV()).endVertex();
tessellator.draw();
}
Aggregations