當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。