Java 类net.minecraft.util.BlockPos 实例源码

项目:BaseClient    文件:BlockPistonStructureHelper.java   
public BlockPistonStructureHelper(World worldIn, BlockPos posIn, EnumFacing pistonFacing, boolean extending)
{
    this.world = worldIn;
    this.pistonPos = posIn;

    if (extending)
    {
        this.moveDirection = pistonFacing;
        this.blockToMove = posIn.offset(pistonFacing);
    }
    else
    {
        this.moveDirection = pistonFacing.getOpposite();
        this.blockToMove = posIn.offset(pistonFacing, 2);
    }
}
项目:DecompiledMinecraft    文件:BlockButton.java   
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
    if (((Boolean)state.getValue(POWERED)).booleanValue())
    {
        return true;
    }
    else
    {
        worldIn.setBlockState(pos, state.withProperty(POWERED, Boolean.valueOf(true)), 3);
        worldIn.markBlockRangeForRenderUpdate(pos, pos);
        worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "random.click", 0.3F, 0.6F);
        this.notifyNeighbors(worldIn, pos, (EnumFacing)state.getValue(FACING));
        worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn));
        return true;
    }
}
项目:DecompiledMinecraft    文件:BlockRedstoneDiode.java   
/**
 * Called when a neighboring block changes.
 */
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
{
    if (this.canBlockStay(worldIn, pos))
    {
        this.updateState(worldIn, pos, state);
    }
    else
    {
        this.dropBlockAsItem(worldIn, pos, state, 0);
        worldIn.setBlockToAir(pos);

        for (EnumFacing enumfacing : EnumFacing.values())
        {
            worldIn.notifyNeighborsOfStateChange(pos.offset(enumfacing), this);
        }
    }
}
项目:BaseClient    文件:WorldGenTallGrass.java   
public boolean generate(World worldIn, Random rand, BlockPos position)
{
    Block block;

    while (((block = worldIn.getBlockState(position).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && position.getY() > 0)
    {
        position = position.down();
    }

    for (int i = 0; i < 128; ++i)
    {
        BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8));

        if (worldIn.isAirBlock(blockpos) && Blocks.tallgrass.canBlockStay(worldIn, blockpos, this.tallGrassState))
        {
            worldIn.setBlockState(blockpos, this.tallGrassState, 2);
        }
    }

    return true;
}
项目:BaseClient    文件:CrashReportCategory.java   
public static void addBlockInfo(CrashReportCategory category, final BlockPos pos, final IBlockState state)
{
    category.addCrashSectionCallable("Block", new Callable<String>()
    {
        public String call() throws Exception
        {
            return state.toString();
        }
    });
    category.addCrashSectionCallable("Block location", new Callable<String>()
    {
        public String call() throws Exception
        {
            return CrashReportCategory.getCoordinateInfo(pos);
        }
    });
}
项目:BaseClient    文件:BlockCocoa.java   
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    if (!this.canBlockStay(worldIn, pos, state))
    {
        this.dropBlock(worldIn, pos, state);
    }
    else if (worldIn.rand.nextInt(5) == 0)
    {
        int i = ((Integer)state.getValue(AGE)).intValue();

        if (i < 2)
        {
            worldIn.setBlockState(pos, state.withProperty(AGE, Integer.valueOf(i + 1)), 2);
        }
    }
}
项目:Proyecto-DASI    文件:PositionHelper.java   
public static List<BlockPos> getTouchingBlocks(EntityPlayerSP player)
{
    // Determine which blocks we are touching.
    // This code is adapted from Entity, where it is used to fire the Block.onEntityCollidedWithBlock methods.
    BlockPos blockposmin = new BlockPos(player.getEntityBoundingBox().minX - 0.001D, player.getEntityBoundingBox().minY - 0.001D, player.getEntityBoundingBox().minZ - 0.001D);
    BlockPos blockposmax = new BlockPos(player.getEntityBoundingBox().maxX + 0.001D, player.getEntityBoundingBox().maxY + 0.001D, player.getEntityBoundingBox().maxZ + 0.001D);
    List<BlockPos> blocks = new ArrayList<BlockPos>();

    if (player.worldObj.isAreaLoaded(blockposmin, blockposmax))
    {
        for (int i = blockposmin.getX(); i <= blockposmax.getX(); ++i)
        {
            for (int j = blockposmin.getY(); j <= blockposmax.getY(); ++j)
            {
                for (int k = blockposmin.getZ(); k <= blockposmax.getZ(); ++k)
                {
                    blocks.add(new BlockPos(i, j, k));
                }
            }
        }
    }
    return blocks;
}
项目:DecompiledMinecraft    文件:BiomeGenSnow.java   
public void decorate(World worldIn, Random rand, BlockPos pos)
{
    if (this.field_150615_aC)
    {
        for (int i = 0; i < 3; ++i)
        {
            int j = rand.nextInt(16) + 8;
            int k = rand.nextInt(16) + 8;
            this.field_150616_aD.generate(worldIn, rand, worldIn.getHeight(pos.add(j, 0, k)));
        }

        for (int l = 0; l < 2; ++l)
        {
            int i1 = rand.nextInt(16) + 8;
            int j1 = rand.nextInt(16) + 8;
            this.field_150617_aE.generate(worldIn, rand, worldIn.getHeight(pos.add(i1, 0, j1)));
        }
    }

    super.decorate(worldIn, rand, pos);
}
项目:DecompiledMinecraft    文件:BlockPistonExtension.java   
/**
 * Called when a neighboring block changes.
 */
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
{
    EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
    BlockPos blockpos = pos.offset(enumfacing.getOpposite());
    IBlockState iblockstate = worldIn.getBlockState(blockpos);

    if (iblockstate.getBlock() != Blocks.piston && iblockstate.getBlock() != Blocks.sticky_piston)
    {
        worldIn.setBlockToAir(pos);
    }
    else
    {
        iblockstate.getBlock().onNeighborBlockChange(worldIn, blockpos, iblockstate, neighborBlock);
    }
}
项目:BaseClient    文件:BlockChest.java   
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
{
    if (worldIn.getBlockState(pos.north()).getBlock() == this)
    {
        this.setBlockBounds(0.0625F, 0.0F, 0.0F, 0.9375F, 0.875F, 0.9375F);
    }
    else if (worldIn.getBlockState(pos.south()).getBlock() == this)
    {
        this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 1.0F);
    }
    else if (worldIn.getBlockState(pos.west()).getBlock() == this)
    {
        this.setBlockBounds(0.0F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
    }
    else if (worldIn.getBlockState(pos.east()).getBlock() == this)
    {
        this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 1.0F, 0.875F, 0.9375F);
    }
    else
    {
        this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
    }
}
项目:DecompiledMinecraft    文件:TileEntityChest.java   
protected TileEntityChest getAdjacentChest(EnumFacing side)
{
    BlockPos blockpos = this.pos.offset(side);

    if (this.isChestAt(blockpos))
    {
        TileEntity tileentity = this.worldObj.getTileEntity(blockpos);

        if (tileentity instanceof TileEntityChest)
        {
            TileEntityChest tileentitychest = (TileEntityChest)tileentity;
            tileentitychest.func_174910_a(this, side.getOpposite());
            return tileentitychest;
        }
    }

    return null;
}
项目:DecompiledMinecraft    文件:Chunk.java   
public void addTileEntity(BlockPos pos, TileEntity tileEntityIn)
{
    tileEntityIn.setWorldObj(this.worldObj);
    tileEntityIn.setPos(pos);

    if (this.getBlock(pos) instanceof ITileEntityProvider)
    {
        if (this.chunkTileEntityMap.containsKey(pos))
        {
            ((TileEntity)this.chunkTileEntityMap.get(pos)).invalidate();
        }

        tileEntityIn.validate();
        this.chunkTileEntityMap.put(pos, tileEntityIn);
    }
}
项目:DecompiledMinecraft    文件:BlockStainedGlass.java   
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
{
    if (!worldIn.isRemote)
    {
        BlockBeacon.updateColorAsync(worldIn, pos);
    }
}
项目:DecompiledMinecraft    文件:ContainerWorkbench.java   
public ContainerWorkbench(InventoryPlayer playerInventory, World worldIn, BlockPos posIn)
{
    this.worldObj = worldIn;
    this.pos = posIn;
    this.addSlotToContainer(new SlotCrafting(playerInventory.player, this.craftMatrix, this.craftResult, 0, 124, 35));

    for (int i = 0; i < 3; ++i)
    {
        for (int j = 0; j < 3; ++j)
        {
            this.addSlotToContainer(new Slot(this.craftMatrix, j + i * 3, 30 + j * 18, 17 + i * 18));
        }
    }

    for (int k = 0; k < 3; ++k)
    {
        for (int i1 = 0; i1 < 9; ++i1)
        {
            this.addSlotToContainer(new Slot(playerInventory, i1 + k * 9 + 9, 8 + i1 * 18, 84 + k * 18));
        }
    }

    for (int l = 0; l < 9; ++l)
    {
        this.addSlotToContainer(new Slot(playerInventory, l, 8 + l * 18, 142));
    }

    this.onCraftMatrixChanged(this.craftMatrix);
}
项目:DecompiledMinecraft    文件:PlayerSelector.java   
private static AxisAlignedBB func_179661_a(BlockPos p_179661_0_, int p_179661_1_, int p_179661_2_, int p_179661_3_)
{
    boolean flag = p_179661_1_ < 0;
    boolean flag1 = p_179661_2_ < 0;
    boolean flag2 = p_179661_3_ < 0;
    int i = p_179661_0_.getX() + (flag ? p_179661_1_ : 0);
    int j = p_179661_0_.getY() + (flag1 ? p_179661_2_ : 0);
    int k = p_179661_0_.getZ() + (flag2 ? p_179661_3_ : 0);
    int l = p_179661_0_.getX() + (flag ? 0 : p_179661_1_) + 1;
    int i1 = p_179661_0_.getY() + (flag1 ? 0 : p_179661_2_) + 1;
    int j1 = p_179661_0_.getZ() + (flag2 ? 0 : p_179661_3_) + 1;
    return new AxisAlignedBB((double)i, (double)j, (double)k, (double)l, (double)i1, (double)j1);
}
项目:DecompiledMinecraft    文件:StructureComponent.java   
/**
 * Deletes all continuous blocks from selected position upwards. Stops at hitting air.
 */
protected void clearCurrentPositionBlocksUpwards(World worldIn, int x, int y, int z, StructureBoundingBox structurebb)
{
    BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));

    if (structurebb.isVecInside(blockpos))
    {
        while (!worldIn.isAirBlock(blockpos) && blockpos.getY() < 255)
        {
            worldIn.setBlockState(blockpos, Blocks.air.getDefaultState(), 2);
            blockpos = blockpos.up();
        }
    }
}
项目:DecompiledMinecraft    文件:Block.java   
/**
 * Add all collision boxes of this Block to the list that intersect with the given mask.
 */
public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity)
{
    AxisAlignedBB axisalignedbb = this.getCollisionBoundingBox(worldIn, pos, state);

    if (axisalignedbb != null && mask.intersectsWith(axisalignedbb))
    {
        list.add(axisalignedbb);
    }
}
项目:BaseClient    文件:PlayerControllerMP.java   
public static void clickBlockCreative(Minecraft mcIn, PlayerControllerMP p_178891_1_, BlockPos p_178891_2_, EnumFacing p_178891_3_)
{
    if (!mcIn.theWorld.extinguishFire(mcIn.thePlayer, p_178891_2_, p_178891_3_))
    {
        p_178891_1_.onPlayerDestroyBlock(p_178891_2_, p_178891_3_);
    }
}
项目:DecompiledMinecraft    文件:BlockNote.java   
public void onBlockClicked(World worldIn, BlockPos pos, EntityPlayer playerIn)
{
    if (!worldIn.isRemote)
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof TileEntityNote)
        {
            ((TileEntityNote)tileentity).triggerNote(worldIn, pos);
            playerIn.triggerAchievement(StatList.field_181734_R);
        }
    }
}
项目:BaseClient    文件:World.java   
/**
 * Returns true if there are any blocks in the region constrained by an AxisAlignedBB
 */
public boolean checkBlockCollision(AxisAlignedBB bb)
{
    int i = MathHelper.floor_double(bb.minX);
    int j = MathHelper.floor_double(bb.maxX);
    int k = MathHelper.floor_double(bb.minY);
    int l = MathHelper.floor_double(bb.maxY);
    int i1 = MathHelper.floor_double(bb.minZ);
    int j1 = MathHelper.floor_double(bb.maxZ);
    BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();

    for (int k1 = i; k1 <= j; ++k1)
    {
        for (int l1 = k; l1 <= l; ++l1)
        {
            for (int i2 = i1; i2 <= j1; ++i2)
            {
                Block block = this.getBlockState(blockpos$mutableblockpos.func_181079_c(k1, l1, i2)).getBlock();

                if (block.getMaterial() != Material.air)
                {
                    return true;
                }
            }
        }
    }

    return false;
}
项目:BaseClient    文件:BlockIce.java   
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
{
    player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]);
    player.addExhaustion(0.025F);

    if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player))
    {
        ItemStack itemstack = this.createStackedBlock(state);

        if (itemstack != null)
        {
            spawnAsEntity(worldIn, pos, itemstack);
        }
    }
    else
    {
        if (worldIn.provider.doesWaterVaporize())
        {
            worldIn.setBlockToAir(pos);
            return;
        }

        int i = EnchantmentHelper.getFortuneModifier(player);
        this.dropBlockAsItem(worldIn, pos, state, i);
        Material material = worldIn.getBlockState(pos.down()).getBlock().getMaterial();

        if (material.blocksMovement() || material.isLiquid())
        {
            worldIn.setBlockState(pos, Blocks.flowing_water.getDefaultState());
        }
    }
}
项目:DecompiledMinecraft    文件:BlockPistonStructureHelper.java   
public boolean canMove()
{
    this.toMove.clear();
    this.toDestroy.clear();
    Block block = this.world.getBlockState(this.blockToMove).getBlock();

    if (!BlockPistonBase.canPush(block, this.world, this.blockToMove, this.moveDirection, false))
    {
        if (block.getMobilityFlag() != 1)
        {
            return false;
        }
        else
        {
            this.toDestroy.add(this.blockToMove);
            return true;
        }
    }
    else if (!this.func_177251_a(this.blockToMove))
    {
        return false;
    }
    else
    {
        for (int i = 0; i < this.toMove.size(); ++i)
        {
            BlockPos blockpos = (BlockPos)this.toMove.get(i);

            if (this.world.getBlockState(blockpos).getBlock() == Blocks.slime_block && !this.func_177250_b(blockpos))
            {
                return false;
            }
        }

        return true;
    }
}
项目:DecompiledMinecraft    文件:BlockAnvil.java   
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
{
    EnumFacing enumfacing = (EnumFacing)worldIn.getBlockState(pos).getValue(FACING);

    if (enumfacing.getAxis() == EnumFacing.Axis.X)
    {
        this.setBlockBounds(0.0F, 0.0F, 0.125F, 1.0F, 1.0F, 0.875F);
    }
    else
    {
        this.setBlockBounds(0.125F, 0.0F, 0.0F, 0.875F, 1.0F, 1.0F);
    }
}
项目:DecompiledMinecraft    文件:BlockPressurePlate.java   
protected int computeRedstoneStrength(World worldIn, BlockPos pos)
{
    AxisAlignedBB axisalignedbb = this.getSensitiveAABB(pos);
    List <? extends Entity > list;

    switch (this.sensitivity)
    {
        case EVERYTHING:
            list = worldIn.getEntitiesWithinAABBExcludingEntity((Entity)null, axisalignedbb);
            break;

        case MOBS:
            list = worldIn.<Entity>getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
            break;

        default:
            return 0;
    }

    if (!list.isEmpty())
    {
        for (Entity entity : list)
        {
            if (!entity.doesEntityNotTriggerPressurePlate())
            {
                return 15;
            }
        }
    }

    return 0;
}
项目:BaseClient    文件:BlockTallGrass.java   
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
{
    if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears)
    {
        player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]);
        spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 1, ((BlockTallGrass.EnumType)state.getValue(TYPE)).getMeta()));
    }
    else
    {
        super.harvestBlock(worldIn, player, pos, state, te);
    }
}
项目:BaseClient    文件:BlockRendererDispatcher.java   
public boolean renderBlock(IBlockState state, BlockPos pos, IBlockAccess blockAccess, WorldRenderer worldRendererIn)
{
    try
    {
        int i = state.getBlock().getRenderType();

        if (i == -1)
        {
            return false;
        }
        else
        {
            switch (i)
            {
                case 1:
                    return this.fluidRenderer.renderFluid(blockAccess, state, pos, worldRendererIn);

                case 2:
                    return false;

                case 3:
                    IBakedModel ibakedmodel = this.getModelFromBlockState(state, blockAccess, pos);
                    return this.blockModelRenderer.renderModel(blockAccess, ibakedmodel, state, pos, worldRendererIn);

                default:
                    return false;
            }
        }
    }
    catch (Throwable throwable)
    {
        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Tesselating block in world");
        CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being tesselated");
        CrashReportCategory.addBlockInfo(crashreportcategory, pos, state.getBlock(), state.getBlock().getMetaFromState(state));
        throw new ReportedException(crashreport);
    }
}
项目:DecompiledMinecraft    文件:RenderGlobal.java   
public void notifyLightSet(BlockPos pos)
{
    int i = pos.getX();
    int j = pos.getY();
    int k = pos.getZ();
    this.markBlocksForUpdate(i - 1, j - 1, k - 1, i + 1, j + 1, k + 1);
}
项目:DecompiledMinecraft    文件:BiomeGenBase.java   
/**
 * Gets a floating point representation of this biome's temperature
 */
public final float getFloatTemperature(BlockPos pos)
{
    if (pos.getY() > 64)
    {
        float f = (float)(temperatureNoise.func_151601_a((double)pos.getX() * 1.0D / 8.0D, (double)pos.getZ() * 1.0D / 8.0D) * 4.0D);
        return this.temperature - (f + (float)pos.getY() - 64.0F) * 0.05F / 30.0F;
    }
    else
    {
        return this.temperature;
    }
}
项目:BaseClient    文件:World.java   
public void markBlockForUpdate(BlockPos pos)
{
    for (int i = 0; i < this.worldAccesses.size(); ++i)
    {
        ((IWorldAccess)this.worldAccesses.get(i)).markBlockForUpdate(pos);
    }
}
项目:DecompiledMinecraft    文件:BlockPistonBase.java   
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
{
    if (!worldIn.isRemote && worldIn.getTileEntity(pos) == null)
    {
        this.checkForMove(worldIn, pos, state);
    }
}
项目:DecompiledMinecraft    文件:BlockStairs.java   
/**
 * Set the block bounds as the collision bounds for the stairs at the given position
 */
public void setBaseCollisionBounds(IBlockAccess worldIn, BlockPos pos)
{
    if (worldIn.getBlockState(pos).getValue(HALF) == BlockStairs.EnumHalf.TOP)
    {
        this.setBlockBounds(0.0F, 0.5F, 0.0F, 1.0F, 1.0F, 1.0F);
    }
    else
    {
        this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
    }
}
项目:DecompiledMinecraft    文件:EntityPlayerMP.java   
public EntityPlayerMP(MinecraftServer server, WorldServer worldIn, GameProfile profile, ItemInWorldManager interactionManager)
{
    super(worldIn, profile);
    interactionManager.thisPlayerMP = this;
    this.theItemInWorldManager = interactionManager;
    BlockPos blockpos = worldIn.getSpawnPoint();

    if (!worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE)
    {
        int i = Math.max(5, server.getSpawnProtectionSize() - 6);
        int j = MathHelper.floor_double(worldIn.getWorldBorder().getClosestDistance((double)blockpos.getX(), (double)blockpos.getZ()));

        if (j < i)
        {
            i = j;
        }

        if (j <= 1)
        {
            i = 1;
        }

        blockpos = worldIn.getTopSolidOrLiquidBlock(blockpos.add(this.rand.nextInt(i * 2) - i, 0, this.rand.nextInt(i * 2) - i));
    }

    this.mcServer = server;
    this.statsFile = server.getConfigurationManager().getPlayerStatsFile(this);
    this.stepHeight = 0.0F;
    this.moveToBlockPosAndAngles(blockpos, 0.0F, 0.0F);

    while (!worldIn.getCollidingBoundingBoxes(this, this.getEntityBoundingBox()).isEmpty() && this.posY < 255.0D)
    {
        this.setPosition(this.posX, this.posY + 1.0D, this.posZ);
    }
}
项目:FundamentalChemistry    文件:BlockPeriodicStorage.java   
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand){
    world.scheduleUpdate(pos, this, FundamentalChemistry.RELAY_TICKS); //schedule next update

    TileSimpleMachine ent = (TileSimpleMachine)world.getTileEntity(pos);
    ent.tick();
}
项目:BaseClient    文件:BlockRedstoneWire.java   
/**
 * Called when a neighboring block changes.
 */
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) {
    if (!worldIn.isRemote) {
        if (this.canPlaceBlockAt(worldIn, pos)) {
            this.updateSurroundingRedstone(worldIn, pos, state);
        } else {
            this.dropBlockAsItem(worldIn, pos, state, 0);
            worldIn.setBlockToAir(pos);
        }
    }
}
项目:DecompiledMinecraft    文件:Chunk.java   
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;
    }
}
项目:DecompiledMinecraft    文件:EntityHorse.java   
public void fall(float distance, float damageMultiplier)
{
    if (distance > 1.0F)
    {
        this.playSound("mob.horse.land", 0.4F, 1.0F);
    }

    int i = MathHelper.ceiling_float_int((distance * 0.5F - 3.0F) * damageMultiplier);

    if (i > 0)
    {
        this.attackEntityFrom(DamageSource.fall, (float)i);

        if (this.riddenByEntity != null)
        {
            this.riddenByEntity.attackEntityFrom(DamageSource.fall, (float)i);
        }

        Block block = this.worldObj.getBlockState(new BlockPos(this.posX, this.posY - 0.2D - (double)this.prevRotationYaw, this.posZ)).getBlock();

        if (block.getMaterial() != Material.air && !this.isSilent())
        {
            Block.SoundType block$soundtype = block.stepSound;
            this.worldObj.playSoundAtEntity(this, block$soundtype.getStepSound(), block$soundtype.getVolume() * 0.5F, block$soundtype.getFrequency() * 0.75F);
        }
    }
}
项目:DecompiledMinecraft    文件:EntityAIMoveIndoors.java   
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute()
{
    BlockPos blockpos = new BlockPos(this.entityObj);

    if ((!this.entityObj.worldObj.isDaytime() || this.entityObj.worldObj.isRaining() && !this.entityObj.worldObj.getBiomeGenForCoords(blockpos).canSpawnLightningBolt()) && !this.entityObj.worldObj.provider.getHasNoSky())
    {
        if (this.entityObj.getRNG().nextInt(50) != 0)
        {
            return false;
        }
        else if (this.insidePosX != -1 && this.entityObj.getDistanceSq((double)this.insidePosX, this.entityObj.posY, (double)this.insidePosZ) < 4.0D)
        {
            return false;
        }
        else
        {
            Village village = this.entityObj.worldObj.getVillageCollection().getNearestVillage(blockpos, 14);

            if (village == null)
            {
                return false;
            }
            else
            {
                this.doorInfo = village.getDoorInfo(blockpos);
                return this.doorInfo != null;
            }
        }
    }
    else
    {
        return false;
    }
}
项目:DecompiledMinecraft    文件:ItemInWorldManager.java   
public void blockRemoving(BlockPos pos)
{
    if (pos.equals(this.field_180240_f))
    {
        int i = this.curblockDamage - this.initialDamage;
        Block block = this.theWorld.getBlockState(pos).getBlock();

        if (block.getMaterial() != Material.air)
        {
            float f = block.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, pos) * (float)(i + 1);

            if (f >= 0.7F)
            {
                this.isDestroyingBlock = false;
                this.theWorld.sendBlockBreakProgress(this.thisPlayerMP.getEntityId(), pos, -1);
                this.tryHarvestBlock(pos);
            }
            else if (!this.receivedFinishDiggingPacket)
            {
                this.isDestroyingBlock = false;
                this.receivedFinishDiggingPacket = true;
                this.field_180241_i = pos;
                this.initialBlockDamage = this.initialDamage;
            }
        }
    }
}
项目:DecompiledMinecraft    文件:BlockChest.java   
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    TileEntity tileentity = worldIn.getTileEntity(pos);

    if (tileentity instanceof IInventory)
    {
        InventoryHelper.dropInventoryItems(worldIn, pos, (IInventory)tileentity);
        worldIn.updateComparatorOutputLevel(pos, this);
    }

    super.breakBlock(worldIn, pos, state);
}
项目:BaseClient    文件:StructureOceanMonument.java   
protected boolean canSpawnStructureAtCoords(int chunkX, int chunkZ)
{
    int i = chunkX;
    int j = chunkZ;

    if (chunkX < 0)
    {
        chunkX -= this.field_175800_f - 1;
    }

    if (chunkZ < 0)
    {
        chunkZ -= this.field_175800_f - 1;
    }

    int k = chunkX / this.field_175800_f;
    int l = chunkZ / this.field_175800_f;
    Random random = this.worldObj.setRandomSeed(k, l, 10387313);
    k = k * this.field_175800_f;
    l = l * this.field_175800_f;
    k = k + (random.nextInt(this.field_175800_f - this.field_175801_g) + random.nextInt(this.field_175800_f - this.field_175801_g)) / 2;
    l = l + (random.nextInt(this.field_175800_f - this.field_175801_g) + random.nextInt(this.field_175800_f - this.field_175801_g)) / 2;

    if (i == k && j == l)
    {
        if (this.worldObj.getWorldChunkManager().getBiomeGenerator(new BlockPos(i * 16 + 8, 64, j * 16 + 8), (BiomeGenBase)null) != BiomeGenBase.deepOcean)
        {
            return false;
        }

        boolean flag = this.worldObj.getWorldChunkManager().areBiomesViable(i * 16 + 8, j * 16 + 8, 29, field_175802_d);

        if (flag)
        {
            return true;
        }
    }

    return false;
}