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

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

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

World.getCombinedLight介绍

暂无

代码示例

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

  1. @Override
  2. public int getCombinedLight(@Nonnull BlockPos pos, int lightValue) {
  3. return wrapped.getCombinedLight(pos, lightValue);
  4. }

代码示例来源:origin: Direwolf20-MC/BuildingGadgets

  1. @Override
  2. @SideOnly(Side.CLIENT)
  3. public int getCombinedLight(BlockPos pos, int lightValue) {
  4. return realWorld.getCombinedLight(pos, lightValue);
  5. }

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

  1. @Override
  2. public int getCombinedLight(BlockPos pos, int lightValue) {
  3. return getActualWorld().getCombinedLight(pos, lightValue);
  4. }

代码示例来源:origin: PrinceOfAmber/Cyclic

  1. public void fixLighting(TileEntity te) {
  2. int ambLight = getWorld().getCombinedLight(te.getPos().offset(EnumFacing.UP), 0);
  3. if (ambLight == 0) {
  4. ambLight = 15728656;//if there is a block above blocking light, dont make it dark
  5. }
  6. int lu = ambLight % 65536;
  7. int lv = ambLight / 65536;
  8. OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lu / 1.0F, lv / 1.0F);
  9. //end of 'fix lighting'
  10. }

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

  1. @Override
  2. public void renderFluid(FluidStack fluid) {
  3. double height = tile.getFillRatio() * 0.99D;
  4. renderFluidSides(height, fluid, tile.getWorld().getCombinedLight(tile.getPos(), fluid.getFluid().getLuminosity(fluid)));
  5. }

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

  1. public static void setupLight(TileEntity tile, EnumFacing side) {
  2. if (tile == null) {
  3. return;
  4. }
  5. BlockPos pos = tile.getPos().offset(side);
  6. World world = tile.getWorld();
  7. if (world.getBlockState(pos).isOpaqueCube()) {
  8. return;
  9. }
  10. int br = world.getCombinedLight(pos, 4);
  11. int brX = br & 65535;
  12. int brY = br >>> 16;
  13. OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, brX, brY);
  14. }

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

  1. protected void renderItemStack(@Nonnull EnumFacing facing, @Nonnull BlockPos pos, @Nonnull ItemStack floatingItem, @Nonnull World world, float tick) {
  2. RenderUtil.bindBlockTexture();
  3. rand.setSeed(pos.getX() + pos.getY() + pos.getZ());
  4. rand.nextBoolean();
  5. int i = world.getCombinedLight(pos.offset(facing), 0);
  6. int j = i % 65536;
  7. int k = (int) (180 + (60 * MathHelper.sin((float) ((EnderIO.proxy.getTickCount() * 0.145D + (tick * 0.145D) + rand.nextDouble()) % (Math.PI * 2)))));
  8. if (EnderIO.proxy.getTickCount() % 10 == 0) {
  9. // j = k = 240;
  10. }
  11. OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j, k);
  12. GlStateManager.pushMatrix();
  13. EnumFacing offsetDir = facing.rotateY();
  14. double offsetX = 0.5 + (offsetDir.getFrontOffsetX() * 2.5 / 16D) + (facing.getFrontOffsetX() * 3.0 / 16D);
  15. double offsetY = 5 / 16D;
  16. double offsetZ = 0.5 + (offsetDir.getFrontOffsetZ() * 2.5 / 16D) + (facing.getFrontOffsetZ() * 3.0 / 16D);
  17. GlStateManager.translate(offsetX, offsetY, offsetZ);
  18. GlStateManager.scale(0.9, 0.9, 0.9);
  19. // glScalef(1.1f, 1.1f, 1.1f);
  20. if (Minecraft.getMinecraft().gameSettings.fancyGraphics) {
  21. GlStateManager.rotate(rand.nextFloat() * 360f, 0, 1, 0);
  22. }
  23. double rot = (EnderIO.proxy.getTickCount() * 0.05D + (tick * 0.05D) + rand.nextDouble()) % (Math.PI * 2);
  24. doRender(world, floatingItem, rot);
  25. GlStateManager.popMatrix();
  26. }

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

  1. @Override
  2. @SideOnly(Side.CLIENT)
  3. public int getBrightnessForRender() {
  4. int i = MathHelper.floor(this.posX);
  5. int j = MathHelper.floor(this.posZ);
  6. int k = MathHelper.floor(this.posY);
  7. if (pos1.getY() > k)
  8. k = pos1.getY();
  9. if (pos2.getY() > k)
  10. k = pos2.getY();
  11. return this.world.getCombinedLight(new BlockPos(i, k, j), 0);
  12. }

代码示例来源:origin: MightyPirates/TIS-3D

  1. final int brightness = getWorld().getCombinedLight(
  2. casing.getPosition().offset(Face.toEnumFacing(face)), 0);
  3. OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, brightness % 65536, brightness / 65536);

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

  1. @Override
  2. @SideOnly(Side.CLIENT)
  3. public int getBrightnessForRender() {
  4. int i = MathHelper.floor(this.posX);
  5. int j = MathHelper.floor(this.posZ);
  6. if (!world.isAirBlock(new BlockPos(i, 0, j))) {
  7. double d0 = (getEntityBoundingBox().maxY - getEntityBoundingBox().minY) * 0.66D;
  8. int k = MathHelper.floor(this.posY - getYOffset() + d0);
  9. return world.getCombinedLight(new BlockPos(i, k, j), 0);
  10. } else {
  11. return 0;
  12. }
  13. }

代码示例来源:origin: JurassiCraftTeam/JurassiCraft2

  1. private void setLightmap(AttractionSignEntity sign, float xzOffset, float yOffset) {
  2. int posX = MathHelper.floor(sign.posX);
  3. int posY = MathHelper.floor(sign.posY + (yOffset / 16.0F));
  4. int posZ = MathHelper.floor(sign.posZ);
  5. EnumFacing direction = sign.facingDirection;
  6. if (direction == EnumFacing.NORTH) {
  7. posX = MathHelper.floor(sign.posX + (xzOffset / 16.0F));
  8. } else if (direction == EnumFacing.WEST) {
  9. posZ = MathHelper.floor(sign.posZ - (xzOffset / 16.0F));
  10. } else if (direction == EnumFacing.SOUTH) {
  11. posX = MathHelper.floor(sign.posX - (xzOffset / 16.0F));
  12. } else if (direction == EnumFacing.EAST) {
  13. posZ = MathHelper.floor(sign.posZ + (xzOffset / 16.0F));
  14. }
  15. int combinedLight = this.renderManager.world.getCombinedLight(new BlockPos(posX, posY, posZ), 0);
  16. OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, combinedLight % 65536, combinedLight / 65536.0F);
  17. GlStateManager.color(1.0F, 1.0F, 1.0F);
  18. }
  19. }

代码示例来源:origin: JurassiCraftTeam/JurassiCraft2

  1. private void setLightmap(PaddockSignEntity sign, float xzOffset, float yOffset) {
  2. int posX = MathHelper.floor(sign.posX);
  3. int posY = MathHelper.floor(sign.posY + (yOffset / 16.0F));
  4. int posZ = MathHelper.floor(sign.posZ);
  5. EnumFacing direction = sign.facingDirection;
  6. if (direction == EnumFacing.NORTH) {
  7. posX = MathHelper.floor(sign.posX + (xzOffset / 16.0F));
  8. } else if (direction == EnumFacing.WEST) {
  9. posZ = MathHelper.floor(sign.posZ - (xzOffset / 16.0F));
  10. } else if (direction == EnumFacing.SOUTH) {
  11. posX = MathHelper.floor(sign.posX - (xzOffset / 16.0F));
  12. } else if (direction == EnumFacing.EAST) {
  13. posZ = MathHelper.floor(sign.posZ + (xzOffset / 16.0F));
  14. }
  15. int combinedLight = this.renderManager.world.getCombinedLight(new BlockPos(posX, posY, posZ), 0);
  16. OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, combinedLight % 65536, combinedLight / 65536.0F);
  17. GlStateManager.color(1.0F, 1.0F, 1.0F);
  18. }
  19. }

代码示例来源:origin: JurassiCraftTeam/JurassiCraft2

  1. private void setLightmap(MuralEntity sign, float xzOffset, float yOffset) {
  2. int posX = MathHelper.floor(sign.posX);
  3. int posY = MathHelper.floor(sign.posY + (yOffset / 16.0F));
  4. int posZ = MathHelper.floor(sign.posZ);
  5. EnumFacing direction = sign.facingDirection;
  6. if (direction == EnumFacing.NORTH) {
  7. posX = MathHelper.floor(sign.posX + (xzOffset / 16.0F));
  8. } else if (direction == EnumFacing.WEST) {
  9. posZ = MathHelper.floor(sign.posZ - (xzOffset / 16.0F));
  10. } else if (direction == EnumFacing.SOUTH) {
  11. posX = MathHelper.floor(sign.posX - (xzOffset / 16.0F));
  12. } else if (direction == EnumFacing.EAST) {
  13. posZ = MathHelper.floor(sign.posZ + (xzOffset / 16.0F));
  14. }
  15. int combinedLight = this.renderManager.world.getCombinedLight(new BlockPos(posX, posY, posZ), 0);
  16. OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, combinedLight % 65536, combinedLight / 65536.0F);
  17. GlStateManager.color(1.0F, 1.0F, 1.0F);
  18. }
  19. }

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

  1. final int br = tile.getWorld().getCombinedLight( tile.getPos(), 0 );
  2. final int var11 = br % 65536;
  3. final int var12 = br / 65536;

代码示例来源:origin: Alex-the-666/Ice_and_Fire

  1. @SideOnly(Side.CLIENT)
  2. public int getBrightnessForRender() {
  3. BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(MathHelper.floor(this.posX), 0, MathHelper.floor(this.posZ));
  4. if (this.world.isBlockLoaded(blockpos$mutableblockpos)) {
  5. blockpos$mutableblockpos.setY(MathHelper.floor(this.posY + (double) this.getEyeHeight()));
  6. if (world.getBlockState(blockpos$mutableblockpos).getMaterial() == Material.SAND || this.isEntityInsideOpaqueBlock()) {
  7. blockpos$mutableblockpos.setY(world.getHeight(MathHelper.floor(this.posX), MathHelper.floor(this.posZ)));
  8. }
  9. return this.world.getCombinedLight(blockpos$mutableblockpos, 0);
  10. } else {
  11. return 0;
  12. }
  13. }

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

  1. final int brightness = world.getCombinedLight(pos, fluid.getFluid().getLuminosity(fluid));
  2. final int l1 = brightness >> 16 & 0xFFFF, l2 = brightness & 0xFFFF;
  3. final int color = fluid.getFluid().getColor(fluid);

代码示例来源:origin: squeek502/VeganOption

  1. buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
  2. int brightness = getWorld().getCombinedLight(basin.getPos(), tankInfo.fluid.getFluid().getLuminosity());
  3. float percentFull = (float) tankInfo.fluid.amount / tankInfo.capacity;

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

  1. @Override
  2. public void renderFluid(FluidStack fluid) {
  3. float height = Math.min(0.95F, ((float) fluid.amount / (float) lastTile.getTank().getCapacity())) * 0.1875F + 0.8125F;
  4. int brightness = lastTile.getWorld().getCombinedLight(lastTile.getPos(), fluid.getFluid().getLuminosity(fluid));
  5. int l2 = brightness >> 0x10 & 0xFFFF;
  6. int i3 = brightness & 0xFFFF;
  7. TextureAtlasSprite icon = RenderHelpers.getFluidIcon(lastTile.getTank().getFluid(), EnumFacing.UP);
  8. Tessellator t = Tessellator.getInstance();
  9. BufferBuilder worldRenderer = t.getBuffer();
  10. worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR);
  11. worldRenderer.pos(0.1875F, height, 0.1875F).tex(icon.getMinU(), icon.getMaxV()).lightmap(l2, i3).color(1F, 1, 1, 1).endVertex();
  12. worldRenderer.pos(0.1875F, height, 0.8125F).tex(icon.getMinU(), icon.getMinV()).lightmap(l2, i3).color(1F, 1, 1, 1).endVertex();
  13. worldRenderer.pos(0.8125F, height, 0.8125F).tex(icon.getMaxU(), icon.getMinV()).lightmap(l2, i3).color(1F, 1, 1, 1).endVertex();
  14. worldRenderer.pos(0.8125F, height, 0.1875F).tex(icon.getMaxU(), icon.getMaxV()).lightmap(l2, i3).color(1F, 1, 1, 1).endVertex();
  15. t.draw();
  16. }
  17. }

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

  1. @Override
  2. public void renderFluid(FluidStack fluid) {
  3. double height = Math.max(0.0625D - OFFSET, ((double) fluid.amount) * 0.0625D / Fluid.BUCKET_VOLUME + 0.0625D - OFFSET);
  4. int brightness = lastTile.getWorld().getCombinedLight(lastTile.getPos(), fluid.getFluid().getLuminosity(fluid));
  5. int l2 = brightness >> 0x10 & 0xFFFF;
  6. int i3 = brightness & 0xFFFF;
  7. for(EnumFacing side : DirectionHelpers.DIRECTIONS) {
  8. TextureAtlasSprite icon = RenderHelpers.getFluidIcon(lastTile.getTank().getFluid(), EnumFacing.UP);
  9. Tessellator t = Tessellator.getInstance();
  10. BufferBuilder worldRenderer = t.getBuffer();
  11. worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR);
  12. double[][] c = coordinates[side.ordinal()];
  13. double replacedMaxV = (side == EnumFacing.UP || side == EnumFacing.DOWN) ?
  14. icon.getMaxV() : ((icon.getMaxV() - icon.getMinV()) * height + icon.getMinV());
  15. worldRenderer.pos(c[0][0], getHeight(side, c[0][1], height), c[0][2]).tex(icon.getMinU(), replacedMaxV).lightmap(l2, i3).color(1F, 1, 1, 1).endVertex();
  16. worldRenderer.pos(c[1][0], getHeight(side, c[1][1], height), c[1][2]).tex(icon.getMinU(), icon.getMinV()).lightmap(l2, i3).color(1F, 1, 1, 1).endVertex();
  17. worldRenderer.pos(c[2][0], getHeight(side, c[2][1], height), c[2][2]).tex(icon.getMaxU(), icon.getMinV()).lightmap(l2, i3).color(1F, 1, 1, 1).endVertex();
  18. worldRenderer.pos(c[3][0], getHeight(side, c[3][1], height), c[3][2]).tex(icon.getMaxU(), replacedMaxV).lightmap(l2, i3).color(1F, 1, 1, 1).endVertex();
  19. t.draw();
  20. }
  21. }

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

  1. @Override
  2. public void renderFluid(FluidStack fluid) {
  3. double height = (fluid.amount * 0.7D) / Fluid.BUCKET_VOLUME + 0.23D + 0.01D;
  4. int brightness = lastTile.getWorld().getCombinedLight(lastTile.getPos(), fluid.getFluid().getLuminosity(fluid));
  5. int l2 = brightness >> 0x10 & 0xFFFF;
  6. int i3 = brightness & 0xFFFF;
  7. TextureAtlasSprite icon = RenderHelpers.getFluidIcon(lastTile.getTank().getFluid(), EnumFacing.UP);
  8. Tessellator t = Tessellator.getInstance();
  9. BufferBuilder worldRenderer = t.getBuffer();
  10. worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR);
  11. worldRenderer.pos(0.0625F, height, 0.0625F).tex(icon.getMinU(), icon.getMaxV()).lightmap(l2, i3).color(1F, 1, 1, 1).endVertex();
  12. worldRenderer.pos(0.0625F, height, 0.9375F).tex(icon.getMinU(), icon.getMinV()).lightmap(l2, i3).color(1F, 1, 1, 1).endVertex();
  13. worldRenderer.pos(0.9375F, height, 0.9375F).tex(icon.getMaxU(), icon.getMinV()).lightmap(l2, i3).color(1F, 1, 1, 1).endVertex();
  14. worldRenderer.pos(0.9375F, height, 0.0625F).tex(icon.getMaxU(), icon.getMaxV()).lightmap(l2, i3).color(1F, 1, 1, 1).endVertex();
  15. t.draw();
  16. }

相关文章

World类方法