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

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

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

World.isThundering介绍

暂无

代码示例

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

  1. @Override
  2. public boolean hitEntity(ItemStack stack, EntityLivingBase entity, @Nonnull EntityLivingBase attacker) {
  3. if(!(entity instanceof EntityPlayer) && entity != null) {
  4. double range = 8;
  5. List<EntityLivingBase> alreadyTargetedEntities = new ArrayList<>();
  6. int dmg = 5;
  7. long lightningSeed = ItemNBTHelper.getLong(stack, TAG_LIGHTNING_SEED, 0);
  8. Predicate<Entity> selector = e -> e instanceof EntityLivingBase && e instanceof IMob && !(e instanceof EntityPlayer) && !alreadyTargetedEntities.contains(e);
  9. Random rand = new Random(lightningSeed);
  10. EntityLivingBase lightningSource = entity;
  11. int hops = entity.world.isThundering() ? 10 : 4;
  12. for(int i = 0; i < hops; i++) {
  13. List<Entity> entities = entity.world.getEntitiesInAABBexcluding(lightningSource, new AxisAlignedBB(lightningSource.posX - range, lightningSource.posY - range, lightningSource.posZ - range, lightningSource.posX + range, lightningSource.posY + range, lightningSource.posZ + range), selector::test);
  14. if(entities.isEmpty())
  15. break;
  16. EntityLivingBase target = (EntityLivingBase) entities.get(rand.nextInt(entities.size()));
  17. if(attacker instanceof EntityPlayer)
  18. target.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), dmg);
  19. else target.attackEntityFrom(DamageSource.causeMobDamage(attacker), dmg);
  20. Botania.proxy.lightningFX(Vector3.fromEntityCenter(lightningSource), Vector3.fromEntityCenter(target), 1, 0x0179C4, 0xAADFFF);
  21. alreadyTargetedEntities.add(target);
  22. lightningSource = target;
  23. dmg--;
  24. }
  25. if(!entity.world.isRemote)
  26. ItemNBTHelper.setLong(stack, TAG_LIGHTNING_SEED, entity.world.rand.nextLong());
  27. }
  28. return super.hitEntity(stack, entity, attacker);
  29. }

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

  1. @Override
  2. public int getDelayBetweenPassiveGeneration() {
  3. boolean rain = supertile.getWorld().getBiome(supertile.getPos()).getRainfall() > 0 && (supertile.getWorld().isRaining() || supertile.getWorld().isThundering());
  4. return rain ? 2 : 3;
  5. }

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

  1. @Override
  2. public boolean isThundering() {
  3. return wrapped.isThundering();
  4. }

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

  1. @Override
  2. public boolean isActive(World world) {
  3. return world.isThundering();
  4. }

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

  1. public static boolean worldIsState(WeatherTask task, World world) {
  2. if (world.isRaining()) {
  3. return world.isThundering() ? task == STORM : task == RAIN;
  4. }
  5. return task == CLEAR;
  6. }

代码示例来源:origin: Electrical-Age/ElectricalAge

  1. public static double getWeather(World world) {
  2. if (world.isThundering())
  3. return 1.0;
  4. if (world.isRaining())
  5. return 0.5;
  6. return 0.0;
  7. }
  8. }

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

  1. @Override
  2. public boolean isActive(World world) {
  3. return world.isRaining() && !world.isThundering();
  4. }

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

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

代码示例来源:origin: Electrical-Age/ElectricalAge

  1. public static double getWeatherNoLoad(int dim) {
  2. if (!getWorldExist(dim)) return 0.0;
  3. World world = getWorld(dim);
  4. if (world.isThundering())
  5. return 1.0;
  6. if (world.isRaining())
  7. return 0.5;
  8. return 0.0;
  9. }

代码示例来源:origin: SquidDev-CC/plethora

  1. @SubtargetedModuleObjectMethod.Inject(
  2. module = IntegrationVanilla.daylightSensor, target = IWorldLocation.class, worldThread = false,
  3. doc = "function():string -- The weather in the current world"
  4. )
  5. public static Object[] getWeather(IWorldLocation location, IContext<IModuleContainer> context, Object[] args) {
  6. World world = location.getWorld();
  7. if (world.isRaining()) {
  8. if (world.isThundering()) {
  9. return new Object[]{"thunder"};
  10. } else {
  11. return new Object[]{"rain"};
  12. }
  13. } else {
  14. return new Object[]{"clear"};
  15. }
  16. }
  17. }

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

  1. protected boolean isLowLightLevel() {
  2. BlockPos blockpos = new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ);
  3. if (this.world.getLightFor(EnumSkyBlock.SKY, blockpos) > this.rand.nextInt(32)) {
  4. return false;
  5. } else {
  6. int i = this.world.getLightFromNeighbors(blockpos);
  7. if (this.world.isThundering()) {
  8. int j = this.world.getSkylightSubtracted();
  9. this.world.setSkylightSubtracted(10);
  10. i = this.world.getLightFromNeighbors(blockpos);
  11. this.world.setSkylightSubtracted(j);
  12. }
  13. return i <= this.rand.nextInt(8);
  14. }
  15. }

代码示例来源:origin: Silentine/GrimoireOfGaia

  1. /**
  2. * @see EntityMob
  3. */
  4. private boolean isValidLightLevel() {
  5. BlockPos blockpos = new BlockPos(posX, getEntityBoundingBox().minY, posZ);
  6. if (world.getLightFor(EnumSkyBlock.SKY, blockpos) > rand.nextInt(32)) {
  7. return false;
  8. } else {
  9. int i = world.getLightFromNeighbors(blockpos);
  10. if (world.isThundering()) {
  11. int j = world.getSkylightSubtracted();
  12. world.setSkylightSubtracted(10);
  13. i = world.getLightFromNeighbors(blockpos);
  14. world.setSkylightSubtracted(j);
  15. }
  16. return i <= rand.nextInt(8);
  17. }
  18. }

代码示例来源:origin: Silentine/GrimoireOfGaia

  1. /**
  2. * Checks to make sure the light is not too bright where the mob is spawning
  3. */
  4. private boolean isValidLightLevel() {
  5. BlockPos blockpos = new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ);
  6. if (this.world.getLightFor(EnumSkyBlock.SKY, blockpos) > this.rand.nextInt(32)) {
  7. return false;
  8. } else {
  9. int i = this.world.getLightFromNeighbors(blockpos);
  10. if (this.world.isThundering()) {
  11. int j = this.world.getSkylightSubtracted();
  12. this.world.setSkylightSubtracted(10);
  13. i = this.world.getLightFromNeighbors(blockpos);
  14. this.world.setSkylightSubtracted(j);
  15. }
  16. return i <= this.rand.nextInt(8);
  17. }
  18. }

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

  1. protected boolean isValidLightLevel()
  2. {
  3. BlockPos blockpos = new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ);
  4. if (this.world.getLightFor(EnumSkyBlock.SKY, blockpos) > this.rand.nextInt(32))
  5. {
  6. return false;
  7. }
  8. else
  9. {
  10. int i = this.world.getLightFromNeighbors(blockpos);
  11. if (this.world.isThundering())
  12. {
  13. int j = this.world.getSkylightSubtracted();
  14. this.world.setSkylightSubtracted(10);
  15. i = this.world.getLightFromNeighbors(blockpos);
  16. this.world.setSkylightSubtracted(j);
  17. }
  18. return i <= this.rand.nextInt(8);
  19. }
  20. }

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

  1. @Override
  2. protected boolean isValidLightLevel() {
  3. if (!restrictLightLevel()) {
  4. return true;
  5. }
  6. BlockPos blockpos = new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ);
  7. if (this.world.getLightFor(EnumSkyBlock.SKY, blockpos) > this.rand.nextInt(32)) {
  8. return false;
  9. } else {
  10. int i = this.world.getLightFromNeighbors(blockpos);
  11. if (this.world.isThundering()) {
  12. int j = this.world.getSkylightSubtracted();
  13. this.world.setSkylightSubtracted(10);
  14. i = this.world.getLightFromNeighbors(blockpos);
  15. this.world.setSkylightSubtracted(j);
  16. }
  17. return i <= this.rand.nextInt(getSpawnLightLevel());
  18. }
  19. }

代码示例来源:origin: Electrical-Age/ElectricalAge

  1. if (world.isThundering()) {
  2. target = 1.0f;

代码示例来源:origin: SonarSonic/Calculator

  1. if (data == 0 && !this.world.isThundering()) {
  2. return false;
  3. } else if (data > 0 && this.world.isThundering()) {
  4. return false;

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

  1. world.addWeatherEffect(lightning);
  2. if (world.isThundering())

相关文章

World类方法