当前位置: 首页>>代码示例>>Java>>正文


Java EnumSkyBlock类代码示例

本文整理汇总了Java中net.minecraft.world.EnumSkyBlock的典型用法代码示例。如果您正苦于以下问题:Java EnumSkyBlock类的具体用法?Java EnumSkyBlock怎么用?Java EnumSkyBlock使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EnumSkyBlock类属于net.minecraft.world包,在下文中一共展示了EnumSkyBlock类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getLightSubtracted

import net.minecraft.world.EnumSkyBlock; //导入依赖的package包/类
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;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:26,代码来源:Chunk.java

示例2: isValidLightLevel

import net.minecraft.world.EnumSkyBlock; //导入依赖的package包/类
/**
 * 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);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:27,代码来源:EntityMob.java

示例3: updatePower

import net.minecraft.world.EnumSkyBlock; //导入依赖的package包/类
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);
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:24,代码来源:BlockDaylightDetector.java

示例4: func_149957_e

import net.minecraft.world.EnumSkyBlock; //导入依赖的package包/类
@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);
	}
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:25,代码来源:InvertedDaylightDetector.java

示例5: EntityMob_isValidLightLevel

import net.minecraft.world.EnumSkyBlock; //导入依赖的package包/类
/**
 * 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);
	}
}
 
开发者ID:crazysnailboy,项目名称:Halloween,代码行数:26,代码来源:EntityUtils.java

示例6: trySpread

import net.minecraft.world.EnumSkyBlock; //导入依赖的package包/类
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;
			}
		}
	}
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:17,代码来源:DevilSnare.java

示例7: receiveClientEvent

import net.minecraft.world.EnumSkyBlock; //导入依赖的package包/类
@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);
}
 
开发者ID:cubex2,项目名称:morefurnaces,代码行数:20,代码来源:TileEntityIronFurnace.java

示例8: getLightSubtracted

import net.minecraft.world.EnumSkyBlock; //导入依赖的package包/类
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;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:26,代码来源:Chunk.java

示例9: isValidLightLevel

import net.minecraft.world.EnumSkyBlock; //导入依赖的package包/类
/**
 * 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);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:27,代码来源:EntityMob.java

示例10: isValidLightLevel

import net.minecraft.world.EnumSkyBlock; //导入依赖的package包/类
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);
	}
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:19,代码来源:EntityTF2Character.java

示例11: getLightSubtracted

import net.minecraft.world.EnumSkyBlock; //导入依赖的package包/类
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;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:26,代码来源:Chunk.java

示例12: playMoodSoundAndCheckLight

import net.minecraft.world.EnumSkyBlock; //导入依赖的package包/类
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;
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:24,代码来源:WorldClient.java

示例13: updatePower

import net.minecraft.world.EnumSkyBlock; //导入依赖的package包/类
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;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:13,代码来源:WorldDayLightSensor.java

示例14: setLightsOn

import net.minecraft.world.EnumSkyBlock; //导入依赖的package包/类
private void setLightsOn(boolean lightsOn) {
    boolean check = areLightsOn != lightsOn;
    areLightsOn = lightsOn;
    if (check) {
        getWorld().checkLightFor(EnumSkyBlock.BLOCK, getPos());
        sendDescriptionPacket();
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:9,代码来源:TileEntityUVLightBox.java

示例15: enlightenBlocks

import net.minecraft.world.EnumSkyBlock; //导入依赖的package包/类
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;
}
 
开发者ID:kenzierocks,项目名称:HardVox,代码行数:15,代码来源:OpLightUpdates.java


注:本文中的net.minecraft.world.EnumSkyBlock类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。