net.minecraft.util.Icon Java Examples

The following examples show how to use net.minecraft.util.Icon. 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: RenderHelper.java    From ExtraCells1 with MIT License 6 votes vote down vote up
public void drawFace(ForgeDirection side, Block block, double x, double y, double z, Icon icon, RenderBlocks renderer)
{
	switch (side)
	{
	case UP:
		renderer.renderFaceYPos(block, x, y, z, icon);
		break;
	case DOWN:
		renderer.renderFaceYNeg(block, x, y, z, icon);
		break;
	case NORTH:
		renderer.renderFaceZNeg(block, x, y, z, icon);
		break;
	case EAST:
		renderer.renderFaceXPos(block, x, y, z, icon);
		break;
	case SOUTH:
		renderer.renderFaceZPos(block, x, y, z, icon);
		break;
	case WEST:
		renderer.renderFaceXNeg(block, x, y, z, icon);
		break;
	case UNKNOWN:
		break;
	}
}
 
Example #2
Source File: BlockEndEye.java    From Ex-Aliquo with MIT License 6 votes vote down vote up
@SideOnly(Side.CLIENT)
@Override
public Icon getIcon(int id, int meta)
{
	if (AliquoTickHandler.tick == 400 && allow)
	{
		allow = false;
		return icon[eyeBlink()];
	}
	if (AliquoTickHandler.tick > 20 && !allow)
	{
		allow = true;
		return icon[0];
	}
	else return icon[eye];
}
 
Example #3
Source File: BlockMEBattery.java    From ExtraCells1 with MIT License 6 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public Icon getBlockTexture(IBlockAccess blockAccess, int x, int y, int z, int side)
{
	TileEntity tileentity = blockAccess.getBlockTileEntity(x, y, z);

	if (tileentity != null)
	{
		TileEntityMEBattery meBattery = (TileEntityMEBattery) tileentity;

		double energy = meBattery.getMECurrentPower();
		double maxEnergy = meBattery.getMEMaxPower();

		if (energy < (maxEnergy * 0.25))
		{
			return iconLow;
		} else if (energy >= (maxEnergy * 0.25) && energy <= (maxEnergy * 0.75))
		{
			return iconMed;
		} else
		{
			return iconHi;
		}
	}
	return iconLow;
}
 
Example #4
Source File: ItemCasing.java    From ExtraCells1 with MIT License 5 votes vote down vote up
@Override
public void registerIcons(IconRegister iconRegister)
{
	this.icons = new Icon[suffixes.length];

	for (int i = 0; i < suffixes.length; ++i)
	{
		this.icons[i] = iconRegister.registerIcon("extracells:" + "casing.advanced." + suffixes[i]);
	}
}
 
Example #5
Source File: BlockHardMEDrive.java    From ExtraCells1 with MIT License 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public Icon getBlockTexture(IBlockAccess blockAccess, int x, int y, int z, int side)
{
	TileEntity tileentity = blockAccess.getBlockTileEntity(x, y, z);
	int metadata = blockAccess.getBlockMetadata(x, y, z);

	if (tileentity != null)
	{
		return giveIcon(side, metadata);
	}
	return null;
}
 
Example #6
Source File: MoCBlockPlanks.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
/**
    * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
    */
@SideOnly(Side.CLIENT)
   @Override
   public Icon getIcon(int par1, int par2)
   {
       return icons[par2];
   }
 
Example #7
Source File: MoCBlockPlanks.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
@SideOnly(Side.CLIENT)
@Override
   public void registerIcons(IconRegister par1IconRegister)
   {
	icons = new Icon[MoCreatures.multiBlockNames.size()];
       
	for (int x = 0; x < MoCreatures.multiBlockNames.size(); x++)
	{
		icons[x] = par1IconRegister.registerIcon("mocreatures:" + "woodPlanks_" + MoCreatures.multiBlockNames.get(x));
	}
   }
 
Example #8
Source File: MoCBlockTallGrass.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
/**
 * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
 */
@SideOnly(Side.CLIENT)
@Override
public Icon getIcon(int par1, int par2)
{
	//fixes? game crashing bug
	if (par2 > icons.length)
	{
		par2 = icons.length;
	}
    return icons[par2];
}
 
Example #9
Source File: MoCBlockTallGrass.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IconRegister par1IconRegister)
{
    icons = new Icon[MoCreatures.multiBlockNames.size()];
    
    for (int x = 0; x < MoCreatures.multiBlockNames.size(); x++)
    {
        icons[x] = par1IconRegister.registerIcon("mocreatures:" + "tallGrass_" + MoCreatures.multiBlockNames.get(x));
    }
}
 
Example #10
Source File: BlockEndEye.java    From Ex-Aliquo with MIT License 5 votes vote down vote up
@Override
public Icon getBlockTexture(IBlockAccess world, int x, int y, int z, int side)
{
	if (AliquoTickHandler.tick < 10)
	{
		return icon[eyeBlink()];
	}
	return icon[0];
}
 
Example #11
Source File: MoCBlockLog.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
/**
    * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
    */
@SideOnly(Side.CLIENT)
@Override
   public Icon getIcon(int par1Side, int Metadata)
   {
	if (par1Side < 2)
	{
		return icons[Metadata][0];
	}
	return icons[Metadata][1];
	
   }
 
Example #12
Source File: MoCBlockLog.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
@SideOnly(Side.CLIENT)
@Override
   public void registerIcons(IconRegister par1IconRegister)
   {
	icons = new Icon[MoCreatures.multiBlockNames.size()][2];
       
	for (int x = 0; x < MoCreatures.multiBlockNames.size(); x++)
	{
		icons[x][0] = par1IconRegister.registerIcon("mocreatures:" + "logTop_" + MoCreatures.multiBlockNames.get(x));
		icons[x][1] = par1IconRegister.registerIcon("mocreatures:" + "logSide_" + MoCreatures.multiBlockNames.get(x));
	}
   }
 
Example #13
Source File: MoCBlockRock.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
@SideOnly(Side.CLIENT)
/**
 * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
 */
@Override
public Icon getIcon(int par1, int par2)
{
    return icons[par2];
}
 
Example #14
Source File: MoCBlockRock.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IconRegister par1IconRegister)
{
    icons = new Icon[MoCreatures.multiBlockNames.size()];
    
    for (int x = 0; x < MoCreatures.multiBlockNames.size(); x++)
    {
        icons[x] = par1IconRegister.registerIcon("mocreatures:" + "rock_" + MoCreatures.multiBlockNames.get(x));
    }
    
}
 
Example #15
Source File: AliquoItemOre.java    From Ex-Aliquo with MIT License 5 votes vote down vote up
@Override
public void registerIcons(IconRegister register)
{
	icon = new Icon[3];
	
	for (int i = 0; i < icon.length; i++)
	{
		icon[i] = register.registerIcon("exaliquo:" + Registries.oreType[i] + "/Item" + this.getUnlocalizedName().substring(5) + Registries.oreType[i]);
	}
}
 
Example #16
Source File: ItemStoragePhysical.java    From ExtraCells1 with MIT License 5 votes vote down vote up
@Override
public void registerIcons(IconRegister iconRegister)
{
	this.icons = new Icon[suffixes.length];

	for (int i = 0; i < suffixes.length; ++i)
	{
		this.icons[i] = iconRegister.registerIcon("extracells:" + "storage.physical." + suffixes[i]);
	}
}
 
Example #17
Source File: AliquoOre.java    From Ex-Aliquo with MIT License 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister register)
{
	icon = new Icon[3];
	
	for (int i = 0; i < icon.length; i++)
	{
		icon[i] = register.registerIcon("exaliquo:" + Registries.oreType[i] + "/Block" + this.getUnlocalizedName().substring(5) + Registries.oreType[i]);
	}
}
 
Example #18
Source File: ItemStorageComponent.java    From ExtraCells1 with MIT License 5 votes vote down vote up
@Override
public void registerIcons(IconRegister par1IconRegister)
{
	this.icons = new Icon[suffixes.length];

	for (int i = 0; i < suffixes.length; ++i)
	{
		this.icons[i] = par1IconRegister.registerIcon("extracells:" + "storagecomponent." + suffixes[i]);
	}
}
 
Example #19
Source File: ItemStorageFluid.java    From ExtraCells1 with MIT License 5 votes vote down vote up
@Override
public void registerIcons(IconRegister iconRegister)
{
	this.icons = new Icon[suffixes.length];

	for (int i = 0; i < suffixes.length; ++i)
	{
		this.icons[i] = iconRegister.registerIcon("extracells:" + "storage.fluid." + suffixes[i]);
	}
}
 
Example #20
Source File: WidgetFluidTank.java    From ExtraCells1 with MIT License 5 votes vote down vote up
public void draw(int guiX, int guiY, int mouseX, int mouseY)
{
	if (tank == null || 73 < 31)
		return;

	GL11.glDisable(GL11.GL_LIGHTING);
	GL11.glColor3f(1.0F, 1.0F, 1.0F);

	Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("extracells", "textures/gui/fluidtank.png"));
	drawTexturedModalRect(posX, posY, 0, 0, 18, 73);

	int iconHeightRemainder = (73 - 4) % 16;

	FluidStack fluid = tank.getFluid();
	if (fluid != null && fluid.amount > 0)
	{
		Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);

		Icon fluidIcon = fluid.getFluid().getStillIcon();

		if (iconHeightRemainder > 0)
		{
			drawTexturedModelRectFromIcon(posX + 1, posY + 2, fluidIcon, 16, iconHeightRemainder);
		}
		for (int i = 0; i < (73 - 6) / 16; i++)
		{
			drawTexturedModelRectFromIcon(posX + 1, posY + 2 + i * 16 + iconHeightRemainder, fluidIcon, 16, 16);
		}

		Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("extracells", "textures/gui/fluidtank.png"));
		drawTexturedModalRect(posX + 2, posY + 1, 1, 1, 15, 72 - ((int) ((73) * ((float) fluid.amount / tank.getCapacity()))));
	}

	Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("extracells", "textures/gui/fluidtank.png"));
	drawTexturedModalRect(posX + 1, posY + 1, 19, 1, 16, 73);

	GL11.glEnable(GL11.GL_LIGHTING);
}
 
Example #21
Source File: BlockFluidTransitionPlane.java    From ExtraCells1 with MIT License 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public Icon getBlockTexture(IBlockAccess blockAccess, int x, int y, int z, int side)
{
	TileEntity tileentity = blockAccess.getBlockTileEntity(x, y, z);
	int metadata = blockAccess.getBlockMetadata(x, y, z);

	if (tileentity != null)
	{
		return side == metadata ? frontIcon : side == 0 ? bottomIcon : side == 1 ? topIcon : sideIcon;
	}
	return null;
}
 
Example #22
Source File: BlockMonitorStorageFluid.java    From ExtraCells1 with MIT License 5 votes vote down vote up
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconregister)
{
	frontIcon = iconregister.registerIcon("extracells:fluid.monitor.hotbar");
	sideIcon = iconregister.registerIcon("extracells:machine.side");
	bottomIcon = iconregister.registerIcon("extracells:machine.bottom");
	topIcon = iconregister.registerIcon("extracells:machine.top");
	baseLayer = iconregister.registerIcon("extracells:fluid.monitor.layerbase");
	colorLayers = new Icon[]
	{ iconregister.registerIcon("extracells:fluid.monitor.layer3"), iconregister.registerIcon("extracells:fluid.monitor.layer2"), iconregister.registerIcon("extracells:fluid.monitor.layer1") };
}
 
Example #23
Source File: ModelCertusTank.java    From ExtraCells1 with MIT License 5 votes vote down vote up
public void renderFluid(TileEntity tileEntity, double x, double y, double z, RenderBlocks renderer)
{
	Tessellator tessellator = Tessellator.instance;
	tessellator.setColorOpaque(255, 255, 255);
	if (tileEntity != null && ((TileEntityCertusTank) tileEntity).getTankInfo(ForgeDirection.UNKNOWN)[0].fluid != null)
	{
		Fluid storedFluid = ((TileEntityCertusTank) tileEntity).getRenderFluid();
		float scale = ((TileEntityCertusTank) tileEntity).getRenderScale();
		if (storedFluid != null && scale > 0)
		{
			GL11.glEnable(GL11.GL_BLEND);
			GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
			Block id = Block.blocksList[FluidRegistry.WATER.getBlockID()];
			Icon fluidIcon = storedFluid.getIcon();
			if (fluidIcon == null)
				fluidIcon = FluidRegistry.LAVA.getIcon();
			renderer.setRenderBounds(0.08F, 0.001F, 0.08F, 0.92, scale * 0.999F, 0.92F);
			tessellator.setNormal(0.0F, -1F, 0.0F);
			renderer.renderFaceYNeg(id, x, y, z, fluidIcon);
			tessellator.setNormal(0.0F, 1.0F, 0.0F);
			renderer.renderFaceYPos(id, x, y, z, fluidIcon);
			tessellator.setNormal(0.0F, 0.0F, -1F);
			renderer.renderFaceZNeg(id, x, y, z, fluidIcon);
			tessellator.setNormal(0.0F, 0.0F, 1.0F);
			renderer.renderFaceZPos(id, x, y, z, fluidIcon);
			tessellator.setNormal(-1F, 0.0F, 0.0F);
			renderer.renderFaceXNeg(id, x, y, z, fluidIcon);
			tessellator.setNormal(1.0F, 0.0F, 0.0F);
			renderer.renderFaceXPos(id, x, y, z, fluidIcon);
		}
	}
}
 
Example #24
Source File: BlockMonitorStorageFluid.java    From ExtraCells1 with MIT License 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public Icon getBlockTexture(IBlockAccess blockAccess, int x, int y, int z, int side)
{
	TileEntity tileentity = blockAccess.getBlockTileEntity(x, y, z);
	int metadata = blockAccess.getBlockMetadata(x, y, z);

	if (tileentity != null)
	{
		return side == metadata ? baseLayer : side == 0 ? bottomIcon : side == 1 ? topIcon : sideIcon;
	}
	return null;
}
 
Example #25
Source File: ModelCertusTank.java    From ExtraCells1 with MIT License 5 votes vote down vote up
public void renderInnerBlock(Block block, int x, int y, int z, RenderBlocks renderer, IBlockAccess world)
{
	Tessellator tessellator = Tessellator.instance;
	boolean tankUp = world.getBlockTileEntity(x, y + 1, z) instanceof TileEntityCertusTank;
	boolean tankDown = world.getBlockTileEntity(x, y - 1, z) instanceof TileEntityCertusTank;
	int meta = 0;
	if (tankUp && tankDown)
		meta = 3;
	else if (tankUp)
		meta = 2;
	else if (tankDown)
		meta = 1;
	if (!tankDown)
	{
		tessellator.setNormal(0.0F, -1F, 0.0F);
		renderer.renderFaceYNeg(block, x, y + 0.001D, z, block.getIcon(0, 0));
	}
	if (!(tankUp))
	{
		tessellator.setNormal(0.0F, 1.0F, 0.0F);
		renderer.renderFaceYPos(block, x, y - 0.001D, z, block.getIcon(1, 0));
	}
	Icon sideIcon = block.getIcon(3, meta);
	tessellator.setNormal(0.0F, 0.0F, -1F);
	renderer.renderFaceZNeg(block, x, y, z + 0.001D, sideIcon);
	tessellator.setNormal(0.0F, 0.0F, 1.0F);
	renderer.renderFaceZPos(block, x, y, z - 0.001D, sideIcon);
	tessellator.setNormal(-1F, 0.0F, 0.0F);
	renderer.renderFaceXNeg(block, x + 0.001D, y, z, sideIcon);
	tessellator.setNormal(1.0F, 0.0F, 0.0F);
	renderer.renderFaceXPos(block, x - 0.001D, y, z, sideIcon);

}
 
Example #26
Source File: BlockCertusTank.java    From ExtraCells1 with MIT License 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public Icon getIcon(int side, int b)
{
	//a slight abuse of metadata but it should cause little issue.
	if(b==1)
		return sideTopIcon;
	if(b==2)
		return sideBottomIcon;
	if(b==3)
		return sideMiddleIcon;
	return  side == 0 ? bottomIcon : side == 1 ? topIcon :sideIcon;
}
 
Example #27
Source File: ModelCertusTank.java    From ExtraCells1 with MIT License 5 votes vote down vote up
public void renderOuterBlock(Block block, int x, int y, int z, RenderBlocks renderer, IBlockAccess world)
{

	Tessellator tessellator = Tessellator.instance;
	boolean tankUp = world.getBlockTileEntity(x, y + 1, z) instanceof TileEntityCertusTank;
	boolean tankDown = world.getBlockTileEntity(x, y - 1, z) instanceof TileEntityCertusTank;
	int meta = 0;
	if (tankUp && tankDown)
		meta = 3;
	else if (tankUp)
		meta = 2;
	else if (tankDown)
		meta = 1;
	if (!tankDown)
	{
		tessellator.setNormal(0.0F, -1F, 0.0F);
		renderer.renderFaceYNeg(block, x, y, z, block.getIcon(0, 0));
	}
	if (!(tankUp))
	{
		tessellator.setNormal(0.0F, 1.0F, 0.0F);
		renderer.renderFaceYPos(block, x, y, z, block.getIcon(1, 0));
	}

	Icon sideIcon = block.getIcon(3, meta);
	tessellator.setNormal(0.0F, 0.0F, -1F);
	renderer.renderFaceZNeg(block, x, y, z, sideIcon);
	tessellator.setNormal(0.0F, 0.0F, 1.0F);
	renderer.renderFaceZPos(block, x, y, z, sideIcon);
	tessellator.setNormal(-1F, 0.0F, 0.0F);
	renderer.renderFaceXNeg(block, x, y, z, sideIcon);
	tessellator.setNormal(1.0F, 0.0F, 0.0F);
	renderer.renderFaceXPos(block, x, y, z, sideIcon);

}
 
Example #28
Source File: BlockMEDropper.java    From ExtraCells1 with MIT License 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public Icon getBlockTexture(IBlockAccess blockAccess, int x, int y, int z, int side)
{
	TileEntity tileentity = blockAccess.getBlockTileEntity(x, y, z);
	int metadata = blockAccess.getBlockMetadata(x, y, z);

	if (tileentity != null)
	{
		return side == metadata ? (metadata != 1 && metadata != 0 ? frontHorizontalIcon : frontVerticalIcon) : (metadata != 1 && metadata != 0 ? (side != 1 && side != 0 ? sideIcon : topIcon) : topIcon);
	}
	return null;
}
 
Example #29
Source File: BlockTerminalFluid.java    From ExtraCells1 with MIT License 5 votes vote down vote up
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconregister)
{
	frontIcon = iconregister.registerIcon("extracells:fluid.terminal.hotbar");
	sideIcon = iconregister.registerIcon("extracells:machine.side");
	bottomIcon = iconregister.registerIcon("extracells:machine.bottom");
	topIcon = iconregister.registerIcon("extracells:machine.top");
	baseLayer = iconregister.registerIcon("extracells:fluid.terminal.layerbase");
	colorLayers = new Icon[]
	{ iconregister.registerIcon("extracells:fluid.terminal.layer3"), iconregister.registerIcon("extracells:fluid.terminal.layer2"), iconregister.registerIcon("extracells:fluid.terminal.layer1") };
}
 
Example #30
Source File: BlockTerminalFluid.java    From ExtraCells1 with MIT License 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public Icon getBlockTexture(IBlockAccess blockAccess, int x, int y, int z, int side)
{
	TileEntity tileentity = blockAccess.getBlockTileEntity(x, y, z);
	int metadata = blockAccess.getBlockMetadata(x, y, z);

	if (tileentity != null)
	{
		return side == metadata ? frontIcon : side == 0 ? bottomIcon : side == 1 ? topIcon : sideIcon;
	}
	return null;
}