Java 类net.minecraft.util.IIcon 实例源码

项目:connor41-etfuturum2    文件:LingeringPotionRenderer.java   
private void renderIcon(IIcon icon) {
    Tessellator tessellator = Tessellator.instance;

    float minU = icon.getMinU();
    float maxU = icon.getMaxU();
    float minV = icon.getMinV();
    float maxV = icon.getMaxV();

    OpenGLHelper.rotate(180.0F - renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
    OpenGLHelper.rotate(-renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 1.0F, 0.0F);
    tessellator.addVertexWithUV(-0.5F, -0.25F, 0.0D, minU, maxV);
    tessellator.addVertexWithUV(0.5F, -0.25F, 0.0D, maxU, maxV);
    tessellator.addVertexWithUV(0.5F, 0.75F, 0.0D, maxU, minV);
    tessellator.addVertexWithUV(-0.5F, 0.75F, 0.0D, minU, minV);
    tessellator.draw();
}
项目:StructPro    文件:UItem.java   
/**
 * Resolve item state validity
 * @param meta Item metadata
 * @return Is item state valid
 */
@SuppressWarnings({"ConstantConditions"})
public boolean isValidItemState(int meta) {
    if (!isValid()) {
        return false;
    }
    try {
        IIcon sprite = item.getIconFromDamage(meta);
        return sprite != null &&
                sprite.getIconName() != null &&
                !sprite.getIconName().equalsIgnoreCase("") &&
                !sprite.getIconName().equalsIgnoreCase("missingno");
    } catch (Throwable ignored) {
        return false;
    }
}
项目:DataDumper    文件:Data.java   
private static String getTextures(Block block, int damage) {
    List<String> allTextures = new ArrayList<String>();
    String[] sides = new String[]{"top", "bottom", "north", "south", "east", "west"};
    for (int index = 0; index < sides.length; index++) {
        try {
            IIcon icon = block.getIcon(index, damage);
            if (icon != null) {
                allTextures.add(icon.getIconName());
            }
        } catch (Exception e) {
            System.out.println(String.format("Unable to get texture for block %s side %s",
                    block.getLocalizedName(), index));
            allTextures.add("EXCEPTION");
        }
    }
    if (allTextures.isEmpty()) {
        return "empty";
    }
    return String.join(",", allTextures);
}
项目:ExtraE    文件:Collector.java   
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta)
{
    if (meta == 0 && side == 3) 
    {
        return front;
    }

    if (side == 1) 
    {
        return top;
    }

    return side != meta ? this.blockIcon : front;
}
项目:4Space-5    文件:LiquidTextures.java   
@SubscribeEvent
public void postStitch(TextureStitchEvent.Post event)
{
    IIcon[] icons;
    if(replaceLava)
    {
        icons = ReflectionManager.get(field_tex, IIcon[].class, Blocks.flowing_lava);
        icons[0] = newTextures[2];
        icons[1] = newTextures[3];
        icons = ReflectionManager.get(field_tex, IIcon[].class, Blocks.lava);
        icons[0] = newTextures[2];
        icons[1] = newTextures[3];
    }
    if(replaceWater)
    {
        icons = ReflectionManager.get(field_tex, IIcon[].class, Blocks.flowing_water);
        icons[0] = newTextures[0];
        icons[1] = newTextures[1];
        icons = ReflectionManager.get(field_tex, IIcon[].class, Blocks.water);
        icons[0] = newTextures[0];
        icons[1] = newTextures[1];
    }
}
项目:PopularMMOS-EpicProportions-Mod    文件:BlockJenCraftingTable.java   
@SideOnly(Side.CLIENT)
@Override
public IIcon getIcon(int i, int par2) {

    if (i == 0)
        return gor;

    else if (i == 1)
        return dol;

    else if (i == 2)
        return st1;

    else if (i == 3)
        return st2;

    else if (i == 4)
        return st4;

    else if (i == 5)
        return st3;

    else
        return gor;

}
项目:4Space-5    文件:EntityDigIconFX.java   
public static void addBlockHitEffects(World world, Cuboid6 bounds, int side, IIcon icon, EffectRenderer effectRenderer)
{
    float border = 0.1F;
    Vector3 diff = bounds.max.copy().subtract(bounds.min).add(-2*border);
    diff.x*=world.rand.nextDouble();
    diff.y*=world.rand.nextDouble();
    diff.z*=world.rand.nextDouble();
    Vector3 pos = diff.add(bounds.min).add(border);

    if (side == 0)
        diff.y = bounds.min.y - border;
    if (side == 1)
        diff.y = bounds.max.y + border;
    if (side == 2)
        diff.z = bounds.min.z - border;
    if (side == 3)
        diff.z = bounds.max.z + border;
    if (side == 4)
        diff.x = bounds.min.x - border;
    if (side == 5)
        diff.x = bounds.max.x + border;

    effectRenderer.addEffect(
            new EntityDigIconFX(world, pos.x, pos.y, pos.z, 0, 0, 0, icon)
                .multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F));
}
项目:ExtraUtilities    文件:TConEvents.java   
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void handleStich(final TextureStitchEvent.Pre event) {
    if (event.map.getTextureType() != 0) {
        return;
    }
    TConIntegration.bedrock.setIcons(event.map.registerIcon("TConIntegration.bedrock"));
    TextureAtlasSprite sprite = new TextureBedrockLava("extrautils:bedrockFluid", "lava_still");
    event.map.setTextureEntry("extrautils:bedrockFluid", sprite);
    if (TConIntegration.bedrock != null) {
        TConIntegration.bedrock.setIcons((IIcon)sprite);
    }
    sprite = new TextureBedrockLava("extrautils:bedrockFluid_flowing", "lava_flow");
    if (event.map.setTextureEntry("extrautils:bedrockFluid_flowing", sprite) && TConIntegration.bedrock != null) {
        TConIntegration.bedrock.setFlowingIcon((IIcon)sprite);
    }
    sprite = new TextureUnstableLava("extrautils:unstableFluid", "water_still");
    event.map.setTextureEntry("extrautils:unstableFluid", sprite);
    if (TConIntegration.unstable != null) {
        TConIntegration.unstable.setIcons((IIcon)sprite);
    }
    sprite = new TextureUnstableLava("extrautils:unstableFluid_flowing", "water_flow");
    if (event.map.setTextureEntry("extrautils:unstableFluid_flowing", sprite) && TConIntegration.unstable != null) {
        TConIntegration.unstable.setFlowingIcon((IIcon)sprite);
    }
}
项目:4Space-5    文件:BlockAirLockFrame.java   
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int par1, int par2)
{
    if (par2 >= BlockAirLockFrame.METADATA_AIR_LOCK_CONTROLLER)
    {
        if (par1 == ForgeDirection.UP.ordinal() || par1 == ForgeDirection.DOWN.ordinal())
        {
            return this.airLockIcons[0];
        }

        return this.airLockIcons[7];
    }
    else
    {
        return this.airLockIcons[0];
    }
}
项目:PAYDAY    文件:LobbyBlock.java   
@Override
public IIcon getIcon(int side, int meta) {
    switch (meta) {
    case 1:
        return OnePlayerIcon;
    case 2:
        return TwoPlayersIcon;
    case 3:
        return ThreePlayersIcon;
    case 4:
        return FourPlayersIcon;
    default:
        return LobbyIcon;
    }
}
项目:Steam-and-Steel    文件:Utils.java   
public static void renderInventoryBlock(RenderBlocks renderblocks, Block block, IIcon icon) {

    Tessellator tessellator = Tessellator.instance;
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, -1F, 0.0F);
    renderblocks.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, getValidIIcon(icon));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 1.0F, 0.0F);
    renderblocks.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, getValidIIcon(icon));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, -1F);
    renderblocks.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, getValidIIcon(icon));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, 1.0F);
    renderblocks.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, getValidIIcon(icon));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(-1F, 0.0F, 0.0F);
    renderblocks.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, getValidIIcon(icon));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(1.0F, 0.0F, 0.0F);
    renderblocks.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, getValidIIcon(icon));
    tessellator.draw();
    GL11.glTranslatef(0.5F, 0.5F, 0.5F);

}
项目:connor41-etfuturum2    文件:PrismarineBlocks.java   
@SideOnly(Side.CLIENT)
public void setIcon(int index, IIcon icon) {
    if (icons == null)
        icons = new IIcon[types.length];

    icons[index] = icon;
}
项目:connor41-etfuturum2    文件:PrismarineBlocks.java   
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister reg) {
    if (icons == null)
        icons = new IIcon[types.length];

    for (int i = 1; i < types.length; i++)
        if ("".equals(types[i]))
            icons[i] = reg.registerIcon(getTextureName());
        else
            icons[i] = reg.registerIcon(getTextureName() + "_" + types[i]);
}
项目:connor41-etfuturum2    文件:BlockGeneric.java   
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister reg) {
    icons = new IIcon[types.length];
    for (int i = 0; i < types.length; i++)
        if ("".equals(types[i]))
            icons[i] = reg.registerIcon(getTextureName());
        else
            icons[i] = reg.registerIcon(getTextureName() + "_" + types[i]);
}
项目:connor41-etfuturum2    文件:FrostedIce.java   
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) {
    if (meta < 0 || meta >= icons.length)
        meta = 0;
    return icons[meta];
}
项目:connor41-etfuturum2    文件:FrostedIce.java   
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister reg) {
    icons = new IIcon[4];
    for (int i = 0; i < icons.length; i++)
        icons[i] = reg.registerIcon(getTextureName() + "_" + i);
}
项目:connor41-etfuturum2    文件:BlockBeetroot.java   
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) {
    if (meta < 7) {
        if (meta == 6)
            meta = 5;
        return icons[meta >> 1];
    } else
        return icons[3];
}
项目:connor41-etfuturum2    文件:BlockBeetroot.java   
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister reg) {
    icons = new IIcon[4];
    for (int i = 0; i < icons.length; i++)
        icons[i] = reg.registerIcon(getTextureName() + "_stage_" + i);
}
项目:connor41-etfuturum2    文件:LingeringPotionRenderer.java   
@Override
public void doRender(Entity entity, double x, double y, double z, float p_76986_8_, float p_76986_9_) {
    if (!(entity instanceof EntityLingeringPotion))
        return;

    ItemStack stack = ((EntityLingeringPotion) entity).getStack();
    if (stack == null || stack.getItem() == null)
        return;

    int passes;
    if (stack.getItem().requiresMultipleRenderPasses())
        passes = stack.getItem().getRenderPasses(0);
    else
        passes = 1;

    OpenGLHelper.pushMatrix();
    OpenGLHelper.translate(x, y, z);
    OpenGLHelper.enableRescaleNormal();
    OpenGLHelper.scale(0.5F, 0.5F, 0.5F);
    bindEntityTexture(entity);

    for (int pass = 0; pass < passes; pass++) {
        IIcon icon = stack.getItem().getIcon(stack, pass);

        if (icon != null) {
            OpenGLHelper.pushMatrix();
            OpenGLHelper.colour(stack.getItem().getColorFromItemStack(stack, pass));
            renderIcon(icon);
            OpenGLHelper.popMatrix();
        }
    }

    OpenGLHelper.colour(1, 1, 1);
    OpenGLHelper.disableRescaleNormal();
    OpenGLHelper.popMatrix();
}
项目:connor41-etfuturum2    文件:ItemGeneric.java   
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister reg) {
    icons = new IIcon[types.length];
    for (int i = 0; i < types.length; i++)
        icons[i] = reg.registerIcon(getIconString() + "_" + types[i]);
}
项目:minecraft-quiverbow    文件:LapisMagazine.java   
@Override
  public IIcon getIconFromDamage(int meta) 
  {
if (meta == this.getMaxDamage()) { return this.Icon_Empty; }

else if (meta >= 125) { return this.Icon_1; }   // Indicating fill status based on the number of blocks in here
else if (meta >= 100) { return this.Icon_2; }
else if (meta >= 75) { return this.Icon_3; }
else if (meta >= 50) { return this.Icon_4; }
else if (meta >= 25) { return this.Icon_5; }

return this.Icon_6;
  }
项目:minecraft-quiverbow    文件:GoldMagazine.java   
@Override
  public IIcon getIconFromDamage(int meta) 
  {
if (meta == this.getMaxDamage()) { return Icon_Empty; }

return Icon;
  }
项目:minecraft-quiverbow    文件:NeedleMagazine.java   
@Override
  public IIcon getIconFromDamage(int meta) 
  {
if (meta == this.getMaxDamage()) { return Icon_Empty; }

return Icon;
  }
项目:minecraft-quiverbow    文件:EnderQuartzClip.java   
@Override
  public IIcon getIconFromDamage(int meta) 
  {
if (meta == this.getMaxDamage()) { return Icon_Empty; }

return Icon;
  }
项目:minecraft-quiverbow    文件:GatlingAmmo.java   
@Override
public IIcon getIcon(ItemStack stack, int pass) // This is for on-hand display. The difference may be useful later
{
    if (stack.getItemDamage() == this.getMaxDamage()) { return Icon_Empty; }

    return Icon;
}
项目:minecraft-quiverbow    文件:GatlingAmmo.java   
@Override
  public IIcon getIconFromDamage(int meta) 
  {
if (meta == this.getMaxDamage()) { return Icon_Empty; }

return Icon;
  }
项目:minecraft-quiverbow    文件:SeedJar.java   
@Override
public IIcon getIcon(ItemStack stack, int pass) // This is for on-hand display. The difference may be useful later
{
    if (stack.getItemDamage() == this.getMaxDamage()) { return Icon_Empty; }

    return Icon;
}
项目:minecraft-quiverbow    文件:SeedJar.java   
@Override
  public IIcon getIconFromDamage(int meta) 
  {
if (meta == this.getMaxDamage()) { return Icon_Empty; }

return Icon;
  }
项目:minecraft-quiverbow    文件:ObsidianMagazine.java   
@Override
  public IIcon getIconFromDamage(int meta) 
  {
if (meta == this.getMaxDamage()) { return Icon_Empty; }

return Icon;
  }
项目:minecraft-quiverbow    文件:Crossbow_Double.java   
@Override
public IIcon getIcon(ItemStack stack, int pass)
{
    if (this.getDamage(stack) >= this.getMaxDamage()) { return this.Icon_Empty; }   // Empty
    if (this.getDamage(stack) == 1) { return this.Icon_Half; }                      // One arrow on the bay

    return this.Icon;
}
项目:minecraft-quiverbow    文件:Crossbow_Double.java   
@Override
public IIcon getIconFromDamage(int meta)    // This is for inventory display. Comes in with metadata. Only gets called on client side
{
    if (meta == this.getMaxDamage()) { return this.Icon_Empty; }    // Empty
    if (meta == 1) { return this.Icon_Half; }

    return this.Icon;   // Full, default
}
项目:minecraft-quiverbow    文件:Crossbow_AutoImp.java   
@Override
public IIcon getIcon(ItemStack stack, int pass) // Onhand display
{
    if (this.getDamage(stack) >= this.getMaxDamage()) { return this.Icon_Empty; }

    return this.Icon;
}
项目:minecraft-quiverbow    文件:EnderBow.java   
@Override
   public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) 
{
    if(player.getItemInUse() == null) { return this.itemIcon; }

        int Pulling = stack.getMaxItemUseDuration() - useRemaining; // Displaying the bow drawing animation based on the use state

        if (Pulling >= 18) { return this.pull_2; }
        else if (Pulling > 13) { return this.pull_1; }
        else if (Pulling > 0) { return this.pull_0; }              

        return itemIcon;
   }
项目:minecraft-quiverbow    文件:EnderBow.java   
@SideOnly(Side.CLIENT)
   public IIcon getItemIconForUseDuration(int state) // Inventory display
{ 
    if (state == 0) { return this.pull_0; }
    else if (state == 1) { return this.pull_1; }
    else if (state == 2) { return this.pull_2; }

    return this.pull_2; // Fallback
}
项目:minecraft-quiverbow    文件:QuiverBow.java   
@SideOnly(Side.CLIENT)
public IIcon getItemIconForUseDuration(int state) // Inventory display
{
    if (state == 0) { return this.pull_0; }
    else if (state == 1) { return this.pull_1; }
    else if (state == 2) { return this.pull_2; }

    return this.pull_2; // Fallback
}
项目:minecraft-quiverbow    文件:QuiverBow.java   
@Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)   // On hand display
{
    if(player.getItemInUse() == null) { return this.itemIcon; }

    int Pulling = stack.getMaxItemUseDuration() - useRemaining; // Displaying the bow drawing animation based on the use state

    if (Pulling >= 18) { return this.pull_2; }
    else if (Pulling > 13) { return this.pull_1; }
    else if (Pulling > 0) { return this.pull_0; }

    return this.itemIcon;
}
项目:minecraft-quiverbow    文件:_WeaponBase.java   
@Override
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage(int meta)    // This is for inventory display. Comes in with metadata. Only gets called on client side
{
    if (meta == this.getMaxDamage()) { return this.Icon_Empty; }    // Empty
    return this.Icon;   // Full, default
}
项目:minecraft-quiverbow    文件:Crossbow_Auto.java   
@Override
public IIcon getIcon(ItemStack stack, int pass) // Onhand display
{
    if (this.getDamage(stack) >= this.getMaxDamage()) { return this.Icon_Empty; }
    if (!this.getChambered(stack)) { return this.Icon_Unchambered; }    // Not chambered

    return this.Icon;
}
项目:TFCPrimitiveTech    文件:ItemSlingshot.java   
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister)
{
    this.itemIcon = par1IconRegister.registerIcon(ModDetails.ModID + ":" + "ItemSlingshot" + "_standby");
    iconArray = new IIcon[slingshotPullIconNameArray.length];

    for (int i = 0; i < iconArray.length; ++i)
        iconArray[i] = par1IconRegister.registerIcon(ModDetails.ModID + ":" + "ItemSlingshot" + "_" + slingshotPullIconNameArray[i]);

}
项目:TFCPrimitiveTech    文件:ItemSlingshot.java   
@Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
{
       if (usingItem != null && usingItem.getItem() == this)
       {
           int j = usingItem.getMaxItemUseDuration() - useRemaining;
           float force = j / getUseSpeed(player);

        if (force >= 1.25) // Fully drawn
           {
            return getItemIconForUseDuration(3);
        }
        else if (force > 0.75)
           {
            return getItemIconForUseDuration(2);
           }
        else if (force > 0.25) // Minimum required force to fire
           {
               return getItemIconForUseDuration(1);
           }
        else if (force > 0)
           {
               return getItemIconForUseDuration(0);
           }
       }
       return getIcon(stack, renderPass);
}