当前位置: 首页>>代码示例>>Java>>正文


Java ItemLingeringPotion类代码示例

本文整理汇总了Java中net.minecraft.item.ItemLingeringPotion的典型用法代码示例。如果您正苦于以下问题:Java ItemLingeringPotion类的具体用法?Java ItemLingeringPotion怎么用?Java ItemLingeringPotion使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ItemLingeringPotion类属于net.minecraft.item包,在下文中一共展示了ItemLingeringPotion类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isThrowable

import net.minecraft.item.ItemLingeringPotion; //导入依赖的package包/类
public boolean isThrowable() {
	if (item instanceof ItemBow || item instanceof ItemSnowball || item instanceof ItemEgg
			|| item instanceof ItemEnderPearl || item instanceof ItemSplashPotion
			|| item instanceof ItemLingeringPotion || item instanceof ItemFishingRod) {
		return true;
	}
	return false;
}
 
开发者ID:Moudoux,项目名称:EMC,代码行数:9,代码来源:IItem.java

示例2: cancelCertainPotionBrewing

import net.minecraft.item.ItemLingeringPotion; //导入依赖的package包/类
@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;
                    }
                }
            }
        }
    }
}
 
开发者ID:liachmodded,项目名称:UHC-Reloaded,代码行数:32,代码来源:CancelPotionBrewing.java

示例3: dispense

import net.minecraft.item.ItemLingeringPotion; //导入依赖的package包/类
/** Custom dispense routines */
@Override
protected void dispense(World worldIn, BlockPos pos) {
       BlockSourceImpl src = new BlockSourceImpl(worldIn, pos);
       TileEntityDispenser tile = (TileEntityDispenser)src.getBlockTileEntity();

       if (tile != null) {
           int i = tile.getDispenseSlot();

           if (i < 0) {
               worldIn.playEvent(1001, pos, 0);
           } else {
           	
           	// get the active item from its slot
               ItemStack itemstack = tile.getStackInSlot(i);
               IBehaviorDispenseItem defaultbehavior = this.getBehavior(itemstack);

               // make sure it's not regular dropper behavior
               if (defaultbehavior != IBehaviorDispenseItem.DEFAULT_BEHAVIOR) {
               	ItemStack itemstack1 = null;
               	
               	// replace vanilla behavior
               	if(defaultbehavior instanceof BehaviorProjectileDispense) {
               		itemstack1 = this.dispenseProjectile((BehaviorProjectileDispense)defaultbehavior, src, itemstack);
               	} else if(itemstack.getItem() instanceof ItemSplashPotion || itemstack.getItem() instanceof ItemLingeringPotion) {
               		itemstack1 = this.dispensePotion(src, itemstack);
               	} else if(itemstack.getItem() instanceof ItemFireball) {
               		itemstack1 = this.dispenseFireball(src, itemstack);
               	}
               	
               	// revert to vanilla on failure
               	if(itemstack1 == null) {
               		itemstack1 = defaultbehavior.dispense(src, itemstack);
               	}
               	
               	// update the inventory
                   tile.setInventorySlotContents(i, itemstack1.getCount() <= 0 ? ItemStack.EMPTY : itemstack1);
               }
           }
       }
   }
 
开发者ID:sblectric,项目名称:AdvancedCombat,代码行数:42,代码来源:BlockTrackingDispenser.java


注:本文中的net.minecraft.item.ItemLingeringPotion类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。