當前位置: 首頁>>代碼示例>>Java>>正文


Java EntityLightningBolt類代碼示例

本文整理匯總了Java中net.minecraft.entity.effect.EntityLightningBolt的典型用法代碼示例。如果您正苦於以下問題:Java EntityLightningBolt類的具體用法?Java EntityLightningBolt怎麽用?Java EntityLightningBolt使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


EntityLightningBolt類屬於net.minecraft.entity.effect包,在下文中一共展示了EntityLightningBolt類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onStruckByLightning

import net.minecraft.entity.effect.EntityLightningBolt; //導入依賴的package包/類
@Override
public void onStruckByLightning(EntityLightningBolt lightningBolt) {
	if (!this.world.isRemote && !this.isDead) {
		EntityPigZombieMage entitymage = new EntityPigZombieMage(this.world);
		entitymage.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
		entitymage.onInitialSpawn(this.world.getDifficultyForLocation(new BlockPos(entitymage)),
				(IEntityLivingData) null);
		entitymage.setNoAI(this.isAIDisabled());

		if (this.hasCustomName()) {
			entitymage.setCustomNameTag(this.getCustomNameTag());
			entitymage.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag());
		}

		this.world.spawnEntity(entitymage);
		this.setDead();
	}
}
 
開發者ID:the-realest-stu,項目名稱:Infernum,代碼行數:19,代碼來源:EntityPigMage.java

示例2: onStruckByLightning

import net.minecraft.entity.effect.EntityLightningBolt; //導入依賴的package包/類
/**
 * Called when a lightning bolt hits the entity.
 */
public void onStruckByLightning(EntityLightningBolt lightningBolt)
{
    if (!this.worldObj.isRemote && !this.isDead)
    {
        EntityWitch entitywitch = new EntityWitch(this.worldObj);
        entitywitch.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
        entitywitch.onInitialSpawn(this.worldObj.getDifficultyForLocation(new BlockPos(entitywitch)), (IEntityLivingData)null);
        entitywitch.setNoAI(this.isAIDisabled());

        if (this.hasCustomName())
        {
            entitywitch.setCustomNameTag(this.getCustomNameTag());
            entitywitch.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag());
        }

        this.worldObj.spawnEntityInWorld(entitywitch);
        this.setDead();
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:23,代碼來源:EntityVillager.java

示例3: onStruckByLightning

import net.minecraft.entity.effect.EntityLightningBolt; //導入依賴的package包/類
/**
 * Called when a lightning bolt hits the entity.
 */
public void onStruckByLightning(EntityLightningBolt lightningBolt)
{
    if (!this.worldObj.isRemote && !this.isDead)
    {
        EntityPigZombie entitypigzombie = new EntityPigZombie(this.worldObj);
        entitypigzombie.setCurrentItemOrArmor(0, new ItemStack(Items.golden_sword));
        entitypigzombie.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
        entitypigzombie.setNoAI(this.isAIDisabled());

        if (this.hasCustomName())
        {
            entitypigzombie.setCustomNameTag(this.getCustomNameTag());
            entitypigzombie.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag());
        }

        this.worldObj.spawnEntityInWorld(entitypigzombie);
        this.setDead();
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:23,代碼來源:EntityPig.java

示例4: updateTask

import net.minecraft.entity.effect.EntityLightningBolt; //導入依賴的package包/類
/**
 * Updates the task
 */
public void updateTask()
{
    DifficultyInstance difficultyinstance = this.horse.world.getDifficultyForLocation(new BlockPos(this.horse));
    this.horse.func_190691_p(false);
    this.horse.setHorseTamed(true);
    this.horse.setGrowingAge(0);
    this.horse.world.addWeatherEffect(new EntityLightningBolt(this.horse.world, this.horse.posX, this.horse.posY, this.horse.posZ, true));
    EntitySkeleton entityskeleton = this.createSkeleton(difficultyinstance, this.horse);
    entityskeleton.startRiding(this.horse);

    for (int i = 0; i < 3; ++i)
    {
        AbstractHorse abstracthorse = this.createHorse(difficultyinstance);
        EntitySkeleton entityskeleton1 = this.createSkeleton(difficultyinstance, abstracthorse);
        entityskeleton1.startRiding(abstracthorse);
        abstracthorse.addVelocity(this.horse.getRNG().nextGaussian() * 0.5D, 0.0D, this.horse.getRNG().nextGaussian() * 0.5D);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:22,代碼來源:EntityAISkeletonRiders.java

示例5: onStruckByLightning

import net.minecraft.entity.effect.EntityLightningBolt; //導入依賴的package包/類
/**
 * Called when a lightning bolt hits the entity.
 */
public void onStruckByLightning(EntityLightningBolt lightningBolt)
{
    if (!this.world.isRemote && !this.isDead)
    {
        EntityWitch entitywitch = new EntityWitch(this.world);
        entitywitch.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
        entitywitch.onInitialSpawn(this.world.getDifficultyForLocation(new BlockPos(entitywitch)), (IEntityLivingData)null);
        entitywitch.setNoAI(this.isAIDisabled());

        if (this.hasCustomName())
        {
            entitywitch.setCustomNameTag(this.getCustomNameTag());
            entitywitch.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag());
        }

        this.world.spawnEntityInWorld(entitywitch);
        this.setDead();
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:23,代碼來源:EntityVillager.java

示例6: onStruckByLightning

import net.minecraft.entity.effect.EntityLightningBolt; //導入依賴的package包/類
/**
 * Called when a lightning bolt hits the entity.
 */
public void onStruckByLightning(EntityLightningBolt lightningBolt)
{
    if (!this.world.isRemote && !this.isDead)
    {
        EntityPigZombie entitypigzombie = new EntityPigZombie(this.world);
        entitypigzombie.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(Items.GOLDEN_SWORD));
        entitypigzombie.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
        entitypigzombie.setNoAI(this.isAIDisabled());

        if (this.hasCustomName())
        {
            entitypigzombie.setCustomNameTag(this.getCustomNameTag());
            entitypigzombie.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag());
        }

        this.world.spawnEntityInWorld(entitypigzombie);
        this.setDead();
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:23,代碼來源:EntityPig.java

示例7: updateTask

import net.minecraft.entity.effect.EntityLightningBolt; //導入依賴的package包/類
/**
 * Updates the task
 */
public void updateTask()
{
    DifficultyInstance difficultyinstance = this.horse.worldObj.getDifficultyForLocation(new BlockPos(this.horse));
    this.horse.setSkeletonTrap(false);
    this.horse.setType(HorseType.SKELETON);
    this.horse.setHorseTamed(true);
    this.horse.setGrowingAge(0);
    this.horse.worldObj.addWeatherEffect(new EntityLightningBolt(this.horse.worldObj, this.horse.posX, this.horse.posY, this.horse.posZ, true));
    EntitySkeleton entityskeleton = this.createSkeleton(difficultyinstance, this.horse);
    entityskeleton.startRiding(this.horse);

    for (int i = 0; i < 3; ++i)
    {
        EntityHorse entityhorse = this.createHorse(difficultyinstance);
        EntitySkeleton entityskeleton1 = this.createSkeleton(difficultyinstance, entityhorse);
        entityskeleton1.startRiding(entityhorse);
        entityhorse.addVelocity(this.horse.getRNG().nextGaussian() * 0.5D, 0.0D, this.horse.getRNG().nextGaussian() * 0.5D);
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:23,代碼來源:EntityAISkeletonRiders.java

示例8: isStringEntityName

import net.minecraft.entity.effect.EntityLightningBolt; //導入依賴的package包/類
public static boolean isStringEntityName(Entity entityIn, String entityName)
{
    String s = getEntityString(entityIn);

    if (s == null)
    {
        if (entityIn instanceof EntityPlayer)
        {
            s = "Player";
        }
        else
        {
            if (!(entityIn instanceof EntityLightningBolt))
            {
                return false;
            }

            s = "LightningBolt";
        }
    }

    return entityName.equals(s);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:24,代碼來源:EntityList.java

示例9: onStruckByLightning

import net.minecraft.entity.effect.EntityLightningBolt; //導入依賴的package包/類
/**
 * Called when a lightning bolt hits the entity.
 */
public void onStruckByLightning(EntityLightningBolt lightningBolt)
{
    if (!this.worldObj.isRemote && !this.isDead)
    {
        EntityPigZombie entitypigzombie = new EntityPigZombie(this.worldObj);
        entitypigzombie.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(Items.GOLDEN_SWORD));
        entitypigzombie.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
        entitypigzombie.setNoAI(this.isAIDisabled());

        if (this.hasCustomName())
        {
            entitypigzombie.setCustomNameTag(this.getCustomNameTag());
            entitypigzombie.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag());
        }

        this.worldObj.spawnEntityInWorld(entitypigzombie);
        this.setDead();
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:23,代碼來源:EntityPig.java

示例10: update

import net.minecraft.entity.effect.EntityLightningBolt; //導入依賴的package包/類
@Override
public void update() {
	World world = entity.getWorld();
	if(entity.ticksExisted()==5*Refs.TPS)this.renderActive=false;
	if(!world.isRemote&&entity.ticksExisted()>5*20){
		int radius=0;
		switch(EnumDustTypes.getByMeta(meta)){
		case GUNPOWDER:radius=4;
		break;
		case LAPIS: radius=6;
		break;
		case BLAZE:radius=8;
		break;
		default: this.onPatternBroken();return;
		}
		List<EntityLivingBase> ents =world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(getPos().add(-radius,-radius,-radius), getPos().add(radius,radius,radius)));
		if(!ents.isEmpty()){
			for(EntityLivingBase e:ents){
				world.addWeatherEffect(new EntityLightningBolt(world, e.posX, e.posY, e.posZ,false));
			}
			world.addWeatherEffect(new EntityLightningBolt(world, getPos().getX(), getPos().getY(), getPos().getZ(),false));
			this.onPatternBroken();
		}
	}
}
 
開發者ID:Xilef11,項目名稱:runesofwizardry-classics,代碼行數:26,代碼來源:RuneEntityTrapLightning.java

示例11: onItemRightClick

import net.minecraft.entity.effect.EntityLightningBolt; //導入依賴的package包/類
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
public ItemStack onItemRightClick(ItemStack is, World w, EntityPlayer e)
{
	int charge;
	
	charge = is.stackTagCompound.getInteger("charge");
	if (charge == 500)
	{
		is.stackTagCompound.setInteger("charge", 0);
		w.spawnEntityInWorld(new EntityLightningBolt(w, e.posX - 4, e.posY, e.posZ - 4));
		w.spawnEntityInWorld(new EntityLightningBolt(w, e.posX + 4, e.posY, e.posZ - 4));
		w.spawnEntityInWorld(new EntityLightningBolt(w, e.posX + 4, e.posY, e.posZ + 4));
		w.spawnEntityInWorld(new EntityLightningBolt(w, e.posX - 4, e.posY, e.posZ + 4));
	}    	
	return (super.onItemRightClick(is, w, e));
}
 
開發者ID:GhostMonk3408,項目名稱:MidgarCrusade,代碼行數:19,代碼來源:ItemLameTonerre.java

示例12: onStruckByLightning

import net.minecraft.entity.effect.EntityLightningBolt; //導入依賴的package包/類
@Override
public void onStruckByLightning(EntityLightningBolt lightningBolt) {
    if (!this.world.isRemote && !this.isDead) {
        EntityVex entityVex = new EntityVex(this.world);
        entityVex.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
        entityVex.onInitialSpawn(this.world.getDifficultyForLocation(new BlockPos(entityVex)), null);
        entityVex.setNoAI(this.isAIDisabled());

        if (this.hasCustomName()) {
            entityVex.setCustomNameTag(this.getCustomNameTag());
            entityVex.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag());
        }

        this.world.spawnEntity(entityVex);
        this.setDead();
    }
}
 
開發者ID:CountGrimhart,項目名稱:Count-Armours,代碼行數:18,代碼來源:EntityFairy.java

示例13: attackEntityWithRangedAttack

import net.minecraft.entity.effect.EntityLightningBolt; //導入依賴的package包/類
/**
 * Attack the specified entity using a ranged attack.
 */
public void attackEntityWithRangedAttack(EntityLivingBase target, float p_82196_2_) {

	if (isDrinkingPotion()) {
		return;
	}

	int roll = rand.nextInt(100);

	setStaffAttacking(true);

	if (roll < 60) {
		attackWithPotion(target);

	} else if (roll < 90) {

		if (getDistanceSqToEntity(target) > 16 && rand.nextInt(100) > 60) {
			world.addWeatherEffect(new EntityLightningBolt(world, target.posX, target.posY, target.posZ, false));
		} else {
			attackWithForce(target);
		}

	} else {
		attackWithMobSpawn(target);
	}
}
 
開發者ID:ToroCraft,項目名稱:ToroQuest,代碼行數:29,代碼來源:EntityMage.java

示例14: hitEntity

import net.minecraft.entity.effect.EntityLightningBolt; //導入依賴的package包/類
@Override
  public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1)
  {
if (this == ItemsAether.flaming_sword)
{
	entityliving.setFire(30);
}
else if (this == ItemsAether.lightning_sword)
{
	EntityLightningBolt lightning = new EntityLightningBolt(entityliving1.worldObj, entityliving.posX, entityliving.posY, entityliving.posZ, false);
	entityliving1.worldObj.spawnEntityInWorld(lightning);
}
else if (this == ItemsAether.holy_sword && entityliving.isEntityUndead())
{
	entityliving.attackEntityFrom(DamageSource.causeMobDamage(entityliving1), 10);
	itemstack.damageItem(10, entityliving1);
}

return super.hitEntity(itemstack, entityliving, entityliving1);
  }
 
開發者ID:Modding-Legacy,項目名稱:Aether-Legacy,代碼行數:21,代碼來源:ItemElementalSword.java

示例15: onLeftClickEntity

import net.minecraft.entity.effect.EntityLightningBolt; //導入依賴的package包/類
@Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {

	if (!entity.worldObj.isRemote) {

		if (Config.pickaxeSummonsLightning) {
			entity.worldObj.addWeatherEffect(new EntityLightningBolt(entity.worldObj, entity.posX + 0.5,
					entity.posY + 1, entity.posZ + 0.5));
		}

		if (entity instanceof EntityPlayer) {
			EntityPlayer enemyPlayer = (EntityPlayer) entity;

			for (int i = 0; i < Config.pickaxeEffects.length; i++) {
				if (Config.pickaxeEffects[i] != null && Config.pickaxeEffects[i].getPotionID() > 0)
					enemyPlayer.addPotionEffect(new PotionEffect(Config.pickaxeEffects[i].getPotionID(),
							Config.pickaxeEffects[i].getDuration(), Config.pickaxeEffects[i].getAmplifier(),
							Config.pickaxeEffects[i].getIsAmbient(),
							Config.pickaxeEffects[i].getIsShowParticles()));
			}
		}
	}
	return false;
}
 
開發者ID:worldwidewoogie,項目名稱:demomod,代碼行數:25,代碼來源:DemoPickaxe.java


注:本文中的net.minecraft.entity.effect.EntityLightningBolt類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。