Java 类net.minecraft.world.IBlockAccess 实例源码

项目:BaseClient    文件:CustomColorizer.java   
public static Vec3 getUnderwaterColor(IBlockAccess p_getUnderwaterColor_0_, double p_getUnderwaterColor_1_, double p_getUnderwaterColor_3_, double p_getUnderwaterColor_5_)
{
    if (underwaterColors == null)
    {
        return null;
    }
    else
    {
        int i = getSmoothColor(underwaterColors, p_getUnderwaterColor_0_, p_getUnderwaterColor_1_, p_getUnderwaterColor_3_, p_getUnderwaterColor_5_, 7, 1);
        int j = i >> 16 & 255;
        int k = i >> 8 & 255;
        int l = i & 255;
        float f = (float)j / 255.0F;
        float f1 = (float)k / 255.0F;
        float f2 = (float)l / 255.0F;
        return new Vec3((double)f, (double)f1, (double)f2);
    }
}
项目:BaseClient    文件:CustomColors.java   
public static Vec3 getUnderwaterColor(IBlockAccess p_getUnderwaterColor_0_, double p_getUnderwaterColor_1_, double p_getUnderwaterColor_3_, double p_getUnderwaterColor_5_)
{
    if (underwaterColors == null)
    {
        return null;
    }
    else
    {
        int i = underwaterColors.getColorSmooth(p_getUnderwaterColor_0_, p_getUnderwaterColor_1_, p_getUnderwaterColor_3_, p_getUnderwaterColor_5_, 3);
        int j = i >> 16 & 255;
        int k = i >> 8 & 255;
        int l = i & 255;
        float f = (float)j / 255.0F;
        float f1 = (float)k / 255.0F;
        float f2 = (float)l / 255.0F;
        Vec3 vec3 = underwaterColorFader.getColor((double)f, (double)f1, (double)f2);
        return vec3;
    }
}
项目:Thermionics    文件:BlockDrum.java   
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {

    float pixel = 1f/16f;
    float min = pixel*2;
    float max = 1 - min;

    float x1 = min;
    float y1 = 0;
    float z1 = min;
    float x2 = max;
    float y2 = 1;
    float z2 = max;

    return new AxisAlignedBB(x1,y1,z1,x2,y2,z2);
}
项目:Backmemed    文件:BlockPistonExtension.java   
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
    switch ((EnumFacing)state.getValue(FACING))
    {
        case DOWN:
        default:
            return PISTON_EXTENSION_DOWN_AABB;

        case UP:
            return PISTON_EXTENSION_UP_AABB;

        case NORTH:
            return PISTON_EXTENSION_NORTH_AABB;

        case SOUTH:
            return PISTON_EXTENSION_SOUTH_AABB;

        case WEST:
            return PISTON_EXTENSION_WEST_AABB;

        case EAST:
            return PISTON_EXTENSION_EAST_AABB;
    }
}
项目:minecraft-quiverbow    文件:FenLight.java   
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z)
   {
    int meta = world.getBlockMetadata(x, y, z);

    float plusX = 0;
    float plusY = 0;
    float plusZ = 0;

    if (meta == 0)  { plusY = 0.375F; }         // Bottom, so need to move to the top
    else if (meta == 1) { plusY = -0.375F; }    // Top, so need to move to the bottom
    else if (meta == 2) { plusZ = 0.375F; }     // East, so need to move west
    else if (meta == 3) { plusZ = -0.375F; }    // West, so need to move east
    else if (meta == 4) { plusX = 0.375F; }     // North, so need to move south
    else if (meta == 5) { plusX = -0.375F; }    // South, so need to move north

    this.setBlockBounds(sizeMin + plusX, sizeMin + plusY, sizeMin + plusZ, sizeMax + plusX, sizeMax + plusY, sizeMax + plusZ);
   }
项目:CustomWorldGen    文件:BlockNetherWart.java   
@Override
public java.util.List<ItemStack> getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
{
    java.util.List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
    Random rand = world instanceof World ? ((World)world).rand : new Random();
    int count = 1;

    if (((Integer)state.getValue(AGE)) >= 3)
    {
        count = 2 + rand.nextInt(3) + (fortune > 0 ? rand.nextInt(fortune + 1) : 0);
    }

    for (int i = 0; i < count; i++)
    {
        ret.add(new ItemStack(Items.NETHER_WART));
    }

    return ret;
}
项目:BaseClient    文件:BlockFlowerPot.java   
public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass)
{
    TileEntity tileentity = worldIn.getTileEntity(pos);

    if (tileentity instanceof TileEntityFlowerPot)
    {
        Item item = ((TileEntityFlowerPot)tileentity).getFlowerPotItem();

        if (item instanceof ItemBlock)
        {
            return Block.getBlockFromItem(item).colorMultiplier(worldIn, pos, renderPass);
        }
    }

    return 16777215;
}
项目:CustomWorldGen    文件:BlockCocoa.java   
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
    int i = ((Integer)state.getValue(AGE)).intValue();

    switch ((EnumFacing)state.getValue(FACING))
    {
        case SOUTH:
            return COCOA_SOUTH_AABB[i];
        case NORTH:
        default:
            return COCOA_NORTH_AABB[i];
        case WEST:
            return COCOA_WEST_AABB[i];
        case EAST:
            return COCOA_EAST_AABB[i];
    }
}
项目:CustomWorldGen    文件:BlockFluidClassic.java   
protected boolean canFlowInto(IBlockAccess world, BlockPos pos)
{
    if (world.isAirBlock(pos)) return true;

    IBlockState state = world.getBlockState(pos);
    if (state.getBlock() == this)
    {
        return true;
    }

    if (displacements.containsKey(state.getBlock()))
    {
        return displacements.get(state.getBlock());
    }

    Material material = state.getMaterial();
    if (material.blocksMovement()  ||
        material == Material.WATER ||
        material == Material.LAVA  ||
        material == Material.PORTAL)
    {
        return false;
    }

    int density = getDensity(world, pos);
    if (density == Integer.MAX_VALUE)
    {
         return true;
    }

    if (this.density > density)
    {
        return true;
    }
    else
    {
        return false;
    }
}
项目:CustomWorldGen    文件:BlockDoublePlant.java   
@Override
public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos)
{
    IBlockState state = world.getBlockState(pos);
    EnumPlantType type = (EnumPlantType)state.getValue(VARIANT);
    return state.getValue(HALF) == EnumBlockHalf.LOWER && (type == EnumPlantType.FERN || type == EnumPlantType.GRASS);
}
项目:CustomWorldGen    文件:BlockLadder.java   
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
    switch ((EnumFacing)state.getValue(FACING))
    {
        case NORTH:
            return LADDER_NORTH_AABB;
        case SOUTH:
            return LADDER_SOUTH_AABB;
        case WEST:
            return LADDER_WEST_AABB;
        case EAST:
        default:
            return LADDER_EAST_AABB;
    }
}
项目:CustomWorldGen    文件:Block.java   
/**
 * Get a light value for the block at the specified coordinates, normal ranges are between 0 and 15
 *
 * @param state Block state
 * @param world The current world
 * @param pos Block position in world
 * @return The light value
 */
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos)
{
    IBlockState other = world.getBlockState(pos);
    if (other.getBlock() != this)
    {
        return other.getLightValue(world, pos);
    }
    return state.getLightValue();
}
项目:CustomWorldGen    文件:BlockModelRenderer.java   
public boolean renderModelSmooth(IBlockAccess worldIn, IBakedModel modelIn, IBlockState stateIn, BlockPos posIn, VertexBuffer buffer, boolean checkSides, long rand)
{
    boolean flag = false;
    float[] afloat = new float[EnumFacing.values().length * 2];
    BitSet bitset = new BitSet(3);
    BlockModelRenderer.AmbientOcclusionFace blockmodelrenderer$ambientocclusionface = new BlockModelRenderer.AmbientOcclusionFace();

    for (EnumFacing enumfacing : EnumFacing.values())
    {
        List<BakedQuad> list = modelIn.getQuads(stateIn, enumfacing, rand);

        if (!list.isEmpty() && (!checkSides || stateIn.shouldSideBeRendered(worldIn, posIn, enumfacing)))
        {
            this.renderQuadsSmooth(worldIn, stateIn, posIn, buffer, list, afloat, bitset, blockmodelrenderer$ambientocclusionface);
            flag = true;
        }
    }

    List<BakedQuad> list1 = modelIn.getQuads(stateIn, (EnumFacing)null, rand);

    if (!list1.isEmpty())
    {
        this.renderQuadsSmooth(worldIn, stateIn, posIn, buffer, list1, afloat, bitset, blockmodelrenderer$ambientocclusionface);
        flag = true;
    }

    return flag;
}
项目:CustomWorldGen    文件:BlockFire.java   
/**
 * Get the actual Block state of this Block at the given position. This applies properties not visible in the
 * metadata, such as fence connections.
 */
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
{
    if (!worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos.down(), EnumFacing.UP) && !Blocks.FIRE.canCatchFire(worldIn, pos.down(), EnumFacing.UP))
    {
        return state.withProperty(NORTH, this.canCatchFire(worldIn, pos.north(), EnumFacing.SOUTH))
                    .withProperty(EAST,  this.canCatchFire(worldIn, pos.east(), EnumFacing.WEST))
                    .withProperty(SOUTH, this.canCatchFire(worldIn, pos.south(), EnumFacing.NORTH))
                    .withProperty(WEST,  this.canCatchFire(worldIn, pos.west(), EnumFacing.EAST))
                    .withProperty(UPPER, this.canCatchFire(worldIn, pos.up(), EnumFacing.DOWN));
    }
    return this.getDefaultState();
}
项目:BaseClient    文件:BlockBed.java   
/**
 * Get the actual Block state of this Block at the given position. This applies properties not visible in the
 * metadata, such as fence connections.
 */
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
{
    if (state.getValue(PART) == BlockBed.EnumPartType.FOOT)
    {
        IBlockState iblockstate = worldIn.getBlockState(pos.offset((EnumFacing)state.getValue(FACING)));

        if (iblockstate.getBlock() == this)
        {
            state = state.withProperty(OCCUPIED, iblockstate.getValue(OCCUPIED));
        }
    }

    return state;
}
项目:BaseClient    文件:ConnectedTextures.java   
private static boolean isNeighbour(ConnectedProperties p_isNeighbour_0_, IBlockAccess p_isNeighbour_1_, IBlockState p_isNeighbour_2_, BlockPos p_isNeighbour_3_, int p_isNeighbour_4_, TextureAtlasSprite p_isNeighbour_5_, int p_isNeighbour_6_)
{
    IBlockState iblockstate = p_isNeighbour_1_.getBlockState(p_isNeighbour_3_);

    if (p_isNeighbour_2_ == iblockstate)
    {
        return true;
    }
    else if (p_isNeighbour_0_.connect == 2)
    {
        if (iblockstate == null)
        {
            return false;
        }
        else if (iblockstate == AIR_DEFAULT_STATE)
        {
            return false;
        }
        else
        {
            TextureAtlasSprite textureatlassprite = getNeighbourIcon(p_isNeighbour_1_, p_isNeighbour_3_, iblockstate, p_isNeighbour_4_);
            return textureatlassprite == p_isNeighbour_5_;
        }
    }
    else
    {
        return p_isNeighbour_0_.connect == 3 ? (iblockstate == null ? false : (iblockstate == AIR_DEFAULT_STATE ? false : iblockstate.getBlock().getMaterial() == p_isNeighbour_2_.getBlock().getMaterial())) : false;
    }
}
项目:BaseClient    文件:BlockRendererDispatcher.java   
public void renderBlockDamage(IBlockState state, BlockPos pos, TextureAtlasSprite texture, IBlockAccess blockAccess)
{
    Block block = state.getBlock();
    int i = block.getRenderType();

    if (i == 3)
    {
        state = block.getActualState(state, blockAccess, pos);
        IBakedModel ibakedmodel = this.blockModelShapes.getModelForState(state);
        IBakedModel ibakedmodel1 = (new SimpleBakedModel.Builder(ibakedmodel, texture)).makeBakedModel();
        this.blockModelRenderer.renderModel(blockAccess, ibakedmodel1, state, pos, Tessellator.getInstance().getWorldRenderer());
    }
}
项目:CustomWorldGen    文件:BlockRedstoneComparator.java   
@Override
public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor)
{
    if (pos.getY() == neighbor.getY() && world instanceof World)
    {
        neighborChanged(world.getBlockState(pos), (World)world, pos, world.getBlockState(neighbor).getBlock());
    }
}
项目:connor41-etfuturum2    文件:EndRod.java   
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
    ForgeDirection dir = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));

    if (dir == ForgeDirection.DOWN || dir == ForgeDirection.UP)
        setBlockBounds(0.375F, 0.0F, 0.375F, 0.625F, 1.0F, 0.625F);
    else if (dir == ForgeDirection.WEST || dir == ForgeDirection.EAST)
        setBlockBounds(0.0F, 0.375F, 0.375F, 1.0F, 0.625F, 0.625F);
    else if (dir == ForgeDirection.NORTH || dir == ForgeDirection.SOUTH)
        setBlockBounds(0.375F, 0.375F, 0.0F, 0.625F, 0.625F, 1.0F);
}
项目:CharcoalPit    文件:BlockPotteryKiln.java   
@Override
public boolean isSideSolid(IBlockState base_state, IBlockAccess world, BlockPos pos, EnumFacing side) {
    if(side==EnumFacing.DOWN){
        return !(base_state.getValue(TYPE)==EnumKilnTypes.EMPTY);
    }else{
        return base_state.getValue(TYPE)==EnumKilnTypes.WOOD||base_state.getValue(TYPE)==EnumKilnTypes.ACTIVE||base_state.getValue(TYPE)==EnumKilnTypes.COMPLETE;
    }
}
项目:BaseClient    文件:RenderEnv.java   
private RenderEnv(IBlockAccess p_i82_1_, IBlockState p_i82_2_, BlockPos p_i82_3_)
{
    this.blockAccess = p_i82_1_;
    this.blockState = p_i82_2_;
    this.blockPos = p_i82_3_;
    this.gameSettings = Config.getGameSettings();
}
项目:BaseClient    文件:BlockStairs.java   
/**
 * Get the actual Block state of this Block at the given position. This applies properties not visible in the
 * metadata, such as fence connections.
 */
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
{
    if (this.func_176306_h(worldIn, pos))
    {
        switch (this.func_176305_g(worldIn, pos))
        {
            case 0:
                state = state.withProperty(SHAPE, BlockStairs.EnumShape.STRAIGHT);
                break;

            case 1:
                state = state.withProperty(SHAPE, BlockStairs.EnumShape.INNER_RIGHT);
                break;

            case 2:
                state = state.withProperty(SHAPE, BlockStairs.EnumShape.INNER_LEFT);
        }
    }
    else
    {
        switch (this.func_176307_f(worldIn, pos))
        {
            case 0:
                state = state.withProperty(SHAPE, BlockStairs.EnumShape.STRAIGHT);
                break;

            case 1:
                state = state.withProperty(SHAPE, BlockStairs.EnumShape.OUTER_RIGHT);
                break;

            case 2:
                state = state.withProperty(SHAPE, BlockStairs.EnumShape.OUTER_LEFT);
        }
    }

    return state;
}
项目:CustomWorldGen    文件:BlockFluidFinite.java   
@Override
public int getQuantaValue(IBlockAccess world, BlockPos pos)
{
    IBlockState state = world.getBlockState(pos);
    if (state.getBlock().isAir(state, world, pos))
    {
        return 0;
    }

    if (state.getBlock() != this)
    {
        return -1;
    }
    return state.getValue(LEVEL) + 1;
}
项目:Backmemed    文件:BlockStateContainer.java   
public AxisAlignedBB getBoundingBox(IBlockAccess blockAccess, BlockPos pos)
{
    Block.EnumOffsetType block$enumoffsettype = this.block.getOffsetType();

    if (block$enumoffsettype != Block.EnumOffsetType.NONE && !(this.block instanceof BlockFlower))
    {
        AxisAlignedBB axisalignedbb = this.block.getBoundingBox(this, blockAccess, pos);
        axisalignedbb = BlockModelUtils.getOffsetBoundingBox(axisalignedbb, block$enumoffsettype, pos);
        return axisalignedbb;
    }
    else
    {
        return this.block.getBoundingBox(this, blockAccess, pos);
    }
}
项目:customstuff4    文件:BlockMixin.java   
@Override
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
{
    Optional<BlockDrop[]> blockDrops = getContent().drop.get(getSubtype(state));
    if (blockDrops.isPresent())
    {
        drops.addAll(ItemHelper.getDroppedStacks(blockDrops.get()));
    } else
    {
        super.getDrops(drops, world, pos, state, fortune);
    }
}
项目:Backmemed    文件:CustomColormap.java   
public int getColorSmooth(IBlockAccess p_getColorSmooth_1_, double p_getColorSmooth_2_, double p_getColorSmooth_4_, double p_getColorSmooth_6_, int p_getColorSmooth_8_)
{
    if (this.format == 2)
    {
        return this.color;
    }
    else
    {
        int i = MathHelper.floor(p_getColorSmooth_2_);
        int j = MathHelper.floor(p_getColorSmooth_4_);
        int k = MathHelper.floor(p_getColorSmooth_6_);
        int l = 0;
        int i1 = 0;
        int j1 = 0;
        int k1 = 0;
        BlockPosM blockposm = new BlockPosM(0, 0, 0);

        for (int l1 = i - p_getColorSmooth_8_; l1 <= i + p_getColorSmooth_8_; ++l1)
        {
            for (int i2 = k - p_getColorSmooth_8_; i2 <= k + p_getColorSmooth_8_; ++i2)
            {
                blockposm.setXyz(l1, j, i2);
                int j2 = this.getColor((IBlockAccess)p_getColorSmooth_1_, blockposm);
                l += j2 >> 16 & 255;
                i1 += j2 >> 8 & 255;
                j1 += j2 & 255;
                ++k1;
            }
        }

        int k2 = l / k1;
        int l2 = i1 / k1;
        int i3 = j1 / k1;
        return k2 << 16 | l2 << 8 | i3;
    }
}
项目:ExPetrum    文件:BlockCoralPlant.java   
public void doPlacementChecks(IBlockAccess world, BlockPos pos)
{
    if (world instanceof World)
    {
        World w = (World) world;
        if (w.isAirBlock(pos.down()) || !w.getBlockState(pos.down()).isSideSolid(w, pos.down(), EnumFacing.UP))
        {
            this.breakReplaceSelf(w, pos);
        }
    }
}
项目:BaseClient    文件:NodeProcessor.java   
public void initProcessor(IBlockAccess iblockaccessIn, Entity entityIn)
{
    this.blockaccess = iblockaccessIn;
    this.pointMap.clearMap();
    this.entitySizeX = MathHelper.floor_float(entityIn.width + 1.0F);
    this.entitySizeY = MathHelper.floor_float(entityIn.height + 1.0F);
    this.entitySizeZ = MathHelper.floor_float(entityIn.width + 1.0F);
}
项目:pnc-repressurized    文件:BlockElevatorCaller.java   
@Override
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) {
    return true;
}
项目:CustomWorldGen    文件:BlockReed.java   
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
    return REED_AABB;
}
项目:Backmemed    文件:RenderEnv.java   
public RenderEnv(IBlockAccess p_i91_1_, IBlockState p_i91_2_, BlockPos p_i91_3_)
{
    this.blockAccess = p_i91_1_;
    this.blockState = p_i91_2_;
    this.blockPos = p_i91_3_;
}
项目:Backmemed    文件:BlockStateContainer.java   
public boolean shouldSideBeRendered(IBlockAccess blockAccess, BlockPos pos, EnumFacing facing)
{
    return this.block.shouldSideBeRendered(this, blockAccess, pos, facing);
}
项目:ArcaneMagic    文件:BlockInfusionAltar.java   
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face)
{
    return BlockFaceShape.UNDEFINED;
}
项目:DecompiledMinecraft    文件:BlockButton.java   
public int getStrongPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side)
{
    return !((Boolean)state.getValue(POWERED)).booleanValue() ? 0 : (state.getValue(FACING) == side ? 15 : 0);
}
项目:Backmemed    文件:BlockCarpet.java   
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
    return CARPET_AABB;
}
项目:BaseClient    文件:BlockButton.java   
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
{
    this.updateBlockBounds(worldIn.getBlockState(pos));
}
项目:Solar    文件:BlockQuantumMirror.java   
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
    return BB;
}
项目:genera    文件:ItemSeedNightshade.java   
@Override
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) {
    return EnumPlantType.Crop;
}
项目:BaseClient    文件:BiomeColorHelper.java   
public static int getFoliageColorAtPos(IBlockAccess p_180287_0_, BlockPos p_180287_1_)
{
    return func_180285_a(p_180287_0_, p_180287_1_, field_180289_b);
}
项目:Bewitchment    文件:BlockCauldron.java   
@Override
public boolean isPassable(IBlockAccess worldIn, BlockPos pos) {
    return true;
}