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


Java LivingEntityUseItemEvent.Start方法代码示例

本文整理汇总了Java中net.minecraftforge.event.entity.living.LivingEntityUseItemEvent.Start方法的典型用法代码示例。如果您正苦于以下问题:Java LivingEntityUseItemEvent.Start方法的具体用法?Java LivingEntityUseItemEvent.Start怎么用?Java LivingEntityUseItemEvent.Start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.event.entity.living.LivingEntityUseItemEvent的用法示例。


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

示例1: eatApple

import net.minecraftforge.event.entity.living.LivingEntityUseItemEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void eatApple(LivingEntityUseItemEvent.Start event) {
    if (event.getItem().getItem() != Items.GOLDEN_APPLE || !(event.getEntityLiving() instanceof EntityPlayer)) {
        return;
    }

    EntityPlayer player = (EntityPlayer) event.getEntityLiving();
    if (ConfigHandler.antiCheatMode && event.getItem().getItemDamage() == 1) {
        player.sendMessage(new TextComponentTranslation("message.uhcreloaded.apple.enchanted"));
        event.setCanceled(true);
        return;
    }
    if (!event.getItem().hasTagCompound()) {
        return;
    }
    NBTTagCompound tag = event.getItem().getTagCompound();
    if (tag.getBoolean("golden_skull")) {
        player.addPotionEffect(new PotionEffect(
            MobEffects.HEALTH_BOOST, 1, ConfigHandler.healAmountSkull - 4
        ));
    }
}
 
开发者ID:liachmodded,项目名称:UHC-Reloaded,代码行数:23,代码来源:GoldenSkull.java

示例2: startUse

import net.minecraftforge.event.entity.living.LivingEntityUseItemEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void startUse(LivingEntityUseItemEvent.Start event){
	EntityLivingBase entity = event.getEntityLiving();
	ItemStack stack = event.getItem();
	
	if(entity.isInsideOfMaterial(Material.WATER)){
		if(ItemStackTools.isValid(stack) && stack.getItem() == Items.GLASS_BOTTLE){
			event.setDuration(32);
		}
	}
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:12,代码来源:EventHandler.java

示例3: onBowStartDraw

import net.minecraftforge.event.entity.living.LivingEntityUseItemEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOW)
public void onBowStartDraw(LivingEntityUseItemEvent.Start use){
    if(use.getDuration() > 1 && BattlegearUtils.isBow(use.getItem().getItem())){
        int lvl = mods.battlegear2.api.EnchantmentHelper.getEnchantmentLevel(BaseEnchantment.bowCharge, use.getItem());
        if(lvl > 0){
            use.setDuration(use.getDuration()- lvl*20000);
            if(use.getDuration() <=0){
                use.setDuration(1);
            }
        }
    }
}
 
开发者ID:Mine-and-blade-admin,项目名称:Battlegear2,代码行数:13,代码来源:BowHookContainerClass2.java

示例4: onLivingEntityUseItemEventStart

import net.minecraftforge.event.entity.living.LivingEntityUseItemEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.NORMAL)
public void onLivingEntityUseItemEventStart(LivingEntityUseItemEvent.Start event){
    // System.out.println("Item: " + event.getItem().getUnlocalizedName());
    the_item = event.getItem().getUnlocalizedName();
}
 
开发者ID:DeflatedPickles-Old-Repositories,项目名称:JustJunk,代码行数:6,代码来源:EventHandlerCommon.java

示例5: onItemUseStart

import net.minecraftforge.event.entity.living.LivingEntityUseItemEvent; //导入方法依赖的package包/类
public static int onItemUseStart(EntityLivingBase entity, ItemStack item, int duration)
{
    LivingEntityUseItemEvent event = new LivingEntityUseItemEvent.Start(entity, item, duration);
    return MinecraftForge.EVENT_BUS.post(event) ? -1 : event.getDuration();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:6,代码来源:ForgeEventFactory.java

示例6: onItemUse

import net.minecraftforge.event.entity.living.LivingEntityUseItemEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onItemUse(LivingEntityUseItemEvent.Start event)
{
	stopItemUse(event);
}
 
开发者ID:murapix,项目名称:Inhuman-Resources,代码行数:6,代码来源:PotionRedstoneNeedle.java


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