Java 类net.minecraft.item.ItemPotion 实例源码

项目:bit-client    文件:ItemUtil.java   
public static boolean isHealthPot(ItemStack item) {
    try {
        if (item == null) return false;
        Item pot = getItemFromStack(item);
        if (pot == null) return false;
        ItemPotion potion = (ItemPotion) pot;
        if (potion != null && potion.func_77832_l(item) != null) {
            for (Object obj : potion.func_77832_l(item)) {
                if (obj == null || !(obj instanceof PotionEffect)) continue;
                PotionEffect effect = (PotionEffect) obj;
                if ((effect.func_76456_a() == Potion.field_76432_h.func_76396_c()) && ItemPotion.func_77831_g((Integer) ReflectionUtil.getFieldValue("field_77991_e", item)))
                    return true;
            }
        }
        return false;
    } catch (Exception e) {
        return false;
    }
}
项目:BaseClient    文件:AutoPot.java   
private int getPotionFromInventory() {
    int pot = -1;
    int counter = 0;
    int i = 1;
    while (i < 45) {
        ItemStack is;
        ItemPotion potion;
        Item item;
        if (this.mc.thePlayer.inventoryContainer.getSlot(i).getHasStack() && (item = (is = this.mc.thePlayer.inventoryContainer.getSlot(i).getStack()).getItem()) instanceof ItemPotion && (potion = (ItemPotion)item).getEffects(is) != null) {
            for (Object o : potion.getEffects(is)) {
                PotionEffect effect = (PotionEffect)o;
                if (effect.getPotionID() != Potion.heal.id || !ItemPotion.isSplash((int)is.getItemDamage())) continue;
                ++counter;
                pot = i;
            }
        }
        ++i;
    }
    Character colorFormatCharacter = new Character('\u00a7');
    this.suffix = OptionManager.getOption((String)"Hyphen", (Module)ModuleManager.getModule(HUD.class)).value ? colorFormatCharacter + "7 - " + counter : colorFormatCharacter + "7 " + counter;
    return pot;
}
项目:EMC    文件:IItem.java   
public boolean instanceOf(IItemType type) {
    if (type.equals(IItemType.ItemFishingRod)) {
        return item instanceof ItemFishingRod;
    } else if (type.equals(IItemType.ItemPotion)) {
        return item instanceof ItemPotion;
    } else if (type.equals(IItemType.ItemFood)) {
        return item instanceof ItemFood;
    } else if (type.equals(IItemType.ItemSword)) {
        return item instanceof ItemSword;
    } else if (type.equals(IItemType.ItemTool)) {
        return item instanceof ItemTool;
    } else if (type.equals(IItemType.ItemNameTag)) {
        return item instanceof ItemNameTag;
    } else if (type.equals(IItemType.ItemBlock)) {
        return item instanceof ItemBlock;
    } else if (type.equals(IItemType.ItemHoe)) {
        return item instanceof ItemHoe;
    }
    return false;
}
项目:EnderCore    文件:Util.java   
public static ItemStack consumeItem(ItemStack stack) {
  if (stack.getItem() instanceof ItemPotion) {
    if (stack.stackSize == 1) {
      return new ItemStack(Items.glass_bottle);
    } else {
      stack.splitStack(1);
      return stack;
    }
  }
  if (stack.stackSize == 1) {
    if (stack.getItem().hasContainerItem(stack)) {
      return stack.getItem().getContainerItem(stack);
    } else {
      return null;
    }
  } else {
    stack.splitStack(1);
    return stack;
  }
}
项目:OldMods    文件:CondensedPotionRecipes.java   
/**
 * Returns an Item that is the result of this recipe
 */
public ItemStack getCraftingResult( InventoryCrafting inv )
{
    ItemStack item = doCheck( inv );
    if ( item == null )
    {
        return null;
    }

    int id = ItemPotion.isSplash( item.getItemDamage() ) ? CondensedPotions.condensedSplashItem.itemID : CondensedPotions.condensedNormalItem.itemID;
    ItemStack pot = new ItemStack( id, 1, 1 );

    NBTTagCompound potTag = new NBTTagCompound();
    item.writeToNBT( potTag );

    NBTTagCompound comp = new NBTTagCompound();
    comp.setTag( "Potion", potTag );
    pot.setTagCompound( comp );

    return pot;
}
项目:OldMods    文件:CondensedPotionRecipes.java   
private ItemStack doCheck( InventoryCrafting inv )
{
    ItemStack item = null;
    int count = 0;

    for ( int i = 0; i < inv.getSizeInventory(); ++i, ++count )
    {
        ItemStack stack = inv.getStackInSlot( i );
        if ( stack == null )
        {
            return null;
        }

        if ( item == null )
        {
            item = stack;
        }
        else if ( stack.itemID != item.itemID || stack.getItemDamage() != item.getItemDamage() || !check( stack.getTagCompound(), item.getTagCompound() ) )
        {
            return null;
        }
    }

    return ( count >= 9 && ( item.getItem() instanceof ItemPotion ) ) ? item : null;
}
项目:InventoryTools    文件:ToolBoxRegistry.java   
public final static boolean addToWhiteList(String id){
    String[] parts = id.split(":", 4);
    if(parts.length < 1)
        return false;
    ItemStack stack = GameRegistry.findItemStack(parts.length==1 ? "minecraft" : parts[0], parts.length==1 ? parts[0] : parts[1], 1);
    if(stack == null)
        return false;
    if((stack.getItem() instanceof ItemBlock) || (stack.getItem() instanceof ItemPotion) || (stack.getItem() instanceof ItemArmor) || (stack.getItem() instanceof ItemBucket))
        return false;
    int meta=OreDictionary.WILDCARD_VALUE;
    if(parts.length >= 3){
        try{
            meta=Integer.parseInt(parts[2]);
        }catch(NumberFormatException e){
            meta=OreDictionary.WILDCARD_VALUE;
        }
    }
    return addToWhiteList(new ItemData(stack.getItem(), meta));
}
项目:OpenPeripheral-Integration    文件:ItemPotionMetaProvider.java   
@Override
public Object getMeta(ItemPotion target, ItemStack stack) {
    final Map<String, Object> results = Maps.newHashMap();

    results.put("splash", ItemPotion.isSplash(stack.getItemDamage()));

    final List<Map<String, Object>> effectsInfo = Lists.newArrayList();

    @SuppressWarnings("unchecked")
    final List<PotionEffect> effects = target.getEffects(stack);
    if (effects != null) {
        for (PotionEffect effect : effects) {
            final Map<String, Object> entry = Maps.newHashMap();

            entry.put("duration", effect.getDuration() / 20); // ticks!
            entry.put("amplifier", effect.getAmplifier());
            entry.put("effect", getPotionInfo(effect.getPotionID()));

            effectsInfo.add(entry);
        }
    }

    results.put("effects", effectsInfo);

    return results;
}
项目:MyMod    文件:ItemAmmo.java   
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list,
                           boolean par4) {
    super.addInformation(stack, player, list, par4);
    list.add(StatCollector.translateToLocal("lore.ammo"));

    ItemPotion p = new ItemPotion();

    if (NBTUtil.hasNBT(stack)) {
        list.add("");

        HashMap<EnumModifierType, Integer> modifiers = readFromNBT(stack
                .getTagCompound());

        for (EnumModifierType modifier : modifiers.keySet()) {
            list.add(modifiers.get(modifier) + "x "
                    + modifier.getItemStack().getDisplayName());
        }
    }

}
项目:Corruption    文件:WaterAllergyCorruption.java   
@Override
public void onUpdate(EntityPlayer player, Side side) {
    if (side == Side.SERVER) {
        if (player.worldObj.getTotalWorldTime() % 10 == 0) {
            if (player.isInWater() || (player.worldObj.isRaining() && player.worldObj.canBlockSeeTheSky((int) player.posX, (int) player.posY, (int) player.posZ))) {
                player.attackEntityFrom(DamageSource.drown, 1);
                this.playerCount.add(player.getCommandSenderName(), 10);
            }
            if (player.getCurrentEquippedItem() != null && (player.getCurrentEquippedItem().getItem() instanceof ItemPotion || player.getCurrentEquippedItem().getItem() == Items.water_bucket)) {
                player.dropOneItem(true);
                player.attackEntityFrom(DamageSource.drown, 1);
                this.playerCount.add(player.getCommandSenderName(), 10);
                player.addChatComponentMessage(new ChatComponentText("The condensation from the bottle burns your hands, causing you to drop it.").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.AQUA)));
            }
        }
        this.playerCount.add(player.getCommandSenderName());
    }
}
项目:RuneCraftery    文件:RenderSnowball.java   
public void func_76986_a(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) {
   Icon var10 = this.field_94151_a.func_77617_a(this.field_94150_f);
   if(var10 != null) {
      GL11.glPushMatrix();
      GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_);
      GL11.glEnable('\u803a');
      GL11.glScalef(0.5F, 0.5F, 0.5F);
      this.func_110777_b(p_76986_1_);
      Tessellator var11 = Tessellator.field_78398_a;
      if(var10 == ItemPotion.func_94589_d("bottle_splash")) {
         int var12 = PotionHelper.func_77915_a(((EntityPotion)p_76986_1_).func_70196_i(), false);
         float var13 = (float)(var12 >> 16 & 255) / 255.0F;
         float var14 = (float)(var12 >> 8 & 255) / 255.0F;
         float var15 = (float)(var12 & 255) / 255.0F;
         GL11.glColor3f(var13, var14, var15);
         GL11.glPushMatrix();
         this.func_77026_a(var11, ItemPotion.func_94589_d("overlay"));
         GL11.glPopMatrix();
         GL11.glColor3f(1.0F, 1.0F, 1.0F);
      }

      this.func_77026_a(var11, var10);
      GL11.glDisable('\u803a');
      GL11.glPopMatrix();
   }
}
项目:IceAndShadow2    文件:NyxEventHandlerCold.java   
@SubscribeEvent
public void onTryToPotion(PlayerUseItemEvent.Start e) {
    if (e.entity.dimension == IaSFlags.dim_nyx_id && !e.entityPlayer.capabilities.isCreativeMode) {
        final ItemStack ite = e.item;
        boolean stopped = false;
        if (ite == null)
            return;
        else if (ite.getItem() instanceof ItemPotion) {
            IaSPlayerHelper.messagePlayer(e.entityPlayer, "The contents of the bottle have frozen solid.");
            stopped = true;
        } else if (ite.getItem() == Items.milk_bucket) {
            IaSPlayerHelper.messagePlayer(e.entityPlayer, "The milk has frozen solid.");
            stopped = true;
        } else if (ite.getItem() instanceof ItemFood && !(ite.getItem() instanceof IaSItemFood)) {
            IaSPlayerHelper.messagePlayer(e.entityPlayer,
                    "It's been frozen solid. Eating it would be dangerous.");
            stopped = true;
        }
        if(stopped) {
            e.setCanceled(true);
            e.entityPlayer.stopUsingItem();
        }
    }
}
项目:connor41-etfuturum2    文件:ContainerNewBrewingStand.java   
@Override
public void onPickupFromSlot(EntityPlayer player, ItemStack stack) {
    if (stack.getItem() instanceof ItemPotion && stack.getItemDamage() > 0)
        player.addStat(AchievementList.potion, 1);

    super.onPickupFromSlot(player, stack);
}
项目:connor41-etfuturum2    文件:TileEntityNewBrewingStand.java   
private boolean canBrew() {
    if (fuel > 0 && inventory[3] != null && inventory[3].stackSize > 0) {
        ItemStack itemstack = inventory[3];

        if (!itemstack.getItem().isPotionIngredient(itemstack))
            return false;
        else if (itemstack.getItem() == ModItems.dragon_breath) {
            for (int i = 0; i < 3; i++)
                if (inventory[i] != null && inventory[i].getItem() == Items.potionitem)
                    if (ItemPotion.isSplash(inventory[i].getItemDamage()))
                        return true;
            return false;
        } else {
            boolean flag = false;

            for (int i = 0; i < 3; i++)
                if (inventory[i] != null && inventory[i].getItem() instanceof ItemPotion) {
                    int j = inventory[i].getItemDamage();
                    int k = applyIngredient(j, itemstack);

                    if (!ItemPotion.isSplash(j) && ItemPotion.isSplash(k)) {
                        flag = true;
                        break;
                    }

                    List<?> list = Items.potionitem.getEffects(j);
                    List<?> list1 = Items.potionitem.getEffects(k);

                    if ((j <= 0 || list != list1) && (list == null || !list.equals(list1) && list1 != null) && j != k) {
                        flag = true;
                        break;
                    }
                }

            return flag;
        }
    } else
        return false;
}
项目:connor41-etfuturum2    文件:TileEntityNewBrewingStand.java   
private void brewPotions() {
    if (ForgeEventFactory.onPotionAttemptBreaw(new ItemStack[] { inventory[0], inventory[1], inventory[2], inventory[3] }))
        return;
    if (canBrew()) {
        for (int i = 0; i < 3; i++)
            if (inventory[i] != null && inventory[i].getItem() instanceof ItemPotion) {
                int j = inventory[i].getItemDamage();
                if (ItemPotion.isSplash(j) && inventory[3].getItem() == ModItems.dragon_breath)
                    inventory[i] = new ItemStack(ModItems.lingering_potion, inventory[i].stackSize, inventory[i].getItemDamage());
                else {
                    int k = applyIngredient(j, inventory[3]);
                    List<?> list = Items.potionitem.getEffects(j);
                    List<?> list1 = Items.potionitem.getEffects(k);

                    if ((j <= 0 || list != list1) && (list == null || !list.equals(list1) && list1 != null)) {
                        if (j != k)
                            inventory[i].setItemDamage(k);
                    } else if (!ItemPotion.isSplash(j) && ItemPotion.isSplash(k))
                        inventory[i].setItemDamage(k);
                }
            }

        boolean hasContainerItem = inventory[3].getItem().hasContainerItem(inventory[3]);
        if (--inventory[3].stackSize <= 0)
            inventory[3] = hasContainerItem ? inventory[3].getItem().getContainerItem(inventory[3]) : null;
        else if (hasContainerItem && !worldObj.isRemote) {
            float f = 0.7F;
            double x = worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5D;
            double y = worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5D;
            double z = worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5D;
            EntityItem entityitem = new EntityItem(worldObj, xCoord + x, yCoord + y, zCoord + z, inventory[3].getItem().getContainerItem(inventory[3]));
            entityitem.delayBeforeCanPickup = 10;
            worldObj.spawnEntityInWorld(entityitem);
        }

        fuel--;
        ForgeEventFactory.onPotionBrewed(new ItemStack[] { inventory[0], inventory[1], inventory[2], inventory[3] });
        worldObj.playSound(xCoord, yCoord, zCoord, Reference.MOD_ID + ":block.brewing_stand.brew", 1.0F, 1.0F, true);
    }
}
项目:connor41-etfuturum2    文件:TileEntityNewBrewingStand.java   
@Override
public boolean isItemValidForSlot(int slot, ItemStack stack) {
    if (slot == 4)
        return stack.getItem() == Items.blaze_powder;
    else if (slot == 3)
        return stack.getItem().isPotionIngredient(stack);
    else
        return stack.getItem() instanceof ItemPotion || stack.getItem() == Items.glass_bottle;
}
项目:IceMod    文件:RenderHunkOIce.java   
/**
 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
 * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
 * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
 */
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
    Icon icon = this.field_94151_a.getIconFromDamage(this.field_94150_f);

    if (icon != null)
    {
        GL11.glPushMatrix();
        GL11.glTranslatef((float)par2, (float)par4, (float)par6);
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        GL11.glScalef(0.5F, 0.5F, 0.5F);
        this.bindEntityTexture(par1Entity);
        Tessellator tessellator = Tessellator.instance;

        if (icon == ItemPotion.func_94589_d("bottle_splash"))
        {
            int i = PotionHelper.func_77915_a(((EntityPotion)par1Entity).getPotionDamage(), false);
            float f2 = (float)(i >> 16 & 255) / 255.0F;
            float f3 = (float)(i >> 8 & 255) / 255.0F;
            float f4 = (float)(i & 255) / 255.0F;
            GL11.glColor3f(f2, f3, f4);
            GL11.glPushMatrix();
            this.func_77026_a(tessellator, ItemPotion.func_94589_d("overlay"));
            GL11.glPopMatrix();
            GL11.glColor3f(1.0F, 1.0F, 1.0F);
        }

        this.func_77026_a(tessellator, icon);
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
    }
}
项目:Alchemy    文件:RTooltip.java   
@SubscribeEvent(priority = EventPriority.BOTTOM)
public static void onItemTooltip(ItemTooltipEvent event) {
    if (enable_tooltip_debug) {
        ItemStack stack = event.getItemStack();
        Item item = stack.getItem();
        if (item instanceof ItemFood)
            event.getToolTip().add("Food: " + ((ItemFood) item).getHealAmount(stack) + ", " +
                    ((ItemFood) item).getSaturationModifier(stack));
        if (item instanceof IItemThirst)
            event.getToolTip().add("Thirst: " + ((IItemThirst) item).getThirst(stack) + ", " + 
                    ((IItemThirst) item).getHydration(stack));
        else if (IItemThirst.callback != null)
            IItemThirst.callback.accept(event);
        if (item instanceof ItemFood && ((ItemFood) item).potionId != null)
            event.getToolTip().add("Effect: " + ((ItemFood) item).potionId + ", " + ((ItemFood) item).potionEffectProbability);
        if (item instanceof IItemPotion && !((IItemPotion) item).getEffects(stack).isEmpty())
            event.getToolTip().add("Effect: " +
                    Joiner.on("\n    ").appendTo(new StringBuilder("\n    "), ((IItemPotion) item).getEffects(stack)).toString());
        else if (IItemPotion.callback != null)
            IItemPotion.callback.accept(event);
        if (item instanceof ItemPotion) {
            List<PotionEffect> effects = PotionUtils.getEffectsFromStack(stack);
            if (!effects.isEmpty())
                event.getToolTip().add("Effect: " +
                        Joiner.on("\n    ").appendTo(new StringBuilder(effects.size() > 1 ? "\n    " : ""), effects).toString());
        }
        for (int id : OreDictionary.getOreIDs(stack))
            event.getToolTip().add(OreDictionary.getOreName(id));
        event.getToolTip().add(item.getClass().getName());
        addNBTToTooltip(stack.serializeNBT(), event.getToolTip(), 1);
        if (GuiScreen.isCtrlKeyDown() && isKeyDown(KEY_C))
            GuiScreen.setClipboardString(GuiScreen.isShiftKeyDown() ? Joiner.on('\n').join(event.getToolTip()) :
                item.getRegistryName().toString());
    }
}
项目:PopularMMOS-EpicProportions-Mod    文件:RenderGiantSnowBall.java   
/**
 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
 * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
 * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
 */
public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
    IIcon iicon = this.field_94151_a.getIconFromDamage(this.field_94150_f);

    if (iicon != null)
    {
        GL11.glPushMatrix();
        GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_);
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        GL11.glScalef(0.5F, 0.5F, 0.5F);
        this.bindEntityTexture(p_76986_1_);
        Tessellator tessellator = Tessellator.instance;

        if (iicon == ItemPotion.func_94589_d("bottle_splash"))
        {
            int i = PotionHelper.func_77915_a(((EntityPotion)p_76986_1_).getPotionDamage(), false);
            float f2 = (float)(i >> 16 & 255) / 255.0F;
            float f3 = (float)(i >> 8 & 255) / 255.0F;
            float f4 = (float)(i & 255) / 255.0F;
            GL11.glColor3f(f2, f3, f4);
            GL11.glPushMatrix();
            this.func_77026_a(tessellator, ItemPotion.func_94589_d("overlay"));
            GL11.glPopMatrix();
            GL11.glColor3f(1.0F, 1.0F, 1.0F);
        }

        this.func_77026_a(tessellator, iicon);
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
    }
}
项目:notenoughwands1.8.8    文件:AddPotionRecipe.java   
@Override
public ItemStack getCraftingResult(InventoryCrafting inv) {
    ItemStack potion = null;
    ItemStack wand = null;
    for (int i = 0 ; i < inv.getSizeInventory() ; i++) {
        ItemStack stack = inv.getStackInSlot(i);
        if (stack != null && stack.getItem() == ModItems.potionWand) {
            wand = stack;
        } else if (stack != null && stack.getItem() == Items.potionitem) {
            potion = stack;
        }
    }

    ItemStack result = super.getCraftingResult(inv);
    NBTTagCompound tagCompound = wand.getTagCompound();
    if (tagCompound==null){
        tagCompound=new NBTTagCompound();
    }
    tagCompound=(NBTTagCompound)tagCompound.copy();
    NBTTagList list = tagCompound.getTagList("effects", Constants.NBT.TAG_COMPOUND);
    for (PotionEffect effect : ((ItemPotion) potion.getItem()).getEffects(potion)) {
        NBTTagCompound effecttag = new NBTTagCompound();
        effect.writeCustomPotionEffectToNBT(effecttag);
        list.appendTag(effecttag);
    }
    tagCompound.setTag("effects",list);
    result.setTagCompound(tagCompound);
    return result;
}
项目:InventoryTools    文件:ToolBoxRegistry.java   
public static final boolean isValidTool(ItemStack stack){
    if((stack.getItem() instanceof ItemBlock) || (stack.getItem() instanceof ItemPotion) || (stack.getItem() instanceof ItemArmor) || (stack.getItem() instanceof ItemBucket))
        return false;
    if(isWhiteListed(stack))
        return true;
    if(isBlackListed(stack))
        return false;
    return stack.getMaxStackSize() == 1 && !(stack.getItem() instanceof ItemBlock) && !(stack.getItem() instanceof ItemPotion) && !(stack.getItem() instanceof ItemArmor) && !(stack.getItem() instanceof ItemBucket);
}
项目:UHC-Reloaded    文件:CancelPotionBrewing.java   
@SubscribeEvent
public void cancelCertainPotionBrewing(PotionBrewEvent.Pre evt) {
    ItemStack modifier = evt.getItem(3);
    for (int i = 0; i < evt.getLength(); i++) {
        ItemStack stack = evt.getItem(i);
        if (!stack.isEmpty()) {
            ItemStack output = BrewingRecipeRegistry.getOutput(stack, modifier);
            if (output.getItem() instanceof ItemPotion) {
                if (!ConfigHandler.allowBrewingPotionSplash && output.getItem() instanceof ItemSplashPotion) {
                    evt.setCanceled(true);
                    return;
                }
                if (!ConfigHandler.allowBrewingPotionLingering && output.getItem() instanceof ItemLingeringPotion) {
                    evt.setCanceled(true);
                    return;
                }
                List<PotionEffect> potionEffects = PotionUtils.getEffectsFromStack(output);
                for (PotionEffect effect : potionEffects) {
                    if (effect.getAmplifier() > ConfigHandler.brewingPotionMaxLevel) {
                        evt.setCanceled(true);
                        return;
                    }
                    if (!ConfigHandler.allowBrewingPotionRegen && effect.getPotion() == MobEffects.REGENERATION) {
                        evt.setCanceled(true);
                        return;
                    }
                }
            }
        }
    }
}
项目:Et-Futurum    文件:ContainerNewBrewingStand.java   
@Override
public void onPickupFromSlot(EntityPlayer player, ItemStack stack) {
    if (stack.getItem() instanceof ItemPotion && stack.getItemDamage() > 0)
        player.addStat(AchievementList.potion, 1);

    super.onPickupFromSlot(player, stack);
}
项目:Et-Futurum    文件:TileEntityNewBrewingStand.java   
private boolean canBrew() {
    if (fuel > 0 && inventory[3] != null && inventory[3].stackSize > 0) {
        ItemStack itemstack = inventory[3];

        if (!itemstack.getItem().isPotionIngredient(itemstack))
            return false;
        else if (itemstack.getItem() == ModItems.dragon_breath) {
            for (int i = 0; i < 3; i++)
                if (inventory[i] != null && inventory[i].getItem() == Items.potionitem)
                    if (ItemPotion.isSplash(inventory[i].getItemDamage()))
                        return true;
            return false;
        } else {
            boolean flag = false;

            for (int i = 0; i < 3; i++)
                if (inventory[i] != null && inventory[i].getItem() instanceof ItemPotion) {
                    int j = inventory[i].getItemDamage();
                    int k = applyIngredient(j, itemstack);

                    if (!ItemPotion.isSplash(j) && ItemPotion.isSplash(k)) {
                        flag = true;
                        break;
                    }

                    List<?> list = Items.potionitem.getEffects(j);
                    List<?> list1 = Items.potionitem.getEffects(k);

                    if ((j <= 0 || list != list1) && (list == null || !list.equals(list1) && list1 != null) && j != k) {
                        flag = true;
                        break;
                    }
                }

            return flag;
        }
    } else
        return false;
}
项目:Et-Futurum    文件:TileEntityNewBrewingStand.java   
private void brewPotions() {
    if (ForgeEventFactory.onPotionAttemptBreaw(new ItemStack[] { inventory[0], inventory[1], inventory[2], inventory[3] }))
        return;
    if (canBrew()) {
        for (int i = 0; i < 3; i++)
            if (inventory[i] != null && inventory[i].getItem() instanceof ItemPotion) {
                int j = inventory[i].getItemDamage();
                if (ItemPotion.isSplash(j) && inventory[3].getItem() == ModItems.dragon_breath)
                    inventory[i] = new ItemStack(ModItems.lingering_potion, inventory[i].stackSize, inventory[i].getItemDamage());
                else {
                    int k = applyIngredient(j, inventory[3]);
                    List<?> list = Items.potionitem.getEffects(j);
                    List<?> list1 = Items.potionitem.getEffects(k);

                    if ((j <= 0 || list != list1) && (list == null || !list.equals(list1) && list1 != null)) {
                        if (j != k)
                            inventory[i].setItemDamage(k);
                    } else if (!ItemPotion.isSplash(j) && ItemPotion.isSplash(k))
                        inventory[i].setItemDamage(k);
                }
            }

        boolean hasContainerItem = inventory[3].getItem().hasContainerItem(inventory[3]);
        if (--inventory[3].stackSize <= 0)
            inventory[3] = hasContainerItem ? inventory[3].getItem().getContainerItem(inventory[3]) : null;
        else if (hasContainerItem && !worldObj.isRemote) {
            float f = 0.7F;
            double x = worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5D;
            double y = worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5D;
            double z = worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5D;
            EntityItem entityitem = new EntityItem(worldObj, xCoord + x, yCoord + y, zCoord + z, inventory[3].getItem().getContainerItem(inventory[3]));
            entityitem.delayBeforeCanPickup = 10;
            worldObj.spawnEntityInWorld(entityitem);
        }

        fuel--;
        ForgeEventFactory.onPotionBrewed(new ItemStack[] { inventory[0], inventory[1], inventory[2], inventory[3] });
        worldObj.playSound(xCoord, yCoord, zCoord, Reference.MOD_ID + ":block.brewing_stand.brew", 1.0F, 1.0F, true);
    }
}
项目:Et-Futurum    文件:TileEntityNewBrewingStand.java   
@Override
public boolean isItemValidForSlot(int slot, ItemStack stack) {
    if (slot == 4)
        return stack.getItem() == Items.blaze_powder;
    else if (slot == 3)
        return stack.getItem().isPotionIngredient(stack);
    else
        return stack.getItem() instanceof ItemPotion || stack.getItem() == Items.glass_bottle;
}
项目:Resilience-Client-Source    文件:RenderSnowball.java   
/**
 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
 * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
 * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
 */
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
    IIcon var10 = this.field_94151_a.getIconFromDamage(this.field_94150_f);

    if (var10 != null)
    {
        GL11.glPushMatrix();
        GL11.glTranslatef((float)par2, (float)par4, (float)par6);
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        GL11.glScalef(0.5F, 0.5F, 0.5F);
        this.bindEntityTexture(par1Entity);
        Tessellator var11 = Tessellator.instance;

        if (var10 == ItemPotion.func_94589_d("bottle_splash"))
        {
            int var12 = PotionHelper.func_77915_a(((EntityPotion)par1Entity).getPotionDamage(), false);
            float var13 = (float)(var12 >> 16 & 255) / 255.0F;
            float var14 = (float)(var12 >> 8 & 255) / 255.0F;
            float var15 = (float)(var12 & 255) / 255.0F;
            GL11.glColor3f(var13, var14, var15);
            GL11.glPushMatrix();
            this.func_77026_a(var11, ItemPotion.func_94589_d("overlay"));
            GL11.glPopMatrix();
            GL11.glColor3f(1.0F, 1.0F, 1.0F);
        }

        this.func_77026_a(var11, var10);
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
    }
}
项目:MineFantasy    文件:RenderBomb.java   
/**
 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
 * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
 * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
 */
public void doRender(Entity bomb, double x, double y, double z, float pitch, float yaw)
{
    Icon icon = null;
    if(bomb instanceof IBomb)
    {
        icon = ((IBomb)bomb).getIcon();
    }

    if (icon != null)
    {
        GL11.glPushMatrix();
        GL11.glTranslatef((float)x, (float)y, (float)z);
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        GL11.glScalef(0.5F, 0.5F, 0.5F);
        this.bindTexture(TextureMap.locationItemsTexture);
        Tessellator tessellator = Tessellator.instance;

        if (icon == ItemPotion.func_94589_d("potion_splash"))
        {
            int i = PotionHelper.func_77915_a(((EntityPotion)bomb).getPotionDamage(), false);
            float f2 = (float)(i >> 16 & 255) / 255.0F;
            float f3 = (float)(i >> 8 & 255) / 255.0F;
            float f4 = (float)(i & 255) / 255.0F;
            GL11.glColor3f(f2, f3, f4);
            GL11.glPushMatrix();
            this.func_77026_a(tessellator, ItemPotion.func_94589_d("potion_contents"));
            GL11.glPopMatrix();
            GL11.glColor3f(1.0F, 1.0F, 1.0F);
        }

        this.func_77026_a(tessellator, icon);
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
    }
}
项目:ZeroQuest    文件:RenderFireball.java   
/**
 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
 * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
 * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
 */
public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
    IIcon iicon = this.field_94151_a.getIconFromDamage(this.field_94150_f);

    if (iicon != null)
    {
        GL11.glPushMatrix();
        GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_);
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        GL11.glScalef(0.5F, 0.5F, 0.5F);
        this.bindEntityTexture(p_76986_1_);
        Tessellator tessellator = Tessellator.instance;

        if (iicon == ItemPotion.func_94589_d("bottle_splash"))
        {
            int i = PotionHelper.func_77915_a(((EntityPotion)p_76986_1_).getPotionDamage(), false);
            float f2 = (float)(i >> 16 & 255) / 255.0F;
            float f3 = (float)(i >> 8 & 255) / 255.0F;
            float f4 = (float)(i & 255) / 255.0F;
            GL11.glColor3f(f2, f3, f4);
            GL11.glPushMatrix();
            this.func_77026_a(tessellator, ItemPotion.func_94589_d("overlay"));
            GL11.glPopMatrix();
            GL11.glColor3f(1.0F, 1.0F, 1.0F);
        }

        this.func_77026_a(tessellator, iicon);
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
    }
}
项目:ZeroQuest    文件:RenderGrenade.java   
/**
 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
 * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
 * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
 */
public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
    IIcon iicon = this.field_94151_a.getIconFromDamage(this.field_94150_f);

    if (iicon != null)
    {
        GL11.glPushMatrix();
        GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_);
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        GL11.glScalef(0.5F, 0.5F, 0.5F);
        this.bindEntityTexture(p_76986_1_);
        Tessellator tessellator = Tessellator.instance;

        if (iicon == ItemPotion.func_94589_d("bottle_splash"))
        {
            int i = PotionHelper.func_77915_a(((EntityPotion)p_76986_1_).getPotionDamage(), false);
            float f2 = (float)(i >> 16 & 255) / 255.0F;
            float f3 = (float)(i >> 8 & 255) / 255.0F;
            float f4 = (float)(i & 255) / 255.0F;
            GL11.glColor3f(f2, f3, f4);
            GL11.glPushMatrix();
            this.func_77026_a(tessellator, ItemPotion.func_94589_d("overlay"));
            GL11.glPopMatrix();
            GL11.glColor3f(1.0F, 1.0F, 1.0F);
        }

        this.func_77026_a(tessellator, iicon);
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
    }
}
项目:ZeroQuest    文件:RenderIceball.java   
/**
 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
 * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
 * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
 */
public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
    IIcon iicon = this.field_94151_a.getIconFromDamage(this.field_94150_f);

    if (iicon != null)
    {
        GL11.glPushMatrix();
        GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_);
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        GL11.glScalef(0.5F, 0.5F, 0.5F);
        this.bindEntityTexture(p_76986_1_);
        Tessellator tessellator = Tessellator.instance;

        if (iicon == ItemPotion.func_94589_d("bottle_splash"))
        {
            int i = PotionHelper.func_77915_a(((EntityPotion)p_76986_1_).getPotionDamage(), false);
            float f2 = (float)(i >> 16 & 255) / 255.0F;
            float f3 = (float)(i >> 8 & 255) / 255.0F;
            float f4 = (float)(i & 255) / 255.0F;
            GL11.glColor3f(f2, f3, f4);
            GL11.glPushMatrix();
            this.func_77026_a(tessellator, ItemPotion.func_94589_d("overlay"));
            GL11.glPopMatrix();
            GL11.glColor3f(1.0F, 1.0F, 1.0F);
        }

        this.func_77026_a(tessellator, iicon);
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
    }
}
项目:Cauldron    文件:ContainerBrewingStand.java   
public void onPickupFromSlot(EntityPlayer p_82870_1_, ItemStack p_82870_2_)
{
    if (p_82870_2_.getItem() instanceof ItemPotion && p_82870_2_.getItemDamage() > 0)
    {
        this.player.addStat(AchievementList.potion, 1);
    }

    super.onPickupFromSlot(p_82870_1_, p_82870_2_);
}
项目:Cauldron    文件:RenderSnowball.java   
public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
    IIcon iicon = this.field_94151_a.getIconFromDamage(this.field_94150_f);

    if (iicon != null)
    {
        GL11.glPushMatrix();
        GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_);
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        GL11.glScalef(0.5F, 0.5F, 0.5F);
        this.bindEntityTexture(p_76986_1_);
        Tessellator tessellator = Tessellator.instance;

        if (iicon == ItemPotion.func_94589_d("bottle_splash"))
        {
            int i = PotionHelper.func_77915_a(((EntityPotion)p_76986_1_).getPotionDamage(), false);
            float f2 = (float)(i >> 16 & 255) / 255.0F;
            float f3 = (float)(i >> 8 & 255) / 255.0F;
            float f4 = (float)(i & 255) / 255.0F;
            GL11.glColor3f(f2, f3, f4);
            GL11.glPushMatrix();
            this.func_77026_a(tessellator, ItemPotion.func_94589_d("overlay"));
            GL11.glPopMatrix();
            GL11.glColor3f(1.0F, 1.0F, 1.0F);
        }

        this.func_77026_a(tessellator, iicon);
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
    }
}
项目:Cauldron    文件:ContainerBrewingStand.java   
public void onPickupFromSlot(EntityPlayer p_82870_1_, ItemStack p_82870_2_)
{
    if (p_82870_2_.getItem() instanceof ItemPotion && p_82870_2_.getItemDamage() > 0)
    {
        this.player.addStat(AchievementList.potion, 1);
    }

    super.onPickupFromSlot(p_82870_1_, p_82870_2_);
}
项目:Cauldron    文件:RenderSnowball.java   
public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
    IIcon iicon = this.field_94151_a.getIconFromDamage(this.field_94150_f);

    if (iicon != null)
    {
        GL11.glPushMatrix();
        GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_);
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        GL11.glScalef(0.5F, 0.5F, 0.5F);
        this.bindEntityTexture(p_76986_1_);
        Tessellator tessellator = Tessellator.instance;

        if (iicon == ItemPotion.func_94589_d("bottle_splash"))
        {
            int i = PotionHelper.func_77915_a(((EntityPotion)p_76986_1_).getPotionDamage(), false);
            float f2 = (float)(i >> 16 & 255) / 255.0F;
            float f3 = (float)(i >> 8 & 255) / 255.0F;
            float f4 = (float)(i & 255) / 255.0F;
            GL11.glColor3f(f2, f3, f4);
            GL11.glPushMatrix();
            this.func_77026_a(tessellator, ItemPotion.func_94589_d("overlay"));
            GL11.glPopMatrix();
            GL11.glColor3f(1.0F, 1.0F, 1.0F);
        }

        this.func_77026_a(tessellator, iicon);
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
    }
}
项目:ShadowsOfPhysis    文件:PhysisArtifacts.java   
public static boolean canItemAcceptSockets(ItemStack stack) {
    Item item = stack.getItem();
    if (item == PhysisItems.socketable) {
        return false;
    }
    if (item instanceof ItemBlock
        || item instanceof ItemReed
        || item instanceof ItemBed
        || item instanceof ItemFood
        || item instanceof ItemPotion
        || item instanceof ItemMinecart
        || item instanceof ItemBoat
        || item instanceof ItemEnchantedBook
        || item instanceof ItemWritableBook
        || item instanceof ItemBucket
        || item instanceof ItemBucketMilk
        || item instanceof ItemDoor) {
        return false;
    }
    if (item.getItemStackLimit(stack) > 1) {
        return false;
    }
    if (item.hasContainerItem(stack)){
        ItemStack container = item.getContainerItem(stack);
        if (container != null && container.getItem() instanceof ItemBucket) {
            return false;
        }
    }
    if (item.getUnlocalizedName(stack).toLowerCase().contains("bucket")) {
        return false;
    }
    return true;
}
项目:RuneCraftery    文件:TileEntityBrewingStand.java   
private boolean func_70350_k() {
   if(this.field_70359_a[3] != null && this.field_70359_a[3].field_77994_a > 0) {
      ItemStack var1 = this.field_70359_a[3];
      if(!Item.field_77698_e[var1.field_77993_c].func_77632_u()) {
         return false;
      } else {
         boolean var2 = false;

         for(int var3 = 0; var3 < 3; ++var3) {
            if(this.field_70359_a[var3] != null && this.field_70359_a[var3].field_77993_c == Item.field_77726_bs.field_77779_bT) {
               int var4 = this.field_70359_a[var3].func_77960_j();
               int var5 = this.func_70352_b(var4, var1);
               if(!ItemPotion.func_77831_g(var4) && ItemPotion.func_77831_g(var5)) {
                  var2 = true;
                  break;
               }

               List var6 = Item.field_77726_bs.func_77834_f(var4);
               List var7 = Item.field_77726_bs.func_77834_f(var5);
               if((var4 <= 0 || var6 != var7) && (var6 == null || !var6.equals(var7) && var7 != null) && var4 != var5) {
                  var2 = true;
                  break;
               }
            }
         }

         return var2;
      }
   } else {
      return false;
   }
}
项目:RuneCraftery    文件:TileEntityBrewingStand.java   
private void func_70353_r() {
   if(this.func_70350_k()) {
      ItemStack var1 = this.field_70359_a[3];

      for(int var2 = 0; var2 < 3; ++var2) {
         if(this.field_70359_a[var2] != null && this.field_70359_a[var2].field_77993_c == Item.field_77726_bs.field_77779_bT) {
            int var3 = this.field_70359_a[var2].func_77960_j();
            int var4 = this.func_70352_b(var3, var1);
            List var5 = Item.field_77726_bs.func_77834_f(var3);
            List var6 = Item.field_77726_bs.func_77834_f(var4);
            if((var3 <= 0 || var5 != var6) && (var5 == null || !var5.equals(var6) && var6 != null)) {
               if(var3 != var4) {
                  this.field_70359_a[var2].func_77964_b(var4);
               }
            } else if(!ItemPotion.func_77831_g(var3) && ItemPotion.func_77831_g(var4)) {
               this.field_70359_a[var2].func_77964_b(var4);
            }
         }
      }

      if(Item.field_77698_e[var1.field_77993_c].func_77634_r()) {
         this.field_70359_a[3] = new ItemStack(Item.field_77698_e[var1.field_77993_c].func_77668_q());
      } else {
         --this.field_70359_a[3].field_77994_a;
         if(this.field_70359_a[3].field_77994_a <= 0) {
            this.field_70359_a[3] = null;
         }
      }

   }
}
项目:RuneCraftery    文件:SlotBrewingStandPotion.java   
public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack)
{
    if (par2ItemStack.getItem() instanceof ItemPotion && par2ItemStack.getItemDamage() > 0)
    {
        this.player.addStat(AchievementList.potion, 1);
    }

    super.onPickupFromSlot(par1EntityPlayer, par2ItemStack);
}
项目:RuneCraftery    文件:RenderSnowball.java   
/**
 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
 * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
 * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
 */
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
    Icon icon = this.field_94151_a.getIconFromDamage(this.field_94150_f);

    if (icon != null)
    {
        GL11.glPushMatrix();
        GL11.glTranslatef((float)par2, (float)par4, (float)par6);
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        GL11.glScalef(0.5F, 0.5F, 0.5F);
        this.bindEntityTexture(par1Entity);
        Tessellator tessellator = Tessellator.instance;

        if (icon == ItemPotion.func_94589_d("bottle_splash"))
        {
            int i = PotionHelper.func_77915_a(((EntityPotion)par1Entity).getPotionDamage(), false);
            float f2 = (float)(i >> 16 & 255) / 255.0F;
            float f3 = (float)(i >> 8 & 255) / 255.0F;
            float f4 = (float)(i & 255) / 255.0F;
            GL11.glColor3f(f2, f3, f4);
            GL11.glPushMatrix();
            this.func_77026_a(tessellator, ItemPotion.func_94589_d("overlay"));
            GL11.glPopMatrix();
            GL11.glColor3f(1.0F, 1.0F, 1.0F);
        }

        this.func_77026_a(tessellator, icon);
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
    }
}