本文整理汇总了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();
}
}
示例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();
}
}
示例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();
}
}
示例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);
}
}
示例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();
}
}
示例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();
}
}
示例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);
}
}
示例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);
}
示例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();
}
}
示例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();
}
}
}
示例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));
}
示例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();
}
}
示例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);
}
}
示例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);
}
示例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;
}