本文整理了Java中net.minecraft.world.World.getCombinedLight()
方法的一些代码示例,展示了World.getCombinedLight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。World.getCombinedLight()
方法的具体详情如下:
包路径:net.minecraft.world.World
类名称:World
方法名:getCombinedLight
暂无
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
public int getCombinedLight(@Nonnull BlockPos pos, int lightValue) {
return wrapped.getCombinedLight(pos, lightValue);
}
代码示例来源:origin: Direwolf20-MC/BuildingGadgets
@Override
@SideOnly(Side.CLIENT)
public int getCombinedLight(BlockPos pos, int lightValue) {
return realWorld.getCombinedLight(pos, lightValue);
}
代码示例来源:origin: amadornes/MCMultiPart
@Override
public int getCombinedLight(BlockPos pos, int lightValue) {
return getActualWorld().getCombinedLight(pos, lightValue);
}
代码示例来源:origin: PrinceOfAmber/Cyclic
public void fixLighting(TileEntity te) {
int ambLight = getWorld().getCombinedLight(te.getPos().offset(EnumFacing.UP), 0);
if (ambLight == 0) {
ambLight = 15728656;//if there is a block above blocking light, dont make it dark
}
int lu = ambLight % 65536;
int lv = ambLight / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lu / 1.0F, lv / 1.0F);
//end of 'fix lighting'
}
代码示例来源:origin: CyclopsMC/EvilCraft
@Override
public void renderFluid(FluidStack fluid) {
double height = tile.getFillRatio() * 0.99D;
renderFluidSides(height, fluid, tile.getWorld().getCombinedLight(tile.getPos(), fluid.getFluid().getLuminosity(fluid)));
}
代码示例来源:origin: CoFH/CoFHCore
public static void setupLight(TileEntity tile, EnumFacing side) {
if (tile == null) {
return;
}
BlockPos pos = tile.getPos().offset(side);
World world = tile.getWorld();
if (world.getBlockState(pos).isOpaqueCube()) {
return;
}
int br = world.getCombinedLight(pos, 4);
int brX = br & 65535;
int brY = br >>> 16;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, brX, brY);
}
代码示例来源:origin: SleepyTrousers/EnderIO
protected void renderItemStack(@Nonnull EnumFacing facing, @Nonnull BlockPos pos, @Nonnull ItemStack floatingItem, @Nonnull World world, float tick) {
RenderUtil.bindBlockTexture();
rand.setSeed(pos.getX() + pos.getY() + pos.getZ());
rand.nextBoolean();
int i = world.getCombinedLight(pos.offset(facing), 0);
int j = i % 65536;
int k = (int) (180 + (60 * MathHelper.sin((float) ((EnderIO.proxy.getTickCount() * 0.145D + (tick * 0.145D) + rand.nextDouble()) % (Math.PI * 2)))));
if (EnderIO.proxy.getTickCount() % 10 == 0) {
// j = k = 240;
}
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j, k);
GlStateManager.pushMatrix();
EnumFacing offsetDir = facing.rotateY();
double offsetX = 0.5 + (offsetDir.getFrontOffsetX() * 2.5 / 16D) + (facing.getFrontOffsetX() * 3.0 / 16D);
double offsetY = 5 / 16D;
double offsetZ = 0.5 + (offsetDir.getFrontOffsetZ() * 2.5 / 16D) + (facing.getFrontOffsetZ() * 3.0 / 16D);
GlStateManager.translate(offsetX, offsetY, offsetZ);
GlStateManager.scale(0.9, 0.9, 0.9);
// glScalef(1.1f, 1.1f, 1.1f);
if (Minecraft.getMinecraft().gameSettings.fancyGraphics) {
GlStateManager.rotate(rand.nextFloat() * 360f, 0, 1, 0);
}
double rot = (EnderIO.proxy.getTickCount() * 0.05D + (tick * 0.05D) + rand.nextDouble()) % (Math.PI * 2);
doRender(world, floatingItem, rot);
GlStateManager.popMatrix();
}
代码示例来源:origin: P3pp3rF1y/AncientWarfare2
@Override
@SideOnly(Side.CLIENT)
public int getBrightnessForRender() {
int i = MathHelper.floor(this.posX);
int j = MathHelper.floor(this.posZ);
int k = MathHelper.floor(this.posY);
if (pos1.getY() > k)
k = pos1.getY();
if (pos2.getY() > k)
k = pos2.getY();
return this.world.getCombinedLight(new BlockPos(i, k, j), 0);
}
代码示例来源:origin: MightyPirates/TIS-3D
final int brightness = getWorld().getCombinedLight(
casing.getPosition().offset(Face.toEnumFacing(face)), 0);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, brightness % 65536, brightness / 65536);
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
@SideOnly(Side.CLIENT)
public int getBrightnessForRender() {
int i = MathHelper.floor(this.posX);
int j = MathHelper.floor(this.posZ);
if (!world.isAirBlock(new BlockPos(i, 0, j))) {
double d0 = (getEntityBoundingBox().maxY - getEntityBoundingBox().minY) * 0.66D;
int k = MathHelper.floor(this.posY - getYOffset() + d0);
return world.getCombinedLight(new BlockPos(i, k, j), 0);
} else {
return 0;
}
}
代码示例来源:origin: JurassiCraftTeam/JurassiCraft2
private void setLightmap(AttractionSignEntity sign, float xzOffset, float yOffset) {
int posX = MathHelper.floor(sign.posX);
int posY = MathHelper.floor(sign.posY + (yOffset / 16.0F));
int posZ = MathHelper.floor(sign.posZ);
EnumFacing direction = sign.facingDirection;
if (direction == EnumFacing.NORTH) {
posX = MathHelper.floor(sign.posX + (xzOffset / 16.0F));
} else if (direction == EnumFacing.WEST) {
posZ = MathHelper.floor(sign.posZ - (xzOffset / 16.0F));
} else if (direction == EnumFacing.SOUTH) {
posX = MathHelper.floor(sign.posX - (xzOffset / 16.0F));
} else if (direction == EnumFacing.EAST) {
posZ = MathHelper.floor(sign.posZ + (xzOffset / 16.0F));
}
int combinedLight = this.renderManager.world.getCombinedLight(new BlockPos(posX, posY, posZ), 0);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, combinedLight % 65536, combinedLight / 65536.0F);
GlStateManager.color(1.0F, 1.0F, 1.0F);
}
}
代码示例来源:origin: JurassiCraftTeam/JurassiCraft2
private void setLightmap(PaddockSignEntity sign, float xzOffset, float yOffset) {
int posX = MathHelper.floor(sign.posX);
int posY = MathHelper.floor(sign.posY + (yOffset / 16.0F));
int posZ = MathHelper.floor(sign.posZ);
EnumFacing direction = sign.facingDirection;
if (direction == EnumFacing.NORTH) {
posX = MathHelper.floor(sign.posX + (xzOffset / 16.0F));
} else if (direction == EnumFacing.WEST) {
posZ = MathHelper.floor(sign.posZ - (xzOffset / 16.0F));
} else if (direction == EnumFacing.SOUTH) {
posX = MathHelper.floor(sign.posX - (xzOffset / 16.0F));
} else if (direction == EnumFacing.EAST) {
posZ = MathHelper.floor(sign.posZ + (xzOffset / 16.0F));
}
int combinedLight = this.renderManager.world.getCombinedLight(new BlockPos(posX, posY, posZ), 0);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, combinedLight % 65536, combinedLight / 65536.0F);
GlStateManager.color(1.0F, 1.0F, 1.0F);
}
}
代码示例来源:origin: JurassiCraftTeam/JurassiCraft2
private void setLightmap(MuralEntity sign, float xzOffset, float yOffset) {
int posX = MathHelper.floor(sign.posX);
int posY = MathHelper.floor(sign.posY + (yOffset / 16.0F));
int posZ = MathHelper.floor(sign.posZ);
EnumFacing direction = sign.facingDirection;
if (direction == EnumFacing.NORTH) {
posX = MathHelper.floor(sign.posX + (xzOffset / 16.0F));
} else if (direction == EnumFacing.WEST) {
posZ = MathHelper.floor(sign.posZ - (xzOffset / 16.0F));
} else if (direction == EnumFacing.SOUTH) {
posX = MathHelper.floor(sign.posX - (xzOffset / 16.0F));
} else if (direction == EnumFacing.EAST) {
posZ = MathHelper.floor(sign.posZ + (xzOffset / 16.0F));
}
int combinedLight = this.renderManager.world.getCombinedLight(new BlockPos(posX, posY, posZ), 0);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, combinedLight % 65536, combinedLight / 65536.0F);
GlStateManager.color(1.0F, 1.0F, 1.0F);
}
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
final int br = tile.getWorld().getCombinedLight( tile.getPos(), 0 );
final int var11 = br % 65536;
final int var12 = br / 65536;
代码示例来源:origin: Alex-the-666/Ice_and_Fire
@SideOnly(Side.CLIENT)
public int getBrightnessForRender() {
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(MathHelper.floor(this.posX), 0, MathHelper.floor(this.posZ));
if (this.world.isBlockLoaded(blockpos$mutableblockpos)) {
blockpos$mutableblockpos.setY(MathHelper.floor(this.posY + (double) this.getEyeHeight()));
if (world.getBlockState(blockpos$mutableblockpos).getMaterial() == Material.SAND || this.isEntityInsideOpaqueBlock()) {
blockpos$mutableblockpos.setY(world.getHeight(MathHelper.floor(this.posX), MathHelper.floor(this.posZ)));
}
return this.world.getCombinedLight(blockpos$mutableblockpos, 0);
} else {
return 0;
}
}
代码示例来源:origin: SleepyTrousers/EnderIO
final int brightness = world.getCombinedLight(pos, fluid.getFluid().getLuminosity(fluid));
final int l1 = brightness >> 16 & 0xFFFF, l2 = brightness & 0xFFFF;
final int color = fluid.getFluid().getColor(fluid);
代码示例来源:origin: squeek502/VeganOption
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
int brightness = getWorld().getCombinedLight(basin.getPos(), tankInfo.fluid.getFluid().getLuminosity());
float percentFull = (float) tankInfo.fluid.amount / tankInfo.capacity;
代码示例来源:origin: CyclopsMC/EvilCraft
@Override
public void renderFluid(FluidStack fluid) {
float height = Math.min(0.95F, ((float) fluid.amount / (float) lastTile.getTank().getCapacity())) * 0.1875F + 0.8125F;
int brightness = lastTile.getWorld().getCombinedLight(lastTile.getPos(), fluid.getFluid().getLuminosity(fluid));
int l2 = brightness >> 0x10 & 0xFFFF;
int i3 = brightness & 0xFFFF;
TextureAtlasSprite icon = RenderHelpers.getFluidIcon(lastTile.getTank().getFluid(), EnumFacing.UP);
Tessellator t = Tessellator.getInstance();
BufferBuilder worldRenderer = t.getBuffer();
worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR);
worldRenderer.pos(0.1875F, height, 0.1875F).tex(icon.getMinU(), icon.getMaxV()).lightmap(l2, i3).color(1F, 1, 1, 1).endVertex();
worldRenderer.pos(0.1875F, height, 0.8125F).tex(icon.getMinU(), icon.getMinV()).lightmap(l2, i3).color(1F, 1, 1, 1).endVertex();
worldRenderer.pos(0.8125F, height, 0.8125F).tex(icon.getMaxU(), icon.getMinV()).lightmap(l2, i3).color(1F, 1, 1, 1).endVertex();
worldRenderer.pos(0.8125F, height, 0.1875F).tex(icon.getMaxU(), icon.getMaxV()).lightmap(l2, i3).color(1F, 1, 1, 1).endVertex();
t.draw();
}
}
代码示例来源:origin: CyclopsMC/IntegratedDynamics
@Override
public void renderFluid(FluidStack fluid) {
double height = Math.max(0.0625D - OFFSET, ((double) fluid.amount) * 0.0625D / Fluid.BUCKET_VOLUME + 0.0625D - OFFSET);
int brightness = lastTile.getWorld().getCombinedLight(lastTile.getPos(), fluid.getFluid().getLuminosity(fluid));
int l2 = brightness >> 0x10 & 0xFFFF;
int i3 = brightness & 0xFFFF;
for(EnumFacing side : DirectionHelpers.DIRECTIONS) {
TextureAtlasSprite icon = RenderHelpers.getFluidIcon(lastTile.getTank().getFluid(), EnumFacing.UP);
Tessellator t = Tessellator.getInstance();
BufferBuilder worldRenderer = t.getBuffer();
worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR);
double[][] c = coordinates[side.ordinal()];
double replacedMaxV = (side == EnumFacing.UP || side == EnumFacing.DOWN) ?
icon.getMaxV() : ((icon.getMaxV() - icon.getMinV()) * height + icon.getMinV());
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();
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();
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();
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();
t.draw();
}
}
代码示例来源:origin: CyclopsMC/IntegratedDynamics
@Override
public void renderFluid(FluidStack fluid) {
double height = (fluid.amount * 0.7D) / Fluid.BUCKET_VOLUME + 0.23D + 0.01D;
int brightness = lastTile.getWorld().getCombinedLight(lastTile.getPos(), fluid.getFluid().getLuminosity(fluid));
int l2 = brightness >> 0x10 & 0xFFFF;
int i3 = brightness & 0xFFFF;
TextureAtlasSprite icon = RenderHelpers.getFluidIcon(lastTile.getTank().getFluid(), EnumFacing.UP);
Tessellator t = Tessellator.getInstance();
BufferBuilder worldRenderer = t.getBuffer();
worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR);
worldRenderer.pos(0.0625F, height, 0.0625F).tex(icon.getMinU(), icon.getMaxV()).lightmap(l2, i3).color(1F, 1, 1, 1).endVertex();
worldRenderer.pos(0.0625F, height, 0.9375F).tex(icon.getMinU(), icon.getMinV()).lightmap(l2, i3).color(1F, 1, 1, 1).endVertex();
worldRenderer.pos(0.9375F, height, 0.9375F).tex(icon.getMaxU(), icon.getMinV()).lightmap(l2, i3).color(1F, 1, 1, 1).endVertex();
worldRenderer.pos(0.9375F, height, 0.0625F).tex(icon.getMaxU(), icon.getMaxV()).lightmap(l2, i3).color(1F, 1, 1, 1).endVertex();
t.draw();
}
内容来源于网络,如有侵权,请联系作者删除!