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

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

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

World.getSkylightSubtracted介绍

暂无

代码示例

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

  1. @Override
  2. public int getSkylightSubtracted() {
  3. return wrapped.getSkylightSubtracted();
  4. }

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

  1. @Override
  2. public int getSkylightSubtracted() {
  3. return getActualWorld().getSkylightSubtracted();
  4. }

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

  1. public static float calculateLightRatio(World world) {
  2. int lightValue = EnumSkyBlock.SKY.defaultLightValue - world.getSkylightSubtracted();
  3. float sunAngle = world.getCelestialAngleRadians(1.0F);
  4. if (sunAngle < (float) Math.PI) {
  5. sunAngle += (0.0F - sunAngle) * 0.2F;
  6. } else {
  7. sunAngle += (((float) Math.PI * 2F) - sunAngle) * 0.2F;
  8. }
  9. lightValue = Math.round(lightValue * MathHelper.cos(sunAngle));
  10. lightValue = MathHelper.clamp(lightValue, 0, 15);
  11. return lightValue / 15f;
  12. }

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

  1. @Nonnull
  2. @Override
  3. public Map<Object, Object> getMeta(@Nonnull IPartialContext<BlockReference> context) {
  4. if (!context.getModules().hasModule(IntegrationVanilla.daylightSensorMod)) return Collections.emptyMap();
  5. IWorldLocation location = context.getTarget().getLocation();
  6. World world = location.getWorld();
  7. BlockPos pos = location.getPos();
  8. Map<Object, Object> out = Maps.newHashMap();
  9. if (!world.provider.hasSkyLight()) {
  10. out.put("sky", world.getLightFor(EnumSkyBlock.SKY, pos) - world.getSkylightSubtracted());
  11. }
  12. out.put("block", world.getLightFor(EnumSkyBlock.BLOCK, pos));
  13. return out;
  14. }
  15. }

代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition

  1. public void manageChagrgeAmount() {
  2. if (!world.isRemote) {
  3. if (world.provider.hasSkyLight()) {
  4. float f = 0;
  5. int i1 = world.getLightFor(EnumSkyBlock.SKY, getPos().up()) - world.getSkylightSubtracted();
  6. if (i1 >= 15) {
  7. f = getTime();
  8. }
  9. chargeAmount = (byte) Math.round(CHARGE_AMOUNT * f);
  10. } else {
  11. chargeAmount = 0;
  12. }
  13. }
  14. }

代码示例来源: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: SquidDev-CC/plethora

  1. @SubtargetedModuleObjectMethod.Inject(
  2. module = IntegrationVanilla.daylightSensor, target = IWorldLocation.class,
  3. doc = "function():int -- The light level from the sun"
  4. )
  5. public static Object[] getSkyLight(IWorldLocation location, IContext<IModuleContainer> context, Object[] args) throws LuaException {
  6. World world = location.getWorld();
  7. if (!world.provider.hasSkyLight()) {
  8. throw new LuaException("The world has no sky");
  9. } else {
  10. BlockPos pos = location.getPos();
  11. return new Object[]{world.getLightFor(EnumSkyBlock.SKY, pos) - world.getSkylightSubtracted()};
  12. }
  13. }

代码示例来源: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. }

相关文章

World类方法