本文整理汇总了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;
}
示例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();
}
示例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;
}
示例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;
}
示例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);
}
示例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();
}
}
示例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;
}
}
示例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);
}
示例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()]);
}
示例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;
}
示例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);
}
}
}
}
}
}
示例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();
}
}
示例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;
}
示例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;
}
示例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();
}
}
}
}