net.minecraft.util.EnumFacing#ordinal ( )源码实例Demo

下面列出了net.minecraft.util.EnumFacing#ordinal ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: AdvancedRocketry   文件: TileEnergyPipe.java
protected void attemptLink(EnumFacing dir, TileEntity tile) {
	//If the pipe can inject or extract, add to the cache
	//if(!(tile instanceof IFluidHandler))
	//return;
	//if(world.isRemote && tile instanceof TileEnergyPipe)
	//	connectedSides[dir.ordinal()]=true;

	if(canExtract(dir, tile)) {
		if(!world.isRemote) {
			connectedSides[dir.ordinal()]=true;
			getNetworkHandler().removeFromAllTypes(this, tile);
			getNetworkHandler().addSource(this,tile,dir);
		}
	}

	if(canInject(dir, tile)) {
		if(!world.isRemote) {
			connectedSides[dir.ordinal()]=true;
			getNetworkHandler().removeFromAllTypes(this, tile);
			getNetworkHandler().addSink(this, tile,dir);
		}
	}
}
 
源代码2 项目: AdvancedRocketry   文件: TilePipe.java
protected void attemptLink(EnumFacing dir, TileEntity tile) {
	//If the pipe can inject or extract, add to the cache
	//if(!(tile instanceof IFluidHandler))
	//return;

	if(canExtract(dir, tile) && (world.isBlockIndirectlyGettingPowered(pos) > 0 || world.getStrongPower(pos) > 0)) {
		if(world.isRemote)
			connectedSides[dir.ordinal()]=true;
		else {
			getNetworkHandler().removeFromAllTypes(this, tile);
			getNetworkHandler().addSource(this,tile,dir);
			connectedSides[dir.ordinal()]=true;
		}
	}

	if(canInject(dir, tile) && world.isBlockIndirectlyGettingPowered(pos) == 0 && world.getStrongPower(pos) == 0) {
		if(world.isRemote)
			connectedSides[dir.ordinal()]=true;
		else {
			getNetworkHandler().removeFromAllTypes(this, tile);
			getNetworkHandler().addSink(this, tile,dir);
			connectedSides[dir.ordinal()]=true;
		}
	}
}
 
源代码3 项目: AgriCraft   文件: RenderCrop.java
private void renderBaseQuads(ITessellator tessellator, EnumFacing side, TextureAtlasSprite sprite) {
    int index = side == null ? EnumFacing.values().length : side.ordinal();
    boolean createQuads = false;
    if (!cropQuads.containsKey(tessellator.getVertexFormat())) {
        List<BakedQuad>[] lists = new List[EnumFacing.values().length + 1];
        cropQuads.put(tessellator.getVertexFormat(), lists);
        createQuads = true;
    } else if (cropQuads.get(tessellator.getVertexFormat())[index] == null) {
        createQuads = true;
    }
    if (createQuads) {
        tessellator.translate(0, -3 * Constants.UNIT, 0);
        tessellator.drawScaledPrism(2, 0, 2, 3, 16, 3, sprite);
        tessellator.drawScaledPrism(13, 0, 2, 14, 16, 3, sprite);
        tessellator.drawScaledPrism(13, 0, 13, 14, 16, 14, sprite);
        tessellator.drawScaledPrism(2, 0, 13, 3, 16, 14, sprite);
        tessellator.translate(0, 3 * Constants.UNIT, 0);
    } else {
        tessellator.addQuads(cropQuads.get(tessellator.getVertexFormat())[index]);
    }
}
 
源代码4 项目: litematica   文件: EasyPlaceUtils.java
private static Vec3d applyCarpetProtocolHitVec(BlockPos pos, IBlockState state, Vec3d hitVecIn)
{
    double x = hitVecIn.x;
    double y = hitVecIn.y;
    double z = hitVecIn.z;
    Block block = state.getBlock();
    EnumFacing facing = fi.dy.masa.malilib.util.BlockUtils.getFirstPropertyFacingValue(state);

    if (facing != null)
    {
        x = facing.ordinal() + 2 + pos.getX();
    }

    if (block instanceof BlockRedstoneRepeater)
    {
        x += ((state.getValue(BlockRedstoneRepeater.DELAY)) - 1) * 10;
    }
    else if (block instanceof BlockTrapDoor && state.getValue(BlockTrapDoor.HALF) == BlockTrapDoor.DoorHalf.TOP)
    {
        x += 10;
    }
    else if (block instanceof BlockRedstoneComparator && state.getValue(BlockRedstoneComparator.MODE) == BlockRedstoneComparator.Mode.SUBTRACT)
    {
        x += 10;
    }
    else if (block instanceof BlockStairs && state.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP)
    {
        x += 10;
    }

    return new Vec3d(x, y, z);
}
 
源代码5 项目: Valkyrien-Skies   文件: ImplRotationNode.java
@PhysicsThreadOnly
@Override
public Optional<Double> getAngularVelocityRatioFor(EnumFacing side) {
    PhysicsAssert.assertPhysicsThread();
    assertInitialized();
    return angularVelocityRatios[side.ordinal()];
}
 
源代码6 项目: Valkyrien-Skies   文件: ImplRotationNode.java
@PhysicsThreadOnly
@Override
public void setAngularVelocityRatio(EnumFacing side, Optional<Double> newRatio) {
    PhysicsAssert.assertPhysicsThread();
    assertInitialized();
    angularVelocityRatios[side.ordinal()] = newRatio;
}
 
源代码7 项目: Valkyrien-Skies   文件: TileEntityGearbox.java
@Override
public void update() {
    super.update();
    if (!this.getWorld().isRemote) {
        Optional<Double>[] rotationNodeRatios = this.rotationNode
            .connectedRotationRatiosUnsychronized();
        for (EnumFacing facing : EnumFacing.values()) {
            if (!this.rotationNode.isConnectedToSideUnsynchronized(facing)) {
                rotationNodeRatios[facing.ordinal()] = Optional.empty();
            }
        }
        connectedSidesRatios = rotationNodeRatios;
    }
    this.markDirty();
}
 
源代码8 项目: AdvancedRocketry   文件: TilePipe.java
public void onPlaced() {

		for(EnumFacing dir : EnumFacing.values()) {
			TileEntity tile = world.getTileEntity(getPos().offset(dir));


			if(tile != null) {
				if(tile instanceof TilePipe && tile.getClass() == this.getClass()) {
					TilePipe pipe = (TilePipe)tile;
					if(this.destroyed)
						continue;

					if(isInitialized() && pipe.isInitialized() && pipe.getNetworkID() != networkID)
						getNetworkHandler().mergeNetworks(networkID,  pipe.getNetworkID());
					else if(!isInitialized() && pipe.isInitialized()) {
						initialize(pipe.getNetworkID());
					}
					connectedSides[dir.ordinal()] = true;
				}
			}
		}


		if(!isInitialized()) {
			initialize(getNetworkHandler().getNewNetworkID());
		}

		linkSystems();
	}
 
源代码9 项目: BaseMetals   文件: BlockMetalPlate.java
@Override
   public void addCollisionBoxToList(final IBlockState bs, final World world, final BlockPos coord,
                                       final AxisAlignedBB box, final List<AxisAlignedBB> collisionBoxList,
                                       final Entity entity) {

       final EnumFacing orientation = (EnumFacing) world.getBlockState(coord).getValue(FACING);
       super.addCollisionBoxToList(coord, box, collisionBoxList, BOXES[orientation.ordinal()]);
}
 
源代码10 项目: WearableBackpacks   文件: BlockBackpack.java
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
	TileEntity entity = source.getTileEntity(pos);
	EnumFacing facing = (entity instanceof TileEntityBackpack)
		? ((TileEntityBackpack)entity).facing
		: EnumFacing.NORTH;
	return _boundsFromFacing[facing.ordinal() - 2];
}
 
源代码11 项目: BetterChests   文件: ItemUpgradeDirectional.java
public void setSide(ItemStack stack, EnumFacing side) {
	NBTTagCompound nbt = stack.getTagCompound();
	if (nbt == null) {
		stack.setTagCompound(nbt = new NBTTagCompound());
	}

	int target = -1;
	if (side != null) {
		target = side.ordinal();
	}
	nbt.setInteger("dir", target);
}
 
源代码12 项目: Valkyrien-Skies   文件: ImplRotationNode.java
@Override
public Optional<Double> getAngularVelocityRatioForUnsynchronized(EnumFacing side) {
    assertInitialized();
    return angularVelocityRatios[side.ordinal()];
}
 
源代码13 项目: NOVA-Core   文件: FWItem.java
@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
	return IFWItem.super.onItemUse(player.getHeldItem(hand), player, world, pos.getX(), pos.getY(), pos.getZ(), side.ordinal(), hitX, hitY, hitZ);
}
 
源代码14 项目: NOVA-Core   文件: FWItemBlock.java
@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
	return IFWItem.super.onItemUse(player.getHeldItem(hand), player, world, pos.getX(), pos.getY(), pos.getZ(), side.ordinal(), hitX, hitY, hitZ);
}
 
源代码15 项目: NOVA-Core   文件: FWItem.java
@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) {
	return ItemWrapperMethods.super.onItemUse(itemStack, player, world, pos.getX(), pos.getY(), pos.getZ(), side.ordinal(), hitX, hitY, hitZ);
}
 
源代码16 项目: NOVA-Core   文件: FWItemBlock.java
@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) {
	return ItemWrapperMethods.super.onItemUse(itemStack, player, world, pos.getX(), pos.getY(), pos.getZ(), side.ordinal(), hitX, hitY, hitZ);
}
 
源代码17 项目: BaseMetals   文件: BlockMetalPlate.java
@Override
public AxisAlignedBB getBoundingBox(final IBlockState bs, final IBlockAccess world, final BlockPos coord) {
    final EnumFacing orientation = (EnumFacing) bs.getValue(FACING);
    return BOXES[orientation.ordinal()];
}