Java 类net.minecraft.entity.effect.EntityLightningBolt 实例源码
项目:Infernum
文件:EntityPigMage.java
@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();
}
}
项目:DecompiledMinecraft
文件:EntityVillager.java
/**
* 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();
}
}
项目:DecompiledMinecraft
文件:EntityPig.java
/**
* 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();
}
}
项目:DecompiledMinecraft
文件:EntityVillager.java
/**
* 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();
}
}
项目:DecompiledMinecraft
文件:EntityPig.java
/**
* 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();
}
}
项目:BaseClient
文件:EntityVillager.java
/**
* 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();
}
}
项目:BaseClient
文件:EntityPig.java
/**
* 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();
}
}
项目:BaseClient
文件:EntityVillager.java
/**
* 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();
}
}
项目:BaseClient
文件:EntityPig.java
/**
* 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();
}
}
项目:Backmemed
文件:EntityAISkeletonRiders.java
/**
* 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);
}
}
项目:Backmemed
文件:EntityVillager.java
/**
* 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();
}
}
项目:Backmemed
文件:EntityPig.java
/**
* 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();
}
}
项目:CustomWorldGen
文件:EntityAISkeletonRiders.java
/**
* 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);
}
}
项目:CustomWorldGen
文件:EntityList.java
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);
}
项目:CustomWorldGen
文件:EntityVillager.java
/**
* 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();
}
}
项目:CustomWorldGen
文件:EntityPig.java
/**
* 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();
}
}
项目:runesofwizardry-classics
文件:RuneEntityTrapLightning.java
@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();
}
}
}
项目:MidgarCrusade
文件:ItemLameTonerre.java
/**
* 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));
}
项目:Count-Armours
文件:EntityFairy.java
@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();
}
}
项目:ToroQuest
文件:EntityMage.java
/**
* 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);
}
}
项目:Aether-Legacy
文件:ItemElementalSword.java
@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);
}
项目:demomod
文件:DemoPickaxe.java
@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;
}
项目:demomod
文件:DemoGiantSword.java
@Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
if (!entity.worldObj.isRemote) {
if (Config.giantSwordSummonsLightning) {
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.giantSwordEffects.length; i++) {
if (Config.giantSwordEffects[i] != null && Config.giantSwordEffects[i].getPotionID() > 0)
enemyPlayer.addPotionEffect(new PotionEffect(Config.giantSwordEffects[i].getPotionID(),
Config.giantSwordEffects[i].getDuration(), Config.giantSwordEffects[i].getAmplifier(),
Config.giantSwordEffects[i].getIsAmbient(),
Config.giantSwordEffects[i].getIsShowParticles()));
}
}
}
return false;
}
项目:demomod
文件:DemoSword.java
@Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
if (!entity.worldObj.isRemote) {
if (Config.swordSummonsLightning) {
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.swordEffects.length; i++) {
if (Config.swordEffects[i] != null && Config.swordEffects[i].getPotionID() > 0)
enemyPlayer.addPotionEffect(new PotionEffect(Config.swordEffects[i].getPotionID(),
Config.swordEffects[i].getDuration(), Config.swordEffects[i].getAmplifier(),
Config.swordEffects[i].getIsAmbient(), Config.swordEffects[i].getIsShowParticles()));
}
}
}
return false;
}
项目:Kingdom-Keys-Re-Coded
文件:EntityThundara.java
public EntityThundara (World world, EntityPlayer sender, double x, double y, double z) {
super(world);
this.posX = x;
this.posY = y;
this.posZ = z;
this.player = sender;
double distance = 3.0D;
AxisAlignedBB aabb = player.getEntityBoundingBox().grow(3, 3, 3);
List list = this.world.getEntitiesWithinAABBExcludingEntity(player, aabb);
if (!list.isEmpty()) for (int i = 0; i < list.size(); i++) {
Entity e = (Entity) list.get(i);
if (e instanceof EntityLivingBase) {
summonLightning = true;
if (!world.isRemote) PacketDispatcher.sendToAllAround(new SpawnThunderEntity(this, 2), player, 64.0D);
this.world.spawnEntity((new EntityLightningBolt(this.world, e.posX, e.posY, e.posZ, false)));
}
}
aabb.grow(-3, -3, -3);
}
项目:Kingdom-Keys-Re-Coded
文件:EntityThunder.java
public EntityThunder (World world, EntityLivingBase sender, double x, double y, double z) {
super(world);
this.posX = x;
this.posY = y;
this.posZ = z;
this.player = sender;
double distance = 3.0D;
AxisAlignedBB aabb = player.getEntityBoundingBox().grow(5, 5, 5);
List list = this.world.getEntitiesWithinAABBExcludingEntity(player, aabb);
if (!list.isEmpty()) for (int i = 0; i < list.size(); i++) {
Entity e = (Entity) list.get(i);
if (e instanceof EntityLivingBase) {
summonLightning = true;
if(player instanceof EntityPlayer)
if (!world.isRemote) PacketDispatcher.sendToAllAround(new SpawnThunderEntity(this, 1), (EntityPlayer)player, 64.0D);
this.world.addWeatherEffect((new EntityLightningBolt(this.world, e.posX, e.posY, e.posZ, false)));
}else{
if (!world.isRemote)
PacketDispatcher.sendToAllAround(new SpawnThunderEntity(this,1), dimension, this.posX, this.posY, this.posZ, 64D);
}
}
aabb.grow(-5, -5, -5);
}
项目:Kingdom-Keys-Re-Coded
文件:EntityThundaga.java
public EntityThundaga (World world, EntityPlayer sender, double x, double y, double z) {
super(world);
this.posX = x;
this.posY = y;
this.posZ = z;
this.player = sender;
double distance = 3.0D;
AxisAlignedBB aabb = player.getEntityBoundingBox().grow(3, 3, 3);
List list = this.world.getEntitiesWithinAABBExcludingEntity(player, aabb);
if (!list.isEmpty()) for (int i = 0; i < list.size(); i++) {
Entity e = (Entity) list.get(i);
if (e instanceof EntityLivingBase) {
summonLightning = true;
if (!world.isRemote) PacketDispatcher.sendToAllAround(new SpawnThunderEntity(this, 3), player, 64.0D);
this.world.spawnEntity((new EntityLightningBolt(this.world, e.posX, e.posY, e.posZ, false)));
}
}
aabb.grow(-3, -3, -3);
}
项目:HardcoreWither
文件:PowerUpLightning.java
@Override
public void updateWither()
{
if( ownerWither.worldObj.getTotalWorldTime() > lightningNextTick )
{
int targetId = ownerWither.getWatchedTargetId(0);
if( targetId != -1)
{
Entity target = ownerWither.worldObj.getEntityByID(targetId);
if(target != null)
{
double lightningXPos = target.lastTickPosX + (8 * random.nextGaussian() * lightningInaccuracy);
double lightningYPos = target.lastTickPosY + (8 * random.nextGaussian() * lightningInaccuracy);
double lightningZPos = target.lastTickPosZ + (8 * random.nextGaussian() * lightningInaccuracy);
ownerWither.worldObj.addWeatherEffect(new EntityLightningBolt(ownerWither.worldObj, lightningXPos, lightningYPos, lightningZPos));
setNextRandomTick();
}
}
}
}
项目:Wars-Mod
文件:BlockCRed.java
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack held, EnumFacing side, float par7, float par8, float par9) {
int i = pos.getX();
int j = pos.getY();
int k = pos.getZ();
controlRed.generate(world, i + -1, j, k, true);
{
WarsMod.generateBlock(world, i + -1, j, k + 1, WarsBlocks.controlYellow);
WarsMod.generateBlock(world, i + 1, j, k + 1, WarsBlocks.controlBlue);
WarsMod.generateBlock(world, i, j, k, WarsBlocks.controlRed);
WarsMod.generateBlock(world, i, j, k + 2, WarsBlocks.controlGreen);
}
{
EntityLightningBolt entityLightningBolt = new EntityLightningBolt(world, 1, 1, 1, true);
entityLightningBolt.setLocationAndAngles((double) i + 0.5D, j, (double) k + 0.5D, 0.0F, 0.0F);
world.spawnEntityInWorld(entityLightningBolt);
}
return false;
}
项目:Wars-Mod
文件:BlockCGreen.java
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack held, EnumFacing side, float par7, float par8, float par9) {
int i = pos.getX();
int j = pos.getY();
int k = pos.getZ();
controlGreen.generate(world, i + -1, j, k + -2, true);
{
WarsMod.generateBlock(world, i + -1, j, k + -1, WarsBlocks.controlYellow);
WarsMod.generateBlock(world, i + 1, j, k + -1, WarsBlocks.controlBlue);
WarsMod.generateBlock(world, i, j, k + -2, WarsBlocks.controlRed);
WarsMod.generateBlock(world, i, j, k, WarsBlocks.controlGreen);
}
{
EntityLightningBolt entityLightningBolt = new EntityLightningBolt(world, 1, 1, 1, true);
entityLightningBolt.setLocationAndAngles((double) i + 0.5D, j, (double) k + 0.5D, 0.0F, 0.0F);
world.spawnEntityInWorld(entityLightningBolt);
}
return false;
}
项目:Wars-Mod
文件:BlockCBlue.java
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack held, EnumFacing side, float par7, float par8, float par9) {
int i = pos.getX();
int j = pos.getY();
int k = pos.getZ();
controlBlue.generate(world, i + -2, j, k + -1, true);
{
WarsMod.generateBlock(world, i + -2, j, k, WarsBlocks.controlYellow);
WarsMod.generateBlock(world, i, j, k, WarsBlocks.controlBlue);
WarsMod.generateBlock(world, i + -1, j, k + -1, WarsBlocks.controlRed);
WarsMod.generateBlock(world, i + -1, j, k + 1, WarsBlocks.controlGreen);
}
{
EntityLightningBolt entityLightningBolt = new EntityLightningBolt(world, 1, 1, 1, true);
entityLightningBolt.setLocationAndAngles((double) i + 0.5D, j, (double) k + 0.5D, 0.0F, 0.0F);
world.spawnEntityInWorld(entityLightningBolt);
}
return false;
}
项目:Wars-Mod
文件:BlockCYellow.java
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack held, EnumFacing side, float par7, float par8, float par9) {
int i = pos.getX();
int j = pos.getY();
int k = pos.getZ();
controlYellow.generate(world, i, j, k + -1, true);
{
WarsMod.generateBlock(world, i, j, k, WarsBlocks.controlYellow);
WarsMod.generateBlock(world, i + 2, j, k, WarsBlocks.controlBlue);
WarsMod.generateBlock(world, i + 1, j, k + -1, WarsBlocks.controlRed);
WarsMod.generateBlock(world, i + 1, j, k + 1, WarsBlocks.controlGreen);
}
{
EntityLightningBolt entityLightningBolt = new EntityLightningBolt(world, 1, 1, 1, true);
entityLightningBolt.setLocationAndAngles((double) i + 0.5D, j, (double) k + 0.5D, 0.0F, 0.0F);
world.spawnEntityInWorld(entityLightningBolt);
}
return false;
}
项目:Wars-Mod
文件:GenControlTower.java
public GenControlTower(EntityPlayer player, int i, int j, int k) {
controlMain.generate(player.worldObj, i + -1, j, k + -1, true);
{
WarsMod.generateBlock(player.worldObj, i, j, k, Blocks.PLANKS);
WarsMod.generateBlock(player.worldObj, i + -1, j, k, WarsBlocks.controlYellow);
WarsMod.generateBlock(player.worldObj, i + 1, j, k, WarsBlocks.controlBlue);
WarsMod.generateBlock(player.worldObj, i, j, k + -1, WarsBlocks.controlRed);
WarsMod.generateBlock(player.worldObj, i, j, k + 1, WarsBlocks.controlGreen);
}
{
EntityLightningBolt entityLightningBolt = new EntityLightningBolt(player.worldObj, i, j, k, true);
entityLightningBolt.setLocationAndAngles((double) i + 0.5D, j, (double) k + 0.5D, 0.0F, 0.0F);
player.worldObj.spawnEntityInWorld(entityLightningBolt);
}
}
项目:MagicalRings
文件:HeavenStrike.java
@Override
public void onUse(World world, EntityPlayer player, IPlayerSession session, ItemStack stack, int boost, int cost) {
if (session.hasEnoughMana(cost())) {
MovingObjectPosition mop = SimpleUtil.rayTrace(player, world, 43);
if (mop != null) {
if (mop.typeOfHit == MovingObjectType.BLOCK) {
int blockX = mop.blockX;
int blockY = mop.blockY;
int blockZ = mop.blockZ;
Block block = world.getBlock(blockX, blockY, blockZ);
if (block != null && !world.isAirBlock(blockX, blockY, blockZ)) {
EntityLightningBolt light = new EntityLightningBolt(world, blockX, blockY, blockZ);
world.spawnEntityInWorld(light);
session.adjustMana(-cost(), false);
}
}
}
}
}
项目:IceAndShadow2
文件:NyxBlockGatestone.java
@Override
public boolean onBlockActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int side,
float px, float py, float pz) {
if (par1World.getBlockMetadata(x, y, z) > 0) {
if (par5EntityPlayer.getEquipmentInSlot(0) == null) {
IaSPlayerHelper.messagePlayer(par5EntityPlayer,
"It's missing something. That center stone looks like bloodstone...");
return false;
}
if (par5EntityPlayer.getEquipmentInSlot(0).getItem() == NyxItems.bloodstone) {
par1World.setBlockMetadataWithNotify(x, y, z, par1World.getBlockMetadata(x, y, z) - 1, 0x2);
if (!par5EntityPlayer.capabilities.isCreativeMode) {
par5EntityPlayer.getEquipmentInSlot(0).stackSize -= 1;
}
if (par1World.getBlockMetadata(x, y, z) == 0) {
par1World.setBlock(x, y - 1, z, NyxBlocks.cryingObsidian, 1, 0x2);
par1World.spawnEntityInWorld(new EntityLightningBolt(par1World, x, y, z));
}
}
return true;
}
return false;
}
项目:ExpandedRailsMod
文件:EntityList.java
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);
}
项目:ExpandedRailsMod
文件:EntityVillager.java
/**
* 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();
}
}
项目:ExpandedRailsMod
文件:EntityPig.java
/**
* 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();
}
}
项目:Mini-Bosses
文件:ItemOcculus.java
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
if(FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) {
--stack.stackSize;
EntityLightningBolt lightning = new EntityLightningBolt(world, player.posX, player.posY, player.posZ + 5);
world.spawnEntityInWorld(lightning);
if(player.getExtendedProperties(ExtendedPlayerProperties.PROP_NAME) != null) {
ExtendedPlayerProperties props = (ExtendedPlayerProperties) player.getExtendedProperties(ExtendedPlayerProperties.PROP_NAME);
props.setAbilityUsage(props.getAbilityUsageAmount() + 5);
}
player.addChatMessage(new ChatComponentText("And so it begins..."));
}
return stack;
}
项目:AbyssalCraft
文件:NecronomiconCreationRitual.java
@Override
protected void completeRitualServer(World world, BlockPos pos, EntityPlayer player){
world.addWeatherEffect(new EntityLightningBolt(world, pos.getX(), pos.getY() + 1, pos.getZ(), false));
TileEntity altar = world.getTileEntity(pos);
NBTTagCompound compound = new NBTTagCompound();
NBTTagCompound newItem = new NBTTagCompound();
altar.writeToNBT(compound);
NBTTagCompound nbtItem = compound.getCompoundTag("Item");
ItemStack stack = new ItemStack(nbtItem);
if(stack.isEmpty() || !stack.isItemEqual(item)){
item.writeToNBT(newItem);
compound.setTag("Item", newItem);
}
altar.readFromNBT(compound);
}