net.minecraft.world.World.addWeatherEffect()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(252)

本文整理了Java中net.minecraft.world.World.addWeatherEffect()方法的一些代码示例,展示了World.addWeatherEffect()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。World.addWeatherEffect()方法的具体详情如下:
包路径:net.minecraft.world.World
类名称:World
方法名:addWeatherEffect

World.addWeatherEffect介绍

暂无

代码示例

代码示例来源:origin: SleepyTrousers/EnderIO

  1. @Override
  2. public boolean addWeatherEffect(@Nonnull Entity entityIn) {
  3. return wrapped.addWeatherEffect(entityIn);
  4. }

代码示例来源:origin: CoFH/CoFHCore

  1. public static void doFakeLightningBolt(World world, double x, double y, double z) {
  2. EntityLightningBoltFake bolt = new EntityLightningBoltFake(world, x, y, z);
  3. world.addWeatherEffect(bolt);
  4. }

代码示例来源:origin: amadornes/MCMultiPart

  1. @Override
  2. public boolean addWeatherEffect(Entity entityIn) {
  3. return getActualWorld().addWeatherEffect(entityIn);
  4. }

代码示例来源:origin: CyclopsMC/EvilCraft

  1. private void explode(World world, double x, double y, double z) {
  2. Random rand = new Random();
  3. for (int i = 0; i < 32; ++i) {
  4. world.spawnParticle(EnumParticleTypes.CRIT_MAGIC, x, y + rand.nextDouble() * 2.0D, z, rand.nextGaussian(), 0.0D, rand.nextGaussian());
  5. }
  6. if (!world.isRemote) {
  7. this.world.createExplosion(this, this.posX, this.posY, this.posZ, EXPLOSION_STRENGTH, true);
  8. world.addWeatherEffect(new EntityLightningBolt(world, x, y, z, false));
  9. }
  10. }

代码示例来源:origin: ForestryMC/Binnie

  1. @Override
  2. protected IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing, World world, BlockPos position) {
  3. if (world.rand.nextInt(100) < 1 && world.canBlockSeeSky(position) && world instanceof WorldServer) {
  4. world.addWeatherEffect(new EntityBeeLightning(world, position.getX(), position.getY(), position.getZ()));
  5. }
  6. return storedData;
  7. }
  8. },

代码示例来源:origin: WayofTime/BloodMagic

  1. public void lightning(World world, BlockPos blockPos) {
  2. world.addWeatherEffect(new EntityLightningBolt(world, blockPos.getX(), blockPos.getY(), blockPos.getZ(), true));
  3. }

代码示例来源:origin: CyclopsMC/EvilCraft

  1. @Override
  2. protected void onImpact(RayTraceResult par1MovingObjectPosition) {
  3. if (par1MovingObjectPosition.entityHit != null) {
  4. par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0.0F);
  5. }
  6. for (int i = 0; i < 32; ++i) {
  7. this.world.spawnParticle(EnumParticleTypes.CRIT_MAGIC, this.posX, this.posY + this.rand.nextDouble() * 2.0D, this.posZ, this.rand.nextGaussian(), 0.0D, this.rand.nextGaussian());
  8. }
  9. if (!this.world.isRemote) {
  10. if (this.getThrower() != null && this.getThrower() instanceof EntityPlayerMP) {
  11. EntityHelpers.onEntityCollided(this.world, par1MovingObjectPosition.getBlockPos(), this);
  12. this.world.addWeatherEffect(new EntityLightningBolt(this.world, this.posX, this.posY, this.posZ, false));
  13. }
  14. this.setDead();
  15. }
  16. }

代码示例来源:origin: sinkillerj/ProjectE

  1. @Override
  2. public void updateInPedestal(@Nonnull World world, @Nonnull BlockPos pos)
  3. {
  4. if (!world.isRemote && ProjectEConfig.pedestalCooldown.swrgPedCooldown != -1)
  5. {
  6. TileEntity te = world.getTileEntity(pos);
  7. if(!(te instanceof DMPedestalTile))
  8. {
  9. return;
  10. }
  11. DMPedestalTile tile = (DMPedestalTile) te;
  12. if (tile.getActivityCooldown() <= 0)
  13. {
  14. List<EntityLiving> list = world.getEntitiesWithinAABB(EntityLiving.class, tile.getEffectBounds());
  15. for (EntityLiving living : list)
  16. {
  17. if (living instanceof EntityTameable && ((EntityTameable) living).isTamed())
  18. {
  19. continue;
  20. }
  21. world.addWeatherEffect(new EntityLightningBolt(world, living.posX, living.posY, living.posZ, false));
  22. }
  23. tile.setActivityCooldown(ProjectEConfig.pedestalCooldown.swrgPedCooldown);
  24. }
  25. else
  26. {
  27. tile.decrementActivityCooldown();
  28. }
  29. }
  30. }

代码示例来源:origin: sinkillerj/ProjectE

  1. public void doZap(EntityPlayer player)
  2. {
  3. if (ProjectEConfig.difficulty.offensiveAbilities)
  4. {
  5. BlockPos strikePos = PlayerHelper.getBlockLookingAt(player, 120.0F);
  6. if (strikePos != null)
  7. {
  8. player.getEntityWorld().addWeatherEffect(new EntityLightningBolt(player.getEntityWorld(), strikePos.getX(), strikePos.getY(), strikePos.getZ(), false));
  9. }
  10. }
  11. }
  12. }

代码示例来源:origin: Vazkii/Psi

  1. @Override
  2. public Object execute(SpellContext context) throws SpellRuntimeException {
  3. if(context.caster.getEntityWorld().isRemote)
  4. return null;
  5. Vector3 positionVal = this.getParamValue(context, position);
  6. if(positionVal == null)
  7. throw new SpellRuntimeException(SpellRuntimeException.NULL_VECTOR);
  8. if(!context.isInRadius(positionVal))
  9. throw new SpellRuntimeException(SpellRuntimeException.OUTSIDE_RADIUS);
  10. EntityLightningBolt lightning = new EntityLightningBolt(context.caster.getEntityWorld(), positionVal.x, positionVal.y, positionVal.z, false);
  11. context.caster.getEntityWorld().addWeatherEffect(lightning);
  12. return null;
  13. }

代码示例来源:origin: vadis365/TheErebus

  1. @SuppressWarnings("unchecked")
  2. protected Entity findEnemyToAttack() {
  3. List<EntityLivingBase> list = getWorld().getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(getPos()).grow(6D, 2D, 6D));
  4. if (active)
  5. for (int i = 0; i < list.size(); i++) {
  6. Entity entity = list.get(i);
  7. if (entity != null)
  8. if (entity instanceof EntityLivingBase)
  9. if (((EntityLivingBase) entity).getCreatureAttribute().equals(EnumCreatureAttribute.ARTHROPOD) && !(entity instanceof EntityAnimatedBlock) && !(entity instanceof EntityUmberGolem)) {
  10. double a = entity.posX;
  11. double b = entity.getEntityBoundingBox().minY;
  12. double c = entity.posZ;
  13. EntityLightningBolt entitybolt = new EntityLightningBolt(getWorld(), 0D, 0D, 0D, false);
  14. entitybolt.setLocationAndAngles(a, b, c, 0F, 0F);
  15. getWorld().addWeatherEffect(entitybolt);
  16. }
  17. }
  18. return null;
  19. }

代码示例来源:origin: sinkillerj/ProjectE

  1. world.addWeatherEffect(lightning);
  2. world.addWeatherEffect(bonus);

代码示例来源:origin: SleepyTrousers/EnderIO

  1. if (world.canBlockSeeSky(pos)) { // exposed to the sky?
  2. world.setBlockToAir(pos);
  3. world.addWeatherEffect(new EntityLightningBolt(world, pos.getX(), pos.getY(), pos.getZ(), true));
  4. return;

代码示例来源:origin: WayofTime/BloodMagic

  1. @Override
  2. public boolean performRitual(World world, BlockPos pos, @Nullable ImperfectRitual imperfectRitual, EntityPlayer player) {
  3. if (imperfectRitual != null && BloodMagic.RITUAL_MANAGER.enabled(BloodMagic.RITUAL_MANAGER.getId(imperfectRitual), true)) {
  4. if (!PlayerHelper.isFakePlayer(player) && !world.isRemote) {
  5. NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, SoulTicket.block(getWorld(), getPos(), imperfectRitual.getActivationCost()));
  6. if (imperfectRitual.onActivate(this, player)) {
  7. if (imperfectRitual.isLightShow())
  8. getWorld().addWeatherEffect(new EntityLightningBolt(getWorld(), getPos().getX(), getPos().getY() + 2, getPos().getZ(), true));
  9. return true;
  10. }
  11. }
  12. return true;
  13. }
  14. return false;
  15. }

代码示例来源:origin: TeamLapen/Vampirism

  1. @Override
  2. public void update() {
  3. if (ritualTicksLeft == 0) return;
  4. if (!world.isRemote) {
  5. switch (ritualTicksLeft) {
  6. case 5:
  7. world.addWeatherEffect(new EntityLightningBolt(world, this.pos.getX(), this.pos.getY(), this.pos.getZ(), true));
  8. ritualPlayer.setHealth(ritualPlayer.getMaxHealth());
  9. VampirePlayer.get(ritualPlayer).drinkBlood(100, 0);
  10. break;
  11. case 1:
  12. VampirePlayer player = VampirePlayer.get(ritualPlayer);
  13. int targetLevel = player.getLevel() + 1;
  14. VampireLevelingConf levelingConf = VampireLevelingConf.getInstance();
  15. int blood = levelingConf.getRequiredBloodForAltarInspiration(targetLevel) * VReference.FOOD_TO_FLUID_BLOOD;
  16. ((InternalTank) tank).doDrain(blood, true);
  17. ritualPlayer.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, targetLevel * 10 * 20));
  18. FactionPlayerHandler.get(ritualPlayer).setFactionLevel(VReference.VAMPIRE_FACTION, targetLevel);
  19. VampirePlayer.get(ritualPlayer).drinkBlood(Integer.MAX_VALUE, 0, false);
  20. markDirty();
  21. IBlockState state = world.getBlockState(getPos());
  22. this.world.notifyBlockUpdate(pos, state, state, 3);
  23. break;
  24. default:
  25. break;
  26. }
  27. }
  28. ritualTicksLeft--;
  29. }

代码示例来源:origin: vadis365/TheErebus

  1. private void openPyramid(World world, BlockPos pos, int offsetX, int offsetZ) {
  2. EntityLightningBolt entitybolt = new EntityLightningBolt(world, 0D, 0D, 0D, false);
  3. entitybolt.setLocationAndAngles(pos.getX() + offsetX, pos.getY(), pos.getZ() + offsetZ, 0F, 0F);
  4. world.addWeatherEffect(entitybolt);
  5. world.playEvent(null, 2001, pos, Block.getIdFromBlock(world.getBlockState(pos).getBlock()));
  6. world.setBlockToAir(pos);
  7. world.playEvent(null, 2001, pos.add(offsetX, 0, 0), Block.getIdFromBlock(world.getBlockState(pos.add(offsetX, 0, 0)).getBlock()));
  8. world.setBlockToAir(pos.add(offsetX, 0, 0));
  9. world.playEvent(null, 2001, pos.add(0, 0, offsetZ), Block.getIdFromBlock(world.getBlockState(pos.add(0, 0, offsetZ)).getBlock()));
  10. world.setBlockToAir(pos.add(0, 0, offsetZ));
  11. world.playEvent(null, 2001, pos.add(offsetX, 0, offsetZ), Block.getIdFromBlock(world.getBlockState(pos.add(offsetX, 0, offsetZ)).getBlock()));
  12. world.setBlockToAir(pos.add(offsetX, 0, offsetZ));
  13. }

相关文章

World类方法