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

CustomColorizer.java 文件源码 项目:BaseClient 阅读 20 收藏 0 点赞 0 评论 0
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);
    }
}
CustomColors.java 文件源码 项目:BaseClient 阅读 31 收藏 0 点赞 0 评论 0
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;
    }
}
BlockDrum.java 文件源码 项目:Thermionics 阅读 25 收藏 0 点赞 0 评论 0
@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);
}
BlockPistonExtension.java 文件源码 项目:Backmemed 阅读 23 收藏 0 点赞 0 评论 0
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;
    }
}
FenLight.java 文件源码 项目:minecraft-quiverbow 阅读 16 收藏 0 点赞 0 评论 0
@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);
   }
BlockNetherWart.java 文件源码 项目:CustomWorldGen 阅读 27 收藏 0 点赞 0 评论 0
@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;
}
BlockFlowerPot.java 文件源码 项目:BaseClient 阅读 18 收藏 0 点赞 0 评论 0
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;
}
BlockCocoa.java 文件源码 项目:CustomWorldGen 阅读 32 收藏 0 点赞 0 评论 0
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];
    }
}
BlockFluidClassic.java 文件源码 项目:CustomWorldGen 阅读 18 收藏 0 点赞 0 评论 0
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;
    }
}
BlockDoublePlant.java 文件源码 项目:CustomWorldGen 阅读 25 收藏 0 点赞 0 评论 0
@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);
}
BlockLadder.java 文件源码 项目:CustomWorldGen 阅读 24 收藏 0 点赞 0 评论 0
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;
    }
}
Block.java 文件源码 项目:CustomWorldGen 阅读 24 收藏 0 点赞 0 评论 0
/**
 * 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();
}
BlockModelRenderer.java 文件源码 项目:CustomWorldGen 阅读 33 收藏 0 点赞 0 评论 0
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;
}
BlockFire.java 文件源码 项目:CustomWorldGen 阅读 24 收藏 0 点赞 0 评论 0
/**
 * 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();
}
BlockBed.java 文件源码 项目:BaseClient 阅读 23 收藏 0 点赞 0 评论 0
/**
 * 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;
}
ConnectedTextures.java 文件源码 项目:BaseClient 阅读 25 收藏 0 点赞 0 评论 0
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;
    }
}
BlockRendererDispatcher.java 文件源码 项目:BaseClient 阅读 21 收藏 0 点赞 0 评论 0
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());
    }
}
BlockRedstoneComparator.java 文件源码 项目:CustomWorldGen 阅读 22 收藏 0 点赞 0 评论 0
@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());
    }
}
EndRod.java 文件源码 项目:connor41-etfuturum2 阅读 25 收藏 0 点赞 0 评论 0
@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);
}
BlockPotteryKiln.java 文件源码 项目:CharcoalPit 阅读 25 收藏 0 点赞 0 评论 0
@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;
    }
}
RenderEnv.java 文件源码 项目:BaseClient 阅读 20 收藏 0 点赞 0 评论 0
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();
}
BlockStairs.java 文件源码 项目:BaseClient 阅读 26 收藏 0 点赞 0 评论 0
/**
 * 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;
}
BlockFluidFinite.java 文件源码 项目:CustomWorldGen 阅读 18 收藏 0 点赞 0 评论 0
@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;
}
BlockStateContainer.java 文件源码 项目:Backmemed 阅读 23 收藏 0 点赞 0 评论 0
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);
    }
}
BlockMixin.java 文件源码 项目:customstuff4 阅读 17 收藏 0 点赞 0 评论 0
@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);
    }
}
CustomColormap.java 文件源码 项目:Backmemed 阅读 27 收藏 0 点赞 0 评论 0
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;
    }
}
BlockCoralPlant.java 文件源码 项目:ExPetrum 阅读 23 收藏 0 点赞 0 评论 0
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);
        }
    }
}
NodeProcessor.java 文件源码 项目:BaseClient 阅读 22 收藏 0 点赞 0 评论 0
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);
}
BlockElevatorCaller.java 文件源码 项目:pnc-repressurized 阅读 18 收藏 0 点赞 0 评论 0
@Override
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) {
    return true;
}
BlockReed.java 文件源码 项目:CustomWorldGen 阅读 23 收藏 0 点赞 0 评论 0
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
    return REED_AABB;
}


问题


面经


文章

微信
公众号

扫码关注公众号