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

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

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

World.checkLightFor介绍

暂无

代码示例

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

  1. @Override
  2. public boolean checkLightFor(@Nonnull EnumSkyBlock lightType, @Nonnull BlockPos pos) {
  3. return wrapped.checkLightFor(lightType, pos);
  4. }

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

  1. @Override
  2. public boolean checkLightFor(EnumSkyBlock lightType, BlockPos pos) {
  3. return getActualWorld().checkLightFor(lightType, pos);
  4. }

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

  1. @Override
  2. public void doUpdate() {
  3. super.doUpdate();
  4. if (isActive() != wasActive) {
  5. wasActive = isActive();
  6. world.checkLightFor(EnumSkyBlock.BLOCK, pos);
  7. }
  8. }

代码示例来源:origin: Esteemed-Innovation/Esteemed-Innovation

  1. @Override
  2. public void safeUpdate() {
  3. if (timer > maximumTicks) {
  4. timer = 0;
  5. }
  6. // FIXME: This might be bad for performance. Test.
  7. world.checkLightFor(EnumSkyBlock.BLOCK, pos);
  8. world.notifyNeighborsOfStateChange(pos, world.getBlockState(pos).getBlock(), true);
  9. timer++;
  10. }

代码示例来源:origin: TheGreyGhost/MinecraftByExample

  1. @Override
  2. public void update()
  3. {
  4. // For some reason, the colour and lighting don't always automatically update just in response to the
  5. // worldIn.markBlockForUpdate(pos); on the server in onNeighborBlockChange().
  6. // So force the block to re-render when we detect a colour change, otherwise the change in
  7. // state will not always be visible. Likewise, we need to force a lighting recalculation.
  8. // The block update (for renderer) is only required on client side, but the lighting is required on both, since
  9. // the client needs it for rendering and the server needs it for crop growth etc
  10. int currentRGBcolour = getRGBcolour();
  11. if (previousRGBcolor != currentRGBcolour) {
  12. previousRGBcolor = currentRGBcolour;
  13. if (world.isRemote) {
  14. IBlockState iblockstate = this.world.getBlockState(pos);
  15. final int FLAGS = 3; // I'm not sure what these flags do, exactly.
  16. this.world.notifyBlockUpdate(pos, iblockstate, iblockstate, FLAGS);
  17. }
  18. world.checkLightFor(EnumSkyBlock.BLOCK, pos);
  19. }
  20. }

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

  1. @SideOnly(Side.CLIENT)
  2. private void switchOff() {
  3. getEntityWorld().checkLightFor(EnumSkyBlock.BLOCK, new BlockPos(lastX, lastY, lastZ));
  4. getEntityWorld().checkLightFor(EnumSkyBlock.BLOCK, new BlockPos(MathHelper.floor(posX), MathHelper.floor(posY), MathHelper.floor(posZ)));
  5. }

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

  1. @SideOnly(Side.CLIENT)
  2. private void switchOff() {
  3. if (!ConfigHandler.INSTANCE.bioluminescence)
  4. return;
  5. if(triggerOnce) {
  6. getEntityWorld().checkLightFor(EnumSkyBlock.BLOCK, new BlockPos(lastX, lastY, lastZ));
  7. getEntityWorld().checkLightFor(EnumSkyBlock.BLOCK, new BlockPos(MathHelper.floor(posX), MathHelper.floor(posY), MathHelper.floor(posZ)));
  8. triggerOnce = false;
  9. }
  10. }

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

  1. protected void updateLighting() {
  2. int light2 = world.getLightFor(EnumSkyBlock.BLOCK, pos), light1 = getLightValue();
  3. if (light1 != light2 && world.checkLightFor(EnumSkyBlock.BLOCK, pos)) {
  4. IBlockState state = world.getBlockState(pos);
  5. world.notifyBlockUpdate(pos, state, state, 3);
  6. }
  7. }

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

  1. @Override
  2. public void updateEntity(@Nonnull World world) {
  3. if (ConduitConfig.dynamicLighting.get()) {
  4. int lightValue = getLightValue();
  5. if (lastLightValue != lightValue) {
  6. BlockPos pos = getBundle().getLocation();
  7. getBundle().getBundleworld().checkLightFor(EnumSkyBlock.BLOCK, pos);
  8. lastLightValue = lightValue;
  9. }
  10. }
  11. super.updateEntity(world);
  12. }

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

  1. public void updateLight() {
  2. final FluidStack fluid = tank.getFluid();
  3. int thisFluidLuminosity = fluid == null || fluid.getFluid() == null || tank.isEmpty() ? 0 : fluid.getFluid().getLuminosity(fluid);
  4. if (thisFluidLuminosity != lastFluidLuminosity) {
  5. if (world.checkLightFor(EnumSkyBlock.BLOCK, getPos())) {
  6. updateBlock();
  7. }
  8. lastFluidLuminosity = thisFluidLuminosity;
  9. }
  10. }

代码示例来源:origin: TheGreyGhost/MinecraftByExample

  1. world.notifyBlockUpdate(pos, iblockstate, iblockstate, FLAGS);
  2. world.checkLightFor(EnumSkyBlock.BLOCK, pos);

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

  1. @SideOnly(Side.CLIENT)
  2. private void lightUp(World world, BlockPos pos) {
  3. world.setLightFor(EnumSkyBlock.BLOCK, pos, 9);
  4. for (int i = -2; i < 2; i++)
  5. for (int j = -2; j < 2; j++)
  6. for (int k = -2; k < 2; k++)
  7. if (pos.getX() + i != lastX || pos.getY() + j != lastY || pos.getZ() + k != lastZ || isDead) {
  8. world.checkLightFor(EnumSkyBlock.BLOCK, new BlockPos(lastX + i, lastY + j, lastZ + k));
  9. lastX = pos.getX();
  10. lastY = pos.getY();
  11. lastZ = pos.getZ();
  12. }
  13. }

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

  1. @SideOnly(Side.CLIENT)
  2. private void lightUp(World world, BlockPos pos) {
  3. if (!ConfigHandler.INSTANCE.bioluminescence)
  4. return;
  5. world.setLightFor(EnumSkyBlock.BLOCK, pos, 9);
  6. for (int i = -2; i < 2; i++)
  7. for (int j = -2; j < 2; j++)
  8. for (int k = -2; k < 2; k++)
  9. if (pos.getX() + i != lastX || pos.getY() + j != lastY || pos.getZ() + k != lastZ || isDead) {
  10. world.checkLightFor(EnumSkyBlock.BLOCK, new BlockPos(lastX + i, lastY + j, lastZ + k));
  11. lastX = pos.getX();
  12. lastY = pos.getY();
  13. lastZ = pos.getZ();
  14. }
  15. triggerOnce = true;
  16. }

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

  1. updatedLight = world.checkLightFor(EnumSkyBlock.BLOCK, getPos());

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

  1. world.setBlockState(ln, bs, 2);
  2. world.notifyBlockUpdate(ln, bs, bs, 3);
  3. world.checkLightFor(EnumSkyBlock.BLOCK, ln);
  4. world.checkLightFor(EnumSkyBlock.BLOCK, pos);
  5. init = false;
  6. lastActive = isActivated;

相关文章

World类方法