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


Java EnumFacing.VALUES属性代码示例

本文整理汇总了Java中net.minecraft.util.EnumFacing.VALUES属性的典型用法代码示例。如果您正苦于以下问题:Java EnumFacing.VALUES属性的具体用法?Java EnumFacing.VALUES怎么用?Java EnumFacing.VALUES使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在net.minecraft.util.EnumFacing的用法示例。


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

示例1: amountRequested

@Override
public int amountRequested(FluidStack stack) {
    int totalRequestingAmount = getTotalRequestedAmount(stack);
    if (totalRequestingAmount > 0) {
        TileEntity te = getTileEntity();
        int count = 0;
        for (EnumFacing facing : EnumFacing.VALUES) {
            if (te.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, facing)) {
                IFluidHandler handler = te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, facing);
                for (IFluidTankProperties properties : handler.getTankProperties()) {
                    FluidStack contents = properties.getContents();
                    if (contents != null && contents.getFluid() == stack.getFluid()) {
                        count += contents.amount;
                    }
                }
                if (count > 0) break;
            }
        }
        if (count == 0) return 0;
        count += getIncomingFluid(stack.getFluid());
        return Math.max(0, Math.min(stack.amount, totalRequestingAmount - count));
    }
    return 0;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:24,代码来源:SemiBlockRequester.java

示例2: getRequestedAmount

public static int getRequestedAmount(SemiBlockLogistics requester, ItemStack providingStack) {
    TileEntity te = requester.getTileEntity();
    if (te == null) return 0;

    int requestedAmount = requester instanceof ISpecificRequester ? ((ISpecificRequester) requester).amountRequested(providingStack) : providingStack.getCount();
    if (requestedAmount == 0) return 0;
    providingStack = providingStack.copy();
    providingStack.setCount(requestedAmount);
    ItemStack remainder = providingStack.copy();
    remainder.grow(requester.getIncomingItems(providingStack));
    for (EnumFacing d : EnumFacing.VALUES) {
        remainder = IOHelper.insert(te, remainder, d, true);
        if (remainder.isEmpty()) break;
    }
    providingStack.shrink(remainder.getCount());
    if (providingStack.getCount() <= 0) return 0;
    return providingStack.getCount();
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:18,代码来源:LogisticsManager.java

示例3: func_178604_a

private Set func_178604_a(int p_178604_1_)
{
    EnumSet enumset = EnumSet.noneOf(EnumFacing.class);
    ArrayDeque arraydeque = new ArrayDeque(384);
    arraydeque.add(IntegerCache.valueOf(p_178604_1_));
    this.field_178612_d.set(p_178604_1_, true);

    while (!arraydeque.isEmpty())
    {
        int i = ((Integer)arraydeque.poll()).intValue();
        this.func_178610_a(i, enumset);

        for (EnumFacing enumfacing : EnumFacing.VALUES)
        {
            int j = this.func_178603_a(i, enumfacing);

            if (j >= 0 && !this.field_178612_d.get(j))
            {
                this.field_178612_d.set(j, true);
                arraydeque.add(IntegerCache.valueOf(j));
            }
        }
    }

    return enumset;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:26,代码来源:VisGraph.java

示例4: update

private void update()
{
    for (int i = 0; i < 6; ++i)
    {
        BlockPosM blockposm = this.facings[i];

        if (blockposm != null)
        {
            EnumFacing enumfacing = EnumFacing.VALUES[i];
            int j = this.mx + enumfacing.getFrontOffsetX();
            int k = this.my + enumfacing.getFrontOffsetY();
            int l = this.mz + enumfacing.getFrontOffsetZ();
            blockposm.setXyz(j, k, l);
        }
    }

    this.needsUpdate = false;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:18,代码来源:BlockPosM.java

示例5: findLake

private void findLake(Block block) {
    pumpingLake = new ArrayList<>();
    Stack<BlockPos> pendingPositions = new Stack<>();
    BlockPos thisPos = getPos().offset(EnumFacing.DOWN, currentDepth + 1);
    pendingPositions.add(thisPos);
    pumpingLake.add(thisPos);
    while (!pendingPositions.empty()) {
        BlockPos checkingPos = pendingPositions.pop();
        for (EnumFacing d : EnumFacing.VALUES) {
            if (d == EnumFacing.DOWN) continue;
            BlockPos newPos = checkingPos.offset(d); // new BlockPos(checkingPos.getX() + d.getFrontOffsetX(), checkingPos.getY() + d.getFrontOffsetY(), checkingPos.getZ() + d.getFrontOffsetZ());
            if (PneumaticCraftUtils.distBetweenSq(newPos, getPos().offset(EnumFacing.DOWN, currentDepth + 1)) <= MAX_PUMP_RANGE_SQUARED
                    && getWorld().getBlockState(newPos).getBlock() == block
                    && !pumpingLake.contains(newPos)) {
                pendingPositions.add(newPos);
                pumpingLake.add(newPos);
            }
        }
    }
    pumpingLake.sort(new ChunkPositionSorter(getPos().getX() + 0.5, getPos().getY() - currentDepth - 1, getPos().getZ() + 0.5));
    Collections.reverse(pumpingLake);
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:22,代码来源:TileEntityGasLift.java

示例6: onNeighborBlockUpdate

@Override
public void onNeighborBlockUpdate() {
    super.onNeighborBlockUpdate();
    EnumFacing oldSideConnected = sideConnected;
    sideConnected = EnumFacing.DOWN;
    for (EnumFacing d : EnumFacing.VALUES) {
        BlockPos neighborPos = getPos().offset(d);
        IBlockState state = getWorld().getBlockState(neighborPos);
        if (state.isSideSolid(getWorld(), neighborPos, d.getOpposite())) {
            sideConnected = d;
            break;
        }
    }
    if (sideConnected != oldSideConnected) {
        sendDescriptionPacket();
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:17,代码来源:TileEntityKeroseneLamp.java

示例7: updateConnections

private void updateConnections() {
	for (EnumFacing dir : EnumFacing.VALUES) {
		if (TubeUtil.canConnect(dir, getPos(), getWorld()))
			neighborConns[dir.ordinal()] = dir;
		else
			neighborConns[dir.ordinal()] = null;
	}
}
 
开发者ID:oMilkyy,项目名称:SimpleTubes,代码行数:8,代码来源:TileTube.java

示例8: getStateFromMeta

@Override
public IBlockState getStateFromMeta(int meta) {
	EnumFacing facing = EnumFacing.VALUES[meta];
	
	if (!FACING.getAllowedValues().contains(facing)) {
		for (EnumFacing value : FACING.getAllowedValues()) {
			facing = value;
			break;
		}
	}
	
	return this.blockState.getBaseState()
		.withProperty(FACING, facing);
}
 
开发者ID:astronautlabs,项目名称:rezolve,代码行数:14,代码来源:Machine.java

示例9: fromBytes

@Override
public void fromBytes(ByteBuf buf) {
    selectedBlock = BlockPos.fromLong(buf.readLong());
    selectedSide = EnumFacing.VALUES[buf.readByte()];
    destination = new TeleportDestination(NetworkTools.readStringUTF8(buf), buf.readInt(), BlockPos.fromLong(buf.readLong()),
            EnumFacing.VALUES[buf.readByte()]);
}
 
开发者ID:McJty,项目名称:MeeCreeps,代码行数:7,代码来源:PacketMakePortals.java

示例10: renderModelSmooth

public boolean renderModelSmooth(IBlockAccess worldIn, IBakedModel modelIn, IBlockState stateIn, BlockPos posIn, VertexBuffer buffer, boolean checkSides, long rand)
{
    boolean flag = false;
    RenderEnv renderenv = buffer.getRenderEnv(worldIn, stateIn, posIn);

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

        if (!list.isEmpty() && (!checkSides || stateIn.shouldSideBeRendered(worldIn, posIn, enumfacing)) && (!Hacks.findMod(XRay.class).isEnabled() || !XRay.xrayBlocks.contains(stateIn.getBlock())))
        {
            list = BlockModelCustomizer.getRenderQuads(list, worldIn, stateIn, posIn, enumfacing, rand, renderenv);
            this.renderQuadsSmooth(worldIn, stateIn, posIn, buffer, list, renderenv);
            flag = true;
        }
    }

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

    if (!list1.isEmpty())
    {
        list1 = BlockModelCustomizer.getRenderQuads(list1, worldIn, stateIn, posIn, (EnumFacing)null, rand, renderenv);
        this.renderQuadsSmooth(worldIn, stateIn, posIn, buffer, list1, renderenv);
        flag = true;
    }

    return flag;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:28,代码来源:BlockModelRenderer.java

示例11: transformSourceBlock

protected void transformSourceBlock(Block turningBlockSource, Block turningBlockFlowing) {
    if (FluidUtils.isSourceBlock(getWorld(), getPos())) {
        getWorld().setBlockState(getPos(), turningBlockSource.getDefaultState());
    } else {
        Set<BlockPos> traversed = new HashSet<BlockPos>();
        Stack<BlockPos> pending = new Stack<BlockPos>();
        pending.push(getPos());
        traversed.add(getPos());
        while (!pending.isEmpty()) {
            BlockPos pos = pending.pop();
            for (EnumFacing d : EnumFacing.VALUES) {
                BlockPos newPos = pos.offset(d);
                Block checkingBlock = getWorld().getBlockState(newPos).getBlock();
                if ((checkingBlock == getBlockState().getBlock() || getBlockState().getBlock() == Blocks.FLOWING_WATER && checkingBlock == Blocks.WATER || getBlockState().getBlock() == Blocks.FLOWING_LAVA && checkingBlock == Blocks.LAVA) && traversed.add(newPos)) {
                    if (FluidUtils.isSourceBlock(getWorld(), newPos)) {
                        getWorld().setBlockState(newPos, turningBlockSource.getDefaultState());
                        onTransition(newPos);
                        return;
                    } else {
                        getWorld().setBlockState(newPos, turningBlockFlowing.getDefaultState());
                        onTransition(newPos);
                        pending.push(newPos);
                    }
                }
            }
        }
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:28,代码来源:HeatBehaviourLiquidTransition.java

示例12: renderModel

private void renderModel(IBakedModel model, int color, ItemStack stack)
{
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    boolean flag = Minecraft.getMinecraft().getTextureMapBlocks().isTextureBound();
    boolean flag1 = Config.isMultiTexture() && flag;

    if (flag1)
    {
        vertexbuffer.setBlockLayer(BlockRenderLayer.SOLID);
    }

    vertexbuffer.begin(7, DefaultVertexFormats.ITEM);

    for (EnumFacing enumfacing : EnumFacing.VALUES)
    {
        this.renderQuads(vertexbuffer, model.getQuads((IBlockState)null, enumfacing, 0L), color, stack);
    }

    this.renderQuads(vertexbuffer, model.getQuads((IBlockState)null, (EnumFacing)null, 0L), color, stack);
    tessellator.draw();

    if (flag1)
    {
        vertexbuffer.setBlockLayer((BlockRenderLayer)null);
        GlStateManager.bindCurrentTexture();
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:28,代码来源:RenderItem.java

示例13: TexturedCuboid

/**
 * Creates a TexturedBox at a set position with a set size with a single
 * texture
 * 
 * @param xPos
 * @param yPos
 * @param zPos
 * @param width
 * @param height
 * @param depth
 * @param texture
 */
public TexturedCuboid(float xPos, float yPos, float zPos, float width, float height, float depth, TextureHolder texture) {
	this.x = xPos;
	this.y = yPos;
	this.z = zPos;
	this.width = width;
	this.height = height;
	this.depth = depth;

	Map<EnumFacing, TextureHolder> temp = new HashMap<EnumFacing, TextureHolder>();
	for (EnumFacing facing : EnumFacing.VALUES)
		temp.put(facing, texture);

	this.textureMap = temp;
}
 
开发者ID:oMilkyy,项目名称:SimpleTubes,代码行数:26,代码来源:TexturedCuboid.java

示例14: canBurn

private boolean canBurn(World world, BlockPos pos) {
	if (!world.isAirBlock(pos))
		return false;
	for (EnumFacing side : EnumFacing.VALUES) {
		BlockPos offset = pos.offset(side);
		if (!world.isAirBlock(pos.offset(side))) {
			Block block = world.getBlockState(offset).getBlock();
			if (block != Blocks.FIRE)
				return true;
		}
	}
	return false;
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:13,代码来源:RitualFlames.java

示例15: updateElevatorButtons

private void updateElevatorButtons(World world, BlockPos pos) {
    for (EnumFacing dir : EnumFacing.VALUES) {
        if (dir.getAxis() != Axis.Y) {
            TileEntityElevatorBase elevator = getElevatorBase(world, pos.offset(dir).offset(EnumFacing.DOWN, 2));
            if (elevator != null) {
                elevator.updateFloors();
            }
        }
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:10,代码来源:BlockElevatorCaller.java


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