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


Java EntityLivingBase.setDead方法代码示例

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


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

示例1: itemInteractionForEntity

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
@Override
public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target, EnumHand hand) {
    if (target.getEntityWorld().isRemote) return false;
    if (target instanceof EntityPlayer || !target.isNonBoss()) return false;
    if (containsEntity(stack)) return false;
    String entityID = EntityList.getKey(target).toString();
    if (isBlacklisted(entityID)) return false;
    NBTTagCompound nbt = new NBTTagCompound();
    nbt.setString("entity", entityID);
    nbt.setInteger("id", EntityList.getID(target.getClass()));
    target.writeToNBT(nbt);
    stack.setTagCompound(nbt);
    playerIn.swingArm(hand);
    playerIn.setHeldItem(hand, stack);
    target.setDead();
    return true;
}
 
开发者ID:Buuz135,项目名称:Industrial-Foregoing,代码行数:18,代码来源:MobImprisonmentToolItem.java

示例2: onHitEntity

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
@SubscribeEvent
public void onHitEntity(LivingHurtEvent event) {
	
	if (event.getAmount() <= 0 || event.getEntityLiving() instanceof EntityPlayer) return;
	
	if (!(event.getSource().getSourceOfDamage() instanceof EntityPlayer)) return;
	
	ItemStack transformer = BaublesApi.getBaublesHandler((EntityPlayer)event.getSource().getSourceOfDamage()).getStackInSlot(6);
	if (transformer == null || (transformer != null && transformer.getItem() != this)) return;
	
	Random rand = new Random();
	if (rand.nextInt(100) != 0) return;
	
	EntityLivingBase elb = event.getEntityLiving();
	List<String> entities = new ArrayList<String>(EntityList.ENTITY_EGGS.keySet());
	String randomString = entities.get(rand.nextInt(entities.size()));
	Entity entity = EntityList.createEntityByName(randomString, elb.worldObj);
	if (!entity.isNonBoss()) return;
	entity.setPositionAndRotation(elb.posX, elb.posY, elb.posZ, elb.rotationYaw, elb.rotationPitch);
	
	elb.worldObj.spawnEntityInWorld(entity);
	elb.setDead();
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:24,代码来源:EmblemTransformation.java

示例3: itemInteractionForEntity

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
@Override
public boolean itemInteractionForEntity(ItemStack item, EntityPlayer player, EntityLivingBase entity) {
    if (entity.worldObj.isRemote) {
        return false;
    }
    if (entity instanceof IMob) {
        if (item.hasTagCompound())
            return false;
        item.setTagCompound(new NBTTagCompound());
        NBTTagCompound mainTag = new NBTTagCompound();
        NBTTagCompound entityTag = new NBTTagCompound();
        entity.writeToNBT(entityTag);
        mainTag.setFloat("health",entity.getHealth());
        mainTag.setTag("data", entityTag);
        mainTag.setString("id", EntityList.getEntityString(entity));
        if (entity instanceof EntitySlime) {
            mainTag.setInteger("slimesize", ((EntitySlime) entity).getSlimeSize());
        }
        if(entity instanceof EntityZombie){
            mainTag.setBoolean("isBabyZombie",entity.isChild());
        }
        item.getTagCompound().setTag("entity",mainTag);
        player.setCurrentItemOrArmor(0, item);
        entity.setDead();
        return true;
    }
    return super.itemInteractionForEntity(item, player, entity);
}
 
开发者ID:SihenZhang,项目名称:CursedLasso,代码行数:29,代码来源:ItemCursedLasso.java

示例4: arrowHit

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
protected void arrowHit(EntityLivingBase living)
{
    living.setDead();
}
 
开发者ID:Herobone,项目名称:HeroUtils,代码行数:5,代码来源:PlasmaArrow.java

示例5: apply

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
@Override
public void apply(World world, BlockPos pos, EntityLivingBase entity, int amplifier, int tick) {
	if (entity instanceof EntityMooshroom) {
		EntityCow cow = new EntityCow(world);
		cow.setPosition(pos.getX(), pos.getY(), pos.getZ());
		entity.setDead();
		world.spawnEntity(cow);
	}
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:10,代码来源:GrassGrowBrew.java

示例6: apply

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
@Override
public void apply(World world, BlockPos pos, EntityLivingBase entity, int amplifier, int tick) {
	if (entity instanceof EntityCow & !(entity instanceof EntityMooshroom)) {
		EntityMooshroom mooshroom = new EntityMooshroom(world);
		mooshroom.setPosition(pos.getX(), pos.getY(), pos.getZ());
		entity.setDead();
		world.spawnEntity(mooshroom);
	}
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:10,代码来源:MycologicalCorruptionBrew.java

示例7: hitEntity

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
	if(!(attacker instanceof EntityPlayer) || !((EntityPlayer)attacker).isCreative()) return super.hitEntity(stack, target, attacker);
	target.setDead(); // bypasses all invulerabilities
	return true; // bypass the damaging mechanic
}
 
开发者ID:sblectric,项目名称:AdvancedCombat,代码行数:7,代码来源:SwordCreative.java


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