java类net.minecraft.world.EnumSkyBlock的实例源码

Chunk.java 文件源码 项目:DecompiledMinecraft 阅读 31 收藏 0 点赞 0 评论 0
public int getLightSubtracted(BlockPos pos, int amount)
{
    int i = pos.getX() & 15;
    int j = pos.getY();
    int k = pos.getZ() & 15;
    ExtendedBlockStorage extendedblockstorage = this.storageArrays[j >> 4];

    if (extendedblockstorage == null)
    {
        return !this.worldObj.provider.getHasNoSky() && amount < EnumSkyBlock.SKY.defaultLightValue ? EnumSkyBlock.SKY.defaultLightValue - amount : 0;
    }
    else
    {
        int l = this.worldObj.provider.getHasNoSky() ? 0 : extendedblockstorage.getExtSkylightValue(i, j & 15, k);
        l = l - amount;
        int i1 = extendedblockstorage.getExtBlocklightValue(i, j & 15, k);

        if (i1 > l)
        {
            l = i1;
        }

        return l;
    }
}
EntityMob.java 文件源码 项目:DecompiledMinecraft 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Checks to make sure the light is not too bright where the mob is spawning
 */
protected boolean isValidLightLevel()
{
    BlockPos blockpos = new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ);

    if (this.worldObj.getLightFor(EnumSkyBlock.SKY, blockpos) > this.rand.nextInt(32))
    {
        return false;
    }
    else
    {
        int i = this.worldObj.getLightFromNeighbors(blockpos);

        if (this.worldObj.isThundering())
        {
            int j = this.worldObj.getSkylightSubtracted();
            this.worldObj.setSkylightSubtracted(10);
            i = this.worldObj.getLightFromNeighbors(blockpos);
            this.worldObj.setSkylightSubtracted(j);
        }

        return i <= this.rand.nextInt(8);
    }
}
BlockDaylightDetector.java 文件源码 项目:DecompiledMinecraft 阅读 21 收藏 0 点赞 0 评论 0
public void updatePower(World worldIn, BlockPos pos)
{
    if (!worldIn.provider.getHasNoSky())
    {
        IBlockState iblockstate = worldIn.getBlockState(pos);
        int i = worldIn.getLightFor(EnumSkyBlock.SKY, pos) - worldIn.getSkylightSubtracted();
        float f = worldIn.getCelestialAngleRadians(1.0F);
        float f1 = f < (float)Math.PI ? 0.0F : ((float)Math.PI * 2F);
        f = f + (f1 - f) * 0.2F;
        i = Math.round((float)i * MathHelper.cos(f));
        i = MathHelper.clamp_int(i, 0, 15);

        if (this.inverted)
        {
            i = 15 - i;
        }

        if (((Integer)iblockstate.getValue(POWER)).intValue() != i)
        {
            worldIn.setBlockState(pos, iblockstate.withProperty(POWER, Integer.valueOf(i)), 3);
        }
    }
}
Chunk.java 文件源码 项目:DecompiledMinecraft 阅读 25 收藏 0 点赞 0 评论 0
public int getLightSubtracted(BlockPos pos, int amount)
{
    int i = pos.getX() & 15;
    int j = pos.getY();
    int k = pos.getZ() & 15;
    ExtendedBlockStorage extendedblockstorage = this.storageArrays[j >> 4];

    if (extendedblockstorage == null)
    {
        return !this.worldObj.provider.getHasNoSky() && amount < EnumSkyBlock.SKY.defaultLightValue ? EnumSkyBlock.SKY.defaultLightValue - amount : 0;
    }
    else
    {
        int l = this.worldObj.provider.getHasNoSky() ? 0 : extendedblockstorage.getExtSkylightValue(i, j & 15, k);
        l = l - amount;
        int i1 = extendedblockstorage.getExtBlocklightValue(i, j & 15, k);

        if (i1 > l)
        {
            l = i1;
        }

        return l;
    }
}
EntityMob.java 文件源码 项目:DecompiledMinecraft 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Checks to make sure the light is not too bright where the mob is spawning
 */
protected boolean isValidLightLevel()
{
    BlockPos blockpos = new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ);

    if (this.worldObj.getLightFor(EnumSkyBlock.SKY, blockpos) > this.rand.nextInt(32))
    {
        return false;
    }
    else
    {
        int i = this.worldObj.getLightFromNeighbors(blockpos);

        if (this.worldObj.isThundering())
        {
            int j = this.worldObj.getSkylightSubtracted();
            this.worldObj.setSkylightSubtracted(10);
            i = this.worldObj.getLightFromNeighbors(blockpos);
            this.worldObj.setSkylightSubtracted(j);
        }

        return i <= this.rand.nextInt(8);
    }
}
BlockDaylightDetector.java 文件源码 项目:DecompiledMinecraft 阅读 20 收藏 0 点赞 0 评论 0
public void updatePower(World worldIn, BlockPos pos)
{
    if (!worldIn.provider.getHasNoSky())
    {
        IBlockState iblockstate = worldIn.getBlockState(pos);
        int i = worldIn.getLightFor(EnumSkyBlock.SKY, pos) - worldIn.getSkylightSubtracted();
        float f = worldIn.getCelestialAngleRadians(1.0F);
        float f1 = f < (float)Math.PI ? 0.0F : ((float)Math.PI * 2F);
        f = f + (f1 - f) * 0.2F;
        i = Math.round((float)i * MathHelper.cos(f));
        i = MathHelper.clamp_int(i, 0, 15);

        if (this.inverted)
        {
            i = 15 - i;
        }

        if (((Integer)iblockstate.getValue(POWER)).intValue() != i)
        {
            worldIn.setBlockState(pos, iblockstate.withProperty(POWER, Integer.valueOf(i)), 3);
        }
    }
}
Chunk.java 文件源码 项目:BaseClient 阅读 24 收藏 0 点赞 0 评论 0
public int getLightSubtracted(BlockPos pos, int amount)
{
    int i = pos.getX() & 15;
    int j = pos.getY();
    int k = pos.getZ() & 15;
    ExtendedBlockStorage extendedblockstorage = this.storageArrays[j >> 4];

    if (extendedblockstorage == null)
    {
        return !this.worldObj.provider.getHasNoSky() && amount < EnumSkyBlock.SKY.defaultLightValue ? EnumSkyBlock.SKY.defaultLightValue - amount : 0;
    }
    else
    {
        int l = this.worldObj.provider.getHasNoSky() ? 0 : extendedblockstorage.getExtSkylightValue(i, j & 15, k);
        l = l - amount;
        int i1 = extendedblockstorage.getExtBlocklightValue(i, j & 15, k);

        if (i1 > l)
        {
            l = i1;
        }

        return l;
    }
}
EntityMob.java 文件源码 项目:BaseClient 阅读 29 收藏 0 点赞 0 评论 0
/**
 * Checks to make sure the light is not too bright where the mob is spawning
 */
protected boolean isValidLightLevel()
{
    BlockPos blockpos = new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ);

    if (this.worldObj.getLightFor(EnumSkyBlock.SKY, blockpos) > this.rand.nextInt(32))
    {
        return false;
    }
    else
    {
        int i = this.worldObj.getLightFromNeighbors(blockpos);

        if (this.worldObj.isThundering())
        {
            int j = this.worldObj.getSkylightSubtracted();
            this.worldObj.setSkylightSubtracted(10);
            i = this.worldObj.getLightFromNeighbors(blockpos);
            this.worldObj.setSkylightSubtracted(j);
        }

        return i <= this.rand.nextInt(8);
    }
}
BlockDaylightDetector.java 文件源码 项目:BaseClient 阅读 26 收藏 0 点赞 0 评论 0
public void updatePower(World worldIn, BlockPos pos)
{
    if (!worldIn.provider.getHasNoSky())
    {
        IBlockState iblockstate = worldIn.getBlockState(pos);
        int i = worldIn.getLightFor(EnumSkyBlock.SKY, pos) - worldIn.getSkylightSubtracted();
        float f = worldIn.getCelestialAngleRadians(1.0F);
        float f1 = f < (float)Math.PI ? 0.0F : ((float)Math.PI * 2F);
        f = f + (f1 - f) * 0.2F;
        i = Math.round((float)i * MathHelper.cos(f));
        i = MathHelper.clamp_int(i, 0, 15);

        if (this.inverted)
        {
            i = 15 - i;
        }

        if (((Integer)iblockstate.getValue(POWER)).intValue() != i)
        {
            worldIn.setBlockState(pos, iblockstate.withProperty(POWER, Integer.valueOf(i)), 3);
        }
    }
}
Chunk.java 文件源码 项目:BaseClient 阅读 28 收藏 0 点赞 0 评论 0
public int getLightSubtracted(BlockPos pos, int amount)
{
    int i = pos.getX() & 15;
    int j = pos.getY();
    int k = pos.getZ() & 15;
    ExtendedBlockStorage extendedblockstorage = this.storageArrays[j >> 4];

    if (extendedblockstorage == null)
    {
        return !this.worldObj.provider.getHasNoSky() && amount < EnumSkyBlock.SKY.defaultLightValue ? EnumSkyBlock.SKY.defaultLightValue - amount : 0;
    }
    else
    {
        int l = this.worldObj.provider.getHasNoSky() ? 0 : extendedblockstorage.getExtSkylightValue(i, j & 15, k);
        l = l - amount;
        int i1 = extendedblockstorage.getExtBlocklightValue(i, j & 15, k);

        if (i1 > l)
        {
            l = i1;
        }

        return l;
    }
}
EntityMob.java 文件源码 项目:BaseClient 阅读 31 收藏 0 点赞 0 评论 0
/**
 * Checks to make sure the light is not too bright where the mob is spawning
 */
protected boolean isValidLightLevel()
{
    BlockPos blockpos = new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ);

    if (this.worldObj.getLightFor(EnumSkyBlock.SKY, blockpos) > this.rand.nextInt(32))
    {
        return false;
    }
    else
    {
        int i = this.worldObj.getLightFromNeighbors(blockpos);

        if (this.worldObj.isThundering())
        {
            int j = this.worldObj.getSkylightSubtracted();
            this.worldObj.setSkylightSubtracted(10);
            i = this.worldObj.getLightFromNeighbors(blockpos);
            this.worldObj.setSkylightSubtracted(j);
        }

        return i <= this.rand.nextInt(8);
    }
}
BlockDaylightDetector.java 文件源码 项目:BaseClient 阅读 24 收藏 0 点赞 0 评论 0
public void updatePower(World worldIn, BlockPos pos)
{
    if (!worldIn.provider.getHasNoSky())
    {
        IBlockState iblockstate = worldIn.getBlockState(pos);
        int i = worldIn.getLightFor(EnumSkyBlock.SKY, pos) - worldIn.getSkylightSubtracted();
        float f = worldIn.getCelestialAngleRadians(1.0F);
        float f1 = f < (float)Math.PI ? 0.0F : ((float)Math.PI * 2F);
        f = f + (f1 - f) * 0.2F;
        i = Math.round((float)i * MathHelper.cos(f));
        i = MathHelper.clamp_int(i, 0, 15);

        if (this.inverted)
        {
            i = 15 - i;
        }

        if (((Integer)iblockstate.getValue(POWER)).intValue() != i)
        {
            worldIn.setBlockState(pos, iblockstate.withProperty(POWER, Integer.valueOf(i)), 3);
        }
    }
}
InvertedDaylightDetector.java 文件源码 项目:connor41-etfuturum2 阅读 18 收藏 0 点赞 0 评论 0
@Override
public void func_149957_e(World world, int x, int y, int z) {
    if (!world.provider.hasNoSky) {
        int meta = world.getBlockMetadata(x, y, z);
        int light = world.getSavedLightValue(EnumSkyBlock.Sky, x, y, z) - world.skylightSubtracted;
        float angle = world.getCelestialAngleRadians(1.0F);

        if (angle < (float) Math.PI)
            angle += (0.0F - angle) * 0.2F;
        else
            angle += ((float) Math.PI * 2F - angle) * 0.2F;

        light = Math.round(light * MathHelper.cos(angle));

        if (light < 0)
            light = 0;
        if (light > 15)
            light = 15;

        light = invertedValues[light];
        if (meta != light)
            world.setBlockMetadataWithNotify(x, y, z, light, 3);
    }
}
EntityUtils.java 文件源码 项目:Halloween 阅读 29 收藏 0 点赞 0 评论 0
/**
 * Checks to make sure the light is not too bright where the mob is spawning
 * Adapted from net.minecraft.entity.monster.EntityMob#isValidLightLevel
 *
 */
private static boolean EntityMob_isValidLightLevel(EntityLivingBase entity)
{
    BlockPos pos = new BlockPos(entity.posX, entity.getEntityBoundingBox().minY, entity.posZ);
    if (entity.world.getLightFor(EnumSkyBlock.SKY, pos) > entity.world.rand.nextInt(32))
    {
        return false;
    }
    else
    {
        int i = entity.world.getLightFromNeighbors(pos);
        if (entity.world.isThundering())
        {
            int j = entity.world.getSkylightSubtracted();
            entity.world.setSkylightSubtracted(10);
            i = entity.world.getLightFromNeighbors(pos);
            entity.world.setSkylightSubtracted(j);
        }
        return i <= entity.world.rand.nextInt(8);
    }
}
DevilSnare.java 文件源码 项目:uniquecrops 阅读 20 收藏 0 点赞 0 评论 0
private void trySpread(World world, BlockPos pos) {

    for (EnumFacing face : EnumFacing.HORIZONTALS) {
        BlockPos looppos = pos.offset(face);
        if (world.getLightFor(EnumSkyBlock.BLOCK, looppos) > 5) continue;
        if (world.isAirBlock(looppos) && (world.getBlockState(looppos.down()).getBlock() == Blocks.DIRT || world.getBlockState(looppos.down()).getBlock() == Blocks.FARMLAND)) {
            if (world.rand.nextInt(2) == 0) {
                if (world.getBlockState(looppos.down()).getBlock() == Blocks.DIRT)
                    world.setBlockState(looppos.down(), Blocks.FARMLAND.getDefaultState(), 3);
                else
                    world.setBlockState(looppos, UCBlocks.cropDevilsnare.getDefaultState(), 3);
                break;
            }
        }
    }
}
TileEntityIronFurnace.java 文件源码 项目:morefurnaces 阅读 24 收藏 0 点赞 0 评论 0
@Override
public boolean receiveClientEvent(int i, int j)
{
    if (world != null && !world.isRemote) return true;
    if (i == 1)
    {
        facing = (byte) j;
        return true;
    } else if (i == 2)
    {
        isActive = j == 1;
        if (world != null)
            world.checkLightFor(EnumSkyBlock.BLOCK, pos);
        else
            updateLight = true;
        return true;
    }
    return super.receiveClientEvent(i, j);
}
Chunk.java 文件源码 项目:Backmemed 阅读 26 收藏 0 点赞 0 评论 0
public int getLightSubtracted(BlockPos pos, int amount)
{
    int i = pos.getX() & 15;
    int j = pos.getY();
    int k = pos.getZ() & 15;
    ExtendedBlockStorage extendedblockstorage = this.storageArrays[j >> 4];

    if (extendedblockstorage == NULL_BLOCK_STORAGE)
    {
        return this.worldObj.provider.func_191066_m() && amount < EnumSkyBlock.SKY.defaultLightValue ? EnumSkyBlock.SKY.defaultLightValue - amount : 0;
    }
    else
    {
        int l = !this.worldObj.provider.func_191066_m() ? 0 : extendedblockstorage.getExtSkylightValue(i, j & 15, k);
        l = l - amount;
        int i1 = extendedblockstorage.getExtBlocklightValue(i, j & 15, k);

        if (i1 > l)
        {
            l = i1;
        }

        return l;
    }
}
EntityMob.java 文件源码 项目:Backmemed 阅读 24 收藏 0 点赞 0 评论 0
/**
 * Checks to make sure the light is not too bright where the mob is spawning
 */
protected boolean isValidLightLevel()
{
    BlockPos blockpos = new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ);

    if (this.world.getLightFor(EnumSkyBlock.SKY, blockpos) > this.rand.nextInt(32))
    {
        return false;
    }
    else
    {
        int i = this.world.getLightFromNeighbors(blockpos);

        if (this.world.isThundering())
        {
            int j = this.world.getSkylightSubtracted();
            this.world.setSkylightSubtracted(10);
            i = this.world.getLightFromNeighbors(blockpos);
            this.world.setSkylightSubtracted(j);
        }

        return i <= this.rand.nextInt(8);
    }
}
EntityTF2Character.java 文件源码 项目:Mods 阅读 21 收藏 0 点赞 0 评论 0
protected boolean isValidLightLevel() {
    BlockPos blockpos = new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ);

    if (this.world.getLightFor(EnumSkyBlock.SKY, blockpos) > this.rand.nextInt(32))
        return false;
    else {
        int i = this.world.getLightFromNeighbors(blockpos);

        if (this.world.isThundering()) {
            int j = this.world.getSkylightSubtracted();
            this.world.setSkylightSubtracted(10);
            i = this.world.getLightFromNeighbors(blockpos);
            this.world.setSkylightSubtracted(j);
        }

        return i <= 4 + this.rand.nextInt(4);
    }
}
Chunk.java 文件源码 项目:CustomWorldGen 阅读 21 收藏 0 点赞 0 评论 0
public int getLightSubtracted(BlockPos pos, int amount)
{
    int i = pos.getX() & 15;
    int j = pos.getY();
    int k = pos.getZ() & 15;
    ExtendedBlockStorage extendedblockstorage = this.storageArrays[j >> 4];

    if (extendedblockstorage == NULL_BLOCK_STORAGE)
    {
        return !this.worldObj.provider.getHasNoSky() && amount < EnumSkyBlock.SKY.defaultLightValue ? EnumSkyBlock.SKY.defaultLightValue - amount : 0;
    }
    else
    {
        int l = this.worldObj.provider.getHasNoSky() ? 0 : extendedblockstorage.getExtSkylightValue(i, j & 15, k);
        l = l - amount;
        int i1 = extendedblockstorage.getExtBlocklightValue(i, j & 15, k);

        if (i1 > l)
        {
            l = i1;
        }

        return l;
    }
}
EntityMob.java 文件源码 项目:CustomWorldGen 阅读 24 收藏 0 点赞 0 评论 0
/**
 * Checks to make sure the light is not too bright where the mob is spawning
 */
protected boolean isValidLightLevel()
{
    BlockPos blockpos = new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ);

    if (this.worldObj.getLightFor(EnumSkyBlock.SKY, blockpos) > this.rand.nextInt(32))
    {
        return false;
    }
    else
    {
        int i = this.worldObj.getLightFromNeighbors(blockpos);

        if (this.worldObj.isThundering())
        {
            int j = this.worldObj.getSkylightSubtracted();
            this.worldObj.setSkylightSubtracted(10);
            i = this.worldObj.getLightFromNeighbors(blockpos);
            this.worldObj.setSkylightSubtracted(j);
        }

        return i <= this.rand.nextInt(8);
    }
}
WorldClient.java 文件源码 项目:CustomWorldGen 阅读 37 收藏 0 点赞 0 评论 0
protected void playMoodSoundAndCheckLight(int p_147467_1_, int p_147467_2_, Chunk chunkIn)
{
    super.playMoodSoundAndCheckLight(p_147467_1_, p_147467_2_, chunkIn);

    if (this.ambienceTicks == 0)
    {
        this.updateLCG = this.updateLCG * 3 + 1013904223;
        int i = this.updateLCG >> 2;
        int j = i & 15;
        int k = i >> 8 & 15;
        int l = i >> 16 & 255;
        BlockPos blockpos = new BlockPos(j + p_147467_1_, l, k + p_147467_2_);
        IBlockState iblockstate = chunkIn.getBlockState(blockpos);
        j = j + p_147467_1_;
        k = k + p_147467_2_;

        if (iblockstate.getMaterial() == Material.AIR && this.getLight(blockpos) <= this.rand.nextInt(8) && this.getLightFor(EnumSkyBlock.SKY, blockpos) <= 0 && this.mc.thePlayer != null && this.mc.thePlayer.getDistanceSq((double)j + 0.5D, (double)l + 0.5D, (double)k + 0.5D) > 4.0D)
        {
            this.playSound((double)j + 0.5D, (double)l + 0.5D, (double)k + 0.5D, SoundEvents.AMBIENT_CAVE, SoundCategory.AMBIENT, 0.7F, 0.8F + this.rand.nextFloat() * 0.2F, false);
            this.ambienceTicks = this.rand.nextInt(12000) + 6000;
        }
    }
}
WorldDayLightSensor.java 文件源码 项目:pnc-repressurized 阅读 23 收藏 0 点赞 0 评论 0
public int updatePower(World worldIn, BlockPos pos) {
    if (worldIn.provider.hasSkyLight()) {
        int i = worldIn.getLightFor(EnumSkyBlock.SKY, pos) - worldIn.getSkylightSubtracted();
        float f = worldIn.getCelestialAngleRadians(1.0F);
        float f1 = f < (float) Math.PI ? 0.0F : (float) Math.PI * 2F;
        f = f + (f1 - f) * 0.2F;
        i = Math.round(i * MathHelper.cos(f));
        i = MathHelper.clamp(i, 0, 15);
        return i;
    }
    return 0;
}
TileEntityUVLightBox.java 文件源码 项目:pnc-repressurized 阅读 21 收藏 0 点赞 0 评论 0
private void setLightsOn(boolean lightsOn) {
    boolean check = areLightsOn != lightsOn;
    areLightsOn = lightsOn;
    if (check) {
        getWorld().checkLightFor(EnumSkyBlock.BLOCK, getPos());
        sendDescriptionPacket();
    }
}
OpLightUpdates.java 文件源码 项目:HardVox 阅读 23 收藏 0 点赞 0 评论 0
private boolean enlightenBlocks(int i, int j, int k, World world) {
    enlightenedBlocks.preload(i >> 4, k >> 4);
    Optional<ChunkPositionSet> chunkMapOpt = enlightenedBlocks.get(i >> 4, k >> 4);
    if (chunkMapOpt.map(m -> m.contains(i & 15, j, k & 15)).orElse(false)) {
        return false;
    }
    ChunkPositionSet chunkMap = chunkMapOpt.orElseGet(ChunkPositionSet::create);
    if (!chunkMapOpt.isPresent()) {
        enlightenedBlocks.put(i >> 4, k >> 4, chunkMap);
    }
    chunkMap.add(i & 15, j, k & 15);
    world.checkLightFor(EnumSkyBlock.BLOCK, new BlockPos(i, j, k));
    return true;
}
BaseHarshenParticle.java 文件源码 项目:harshencastle 阅读 23 收藏 0 点赞 0 评论 0
private int getLightCombonation(BlockPos pos, int lightValue)
{
    int i = world.getLightFromNeighborsFor(EnumSkyBlock.SKY, pos);
    int j = world.getLightFromNeighborsFor(EnumSkyBlock.BLOCK, pos);

    if (j < lightValue)
    {
        j = lightValue;
    }
    return i << 20 | j << 4;
}
Chunk.java 文件源码 项目:DecompiledMinecraft 阅读 21 收藏 0 点赞 0 评论 0
private void updateSkylightNeighborHeight(int x, int z, int startY, int endY)
{
    if (endY > startY && this.worldObj.isAreaLoaded(new BlockPos(x, 0, z), 16))
    {
        for (int i = startY; i < endY; ++i)
        {
            this.worldObj.checkLightFor(EnumSkyBlock.SKY, new BlockPos(x, i, z));
        }

        this.isModified = true;
    }
}
Chunk.java 文件源码 项目:DecompiledMinecraft 阅读 22 收藏 0 点赞 0 评论 0
public int getLightFor(EnumSkyBlock p_177413_1_, BlockPos pos)
{
    int i = pos.getX() & 15;
    int j = pos.getY();
    int k = pos.getZ() & 15;
    ExtendedBlockStorage extendedblockstorage = this.storageArrays[j >> 4];
    return extendedblockstorage == null ? (this.canSeeSky(pos) ? p_177413_1_.defaultLightValue : 0) : (p_177413_1_ == EnumSkyBlock.SKY ? (this.worldObj.provider.getHasNoSky() ? 0 : extendedblockstorage.getExtSkylightValue(i, j & 15, k)) : (p_177413_1_ == EnumSkyBlock.BLOCK ? extendedblockstorage.getExtBlocklightValue(i, j & 15, k) : p_177413_1_.defaultLightValue));
}
Chunk.java 文件源码 项目:DecompiledMinecraft 阅读 31 收藏 0 点赞 0 评论 0
public void setLightFor(EnumSkyBlock p_177431_1_, BlockPos pos, int value)
{
    int i = pos.getX() & 15;
    int j = pos.getY();
    int k = pos.getZ() & 15;
    ExtendedBlockStorage extendedblockstorage = this.storageArrays[j >> 4];

    if (extendedblockstorage == null)
    {
        extendedblockstorage = this.storageArrays[j >> 4] = new ExtendedBlockStorage(j >> 4 << 4, !this.worldObj.provider.getHasNoSky());
        this.generateSkylightMap();
    }

    this.isModified = true;

    if (p_177431_1_ == EnumSkyBlock.SKY)
    {
        if (!this.worldObj.provider.getHasNoSky())
        {
            extendedblockstorage.setExtSkylightValue(i, j & 15, k, value);
        }
    }
    else if (p_177431_1_ == EnumSkyBlock.BLOCK)
    {
        extendedblockstorage.setExtBlocklightValue(i, j & 15, k, value);
    }
}
BlockIce.java 文件源码 项目:DecompiledMinecraft 阅读 23 收藏 0 点赞 0 评论 0
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    if (worldIn.getLightFor(EnumSkyBlock.BLOCK, pos) > 11 - this.getLightOpacity())
    {
        if (worldIn.provider.doesWaterVaporize())
        {
            worldIn.setBlockToAir(pos);
        }
        else
        {
            this.dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0);
            worldIn.setBlockState(pos, Blocks.water.getDefaultState());
        }
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号