當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。