Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
api:sides:zh [2022/08/11 10:07]
fight_xing created
api:sides:zh [2023/11/26 23:22] (current)
hfsr [Sides(面方向) API]
Line 1: Line 1:
-Sides API+Sides(方向) ​API
 ======== ========
 +此“API”提供了一份全局表,以便你通过名称来引用相对/​绝对方向,而无需使用它们的编号。底层的编号值与Minecraft内部的编号(即名为`ForgeDirection`的Enum)完全一致。此表提供了双向查询,因此你既可以将名称解析为编号,也可以通过编号反查适合人类阅读的名称。例如,`sides.top`对应数字值`1`,而`sides[1]`的值为字符串`top`。每个方向都有数个别名,因此不太可能意外写错。以下是基本值:
  
-**本篇文章的部分/​全部内容还没有进行翻译。**+- 底面 (`bottom`), 数字: 0 
 +- 顶面 (`top`), 数字: 1 
 +- 背面 (`back`), 数字: 2 
 +- 前面 (`front`), 数字: 3 
 +- 右面 (`right`), 数字: 4 
 +- 左面 (`left`), 数字: 5
  
-This "​API"​ provides a global table to allow you to refer to sides / directions by name, as opposed to their numbers. The underlying number values are identical to Minecraft'​s internal numbering (as well as the `ForgeDirection` Enum). This table serves as a two-directional look-up, so you can resolve names to numbers, but also numbers back to a human readable name. For example, `sides.top` has the value `1`, whereas `sides[1]` has the string value `top`. A couple of aliases for the side names are available, so it's less likely to accidentally pick the wrong one. These are the basic values:+默认情况下定义了如下别名:
  
-Bottom (`bottom`)Number: 0 +底面: ​`down`, `negy` 
-Top (`top`)Number: 1 +顶面: ​`up`, `posy` 
-Back (`back`)Number: 2 +背面: ​`north`, `negz` 
-Front (`front`)Number: 3 +前面: ​`south`, `posz`, `forward` 
-Right (`right`)Number: 4 +右面: ​`west`, `negx` 
-Left (`left`)Number: 5+左面: ​`east`, `posx`
  
-The following aliases are defined per default: +方向在读写红石信号时很有用,例如:
- +
-- Bottom: `down`, `negy` +
-- Top: `up`, `posy` +
-- Back: `north`, `negz` +
-- Front: `south`, `posz`, `forward` +
-- Right: `west`, `negx` +
-- Left: `east`, `posx` +
- +
-Useful for setting or getting redstone outputs or inputs, for example:+
 ```lua ```lua
 local component = require("​component"​) local component = require("​component"​)