Search in sources :

Example 16 with TextureAtlasSprite

use of net.minecraft.client.renderer.texture.TextureAtlasSprite in project AgriCraft by AgriCraft.

the class RenderPeripheral method drawSeed.

private void drawSeed(ITessellator tessellator, TileEntityPeripheral peripheral) {
    ItemStack stack = peripheral.getStackInSlot(ContainerSeedAnalyzer.seedSlotId);
    if (stack == null || stack.getItem() == null) {
        return;
    }
    //TODO: find seed icon
    TextureAtlasSprite icon = Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite();
    if (icon == null) {
        return;
    }
    float dx = 4 * Constants.UNIT;
    float dy = 14 * Constants.UNIT;
    float dz = 4 * Constants.UNIT;
    float scale = 0.5F;
    float angle = 90.0F;
    GL11.glPushMatrix();
    GL11.glTranslated(dx, dy, dz);
    //resize the texture to half the size
    GL11.glScalef(scale, scale, scale);
    //rotate the renderer
    GL11.glRotatef(angle, 1.0F, 0.0F, 0.0F);
    //TODO: render the seed
    GL11.glRotatef(-angle, 1.0F, 0.0F, 0.0F);
    GL11.glScalef(1 / scale, 1 / scale, 1 / scale);
    GL11.glTranslated(-dx, -dy, -dz);
    GL11.glPopMatrix();
}
Also used : TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) ItemStack(net.minecraft.item.ItemStack)

Example 17 with TextureAtlasSprite

use of net.minecraft.client.renderer.texture.TextureAtlasSprite in project AgriCraft by AgriCraft.

the class RenderChannelValve method renderInventoryBlockWood.

@Override
public void renderInventoryBlockWood(ITessellator tessellator, World world, IBlockState state, BlockWaterChannelValve block, TileEntityChannelValve tile, ItemStack stack, EntityLivingBase entity, ItemCameraTransforms.TransformType type, TextureAtlasSprite icon) {
    final TextureAtlasSprite sepIcon = BaseIcons.IRON_BLOCK.getIcon();
    //Render channel.
    tessellator.drawScaledPrism(2, 4, 4, 14, 12, 5, icon);
    tessellator.drawScaledPrism(2, 4, 11, 14, 12, 12, icon);
    tessellator.drawScaledPrism(2, 4, 5, 14, 5, 11, icon);
    //Render separators.
    tessellator.drawScaledPrism(0.001f, 11.5f, 5, 1.999f, 15.001f, 11, sepIcon);
    tessellator.drawScaledPrism(0.001f, 0.999f, 5, 1.999f, 5.5f, 11, sepIcon);
    tessellator.drawScaledPrism(14.001f, 11.5f, 5, 15.999f, 15.001f, 11, sepIcon);
    tessellator.drawScaledPrism(14.001f, 0.999f, 5, 15.999f, 5.5f, 11, sepIcon);
    //render the wooden guide rails along z-axis
    tessellator.drawScaledPrism(0, 0, 3.999F, 2, 16, 5.999F, icon);
    tessellator.translate(0, 0, 6 * Constants.UNIT);
    tessellator.drawScaledPrism(0, 0, 3.999F, 2, 16, 5.999F, icon);
    tessellator.translate(14 * Constants.UNIT, 0, 0);
    tessellator.drawScaledPrism(0, 0, 3.999F, 2, 16, 5.999F, icon);
    tessellator.translate(0, 0, -6 * Constants.UNIT);
    tessellator.drawScaledPrism(0, 0, 3.999F, 2, 16, 5.999F, icon);
    tessellator.translate(-14 * Constants.UNIT, 0, 0);
}
Also used : TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite)

Example 18 with TextureAtlasSprite

use of net.minecraft.client.renderer.texture.TextureAtlasSprite in project AgriCraft by AgriCraft.

the class RenderCrop method renderWorldBlockStatic.

@Override
public void renderWorldBlockStatic(ITessellator tessellator, IBlockState state, BlockCrop block, EnumFacing side) {
    TextureAtlasSprite sprite = RenderCrop.getIcon(TEXTURE);
    this.renderBaseQuads(tessellator, side, sprite);
    if (state instanceof IExtendedBlockState) {
        IExtendedBlockState extendedState = (IExtendedBlockState) state;
        IAgriPlant plant = extendedState.getValue(AgriProperties.CROP_PLANT);
        int growthstage = extendedState.getValue(AgriProperties.GROWTH_STAGE);
        if (extendedState.getValue(AgriProperties.CROSS_CROP)) {
            tessellator.drawScaledPrism(0, 10, 2, 16, 11, 3, sprite);
            tessellator.drawScaledPrism(0, 10, 13, 16, 11, 14, sprite);
            tessellator.drawScaledPrism(2, 10, 0, 3, 11, 16, sprite);
            tessellator.drawScaledPrism(13, 10, 0, 14, 11, 16, sprite);
        }
        if (plant != null) {
            tessellator.addQuads(plant.getPlantQuads(extendedState, growthstage, side, tessellator));
        }
    }
}
Also used : IAgriPlant(com.infinityraider.agricraft.api.v1.plant.IAgriPlant) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState)

Example 19 with TextureAtlasSprite

use of net.minecraft.client.renderer.texture.TextureAtlasSprite in project AgriCraft by AgriCraft.

the class RenderSprinkler method renderInventoryBlock.

@Override
public void renderInventoryBlock(ITessellator tessellator, World world, IBlockState state, BlockSprinkler block, TileEntitySprinkler tile, ItemStack stack, EntityLivingBase entity, ItemCameraTransforms.TransformType type) {
    // Draw Top
    tessellator.drawScaledPrism(4, 8, 4, 12, 16, 12, BaseIcons.OAK_PLANKS.getIcon());
    // Get Core Icon
    final TextureAtlasSprite coreIcon = BaseIcons.IRON_BLOCK.getIcon();
    // Draw Core
    tessellator.drawScaledPrism(MIN_C, MIN_Y - 8, MIN_C, MAX_C, MAX_Y - 4, MAX_C, coreIcon);
    // Draw Blades
    tessellator.drawScaledPrism(BMX_A, MIN_Y - 8, MIN_C, BMX_B, BMX_Y - 8, MAX_C, coreIcon);
    tessellator.drawScaledPrism(MIN_C, MIN_Y - 8, BMX_A, MAX_C, BMX_Y - 8, BMX_B, coreIcon);
}
Also used : TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite)

Example 20 with TextureAtlasSprite

use of net.minecraft.client.renderer.texture.TextureAtlasSprite in project AgriCraft by AgriCraft.

the class RenderSprinkler method renderWorldBlockDynamic.

@Override
public void renderWorldBlockDynamic(ITessellator tess, World world, BlockPos pos, double x, double y, double z, BlockSprinkler block, TileEntitySprinkler te, float partialTick, int destroyStage) {
    tess.pushMatrix();
    tess.translate(0.5F, 0, 0.5F);
    tess.rotate(te.getAngle(), 0, 1, 0);
    tess.translate(-0.5F, 0, -0.5F);
    final TextureAtlasSprite icon = BaseIcons.IRON_BLOCK.getIcon();
    // Draw Core
    tess.drawScaledPrism(MIN_C, MIN_Y, MIN_C, MAX_C, MAX_Y, MAX_C, icon);
    // Draw Blades
    tess.drawScaledPrism(BMX_A, MIN_Y, MIN_C, BMX_B, BMX_Y, MAX_C, icon);
    tess.drawScaledPrism(MIN_C, MIN_Y, BMX_A, MAX_C, BMX_Y, BMX_B, icon);
    tess.popMatrix();
}
Also used : TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite)

Aggregations

TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)44 BakedQuad (net.minecraft.client.renderer.block.model.BakedQuad)7 EnumFacing (net.minecraft.util.EnumFacing)7 ResourceLocation (net.minecraft.util.ResourceLocation)6 Matrix4 (blusunrize.immersiveengineering.common.util.chickenbones.Matrix4)5 IBlockState (net.minecraft.block.state.IBlockState)5 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)5 TileEntity (net.minecraft.tileentity.TileEntity)5 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)5 Tessellator (net.minecraft.client.renderer.Tessellator)4 IExtendedBlockState (net.minecraftforge.common.property.IExtendedBlockState)4 FluidStack (net.minecraftforge.fluids.FluidStack)4 Vector3f (org.lwjgl.util.vector.Vector3f)4 HashMap (java.util.HashMap)3 Block (net.minecraft.block.Block)3 TextureManager (net.minecraft.client.renderer.texture.TextureManager)3 ConveyorDirection (blusunrize.immersiveengineering.api.tool.ConveyorHandler.ConveyorDirection)2 Utils (blusunrize.immersiveengineering.common.util.Utils)2 ImmutableList (com.google.common.collect.ImmutableList)2 Map (java.util.Map)2