public class Door extends MaterialData implements Directional, Openable
这个类曾被弃用,但已被重构以适用于现今的门. 由于Minecraft的门的内部表示,依赖于isTopHalf()的一些方法未被定义.
关于朝向:这个朝向一般是玩家放置门时他面对的方向. 比如我朝西方放置一个门,它的朝向(技术上讲它的"facing"数据值就是west)是朝西,那么关门时门轴是朝东方向转.
构造器和说明 |
---|
Door()
已过时。
遗留的旧API,相当于new
Door(Material.LEGACY_WOODEN_DOOR); |
Door(Material type) |
Door(Material type,
BlockFace face)
以指定材质和朝向构造门的下半部分(关着的门).
|
Door(Material type,
BlockFace face,
boolean isOpen)
以指定材质和朝向构造门的下半部分,并设置这个门关着还是开着.
|
Door(Material type,
boolean isHingeRight)
以指定材质和门轴的左右侧构造门的上半部分.
|
Door(Material type,
byte data)
已过时。
不安全的参数
|
Door(TreeSpecies species,
BlockFace face)
以指定树种和朝向构造一个木门的下半部分(关着的门).
|
Door(TreeSpecies species,
BlockFace face,
boolean isOpen)
以指定树种和朝向构造门的下半部分,并设置这个门关着还是开着.
|
Door(TreeSpecies species,
boolean isHingeRight)
以指定树种和朝向构造门的上半部分,并指定门轴在左侧还是右侧.
|
限定符和类型 | 方法和说明 |
---|---|
Door |
clone() |
BlockFace |
getFacing()
获取门的朝向.
|
boolean |
getHinge()
返回门轴在哪一侧.
|
BlockFace |
getHingeCorner()
已过时。
不应使用此方法;请使用hinge/facing对应的getter
|
static Material |
getWoodDoorOfSpecies(TreeSpecies species)
返回用你给定的树种做成的木门的物品.
|
boolean |
isOpen()
若
isTopHalf() 为true,则得不到结果(个人猜测总得返回false). |
boolean |
isTopHalf() |
void |
setFacingDirection(BlockFace face)
设置门的朝向.
|
void |
setHinge(boolean isHingeRight)
设置门轴在左侧还是右侧.左侧为false,右侧为true.
|
void |
setOpen(boolean isOpen)
设置门是否开着.若
isTopHalf() 为true则此方法没有效果. |
void |
setTopHalf(boolean isTopHalf)
设置这个门是上半部分的还是下半部分的.
|
java.lang.String |
toString() |
equals, getData, getItemType, hashCode, setData, toItemStack, toItemStack
@Deprecated public Door()
Door(Material.LEGACY_WOODEN_DOOR);
public Door(Material type)
public Door(Material type, BlockFace face)
原文:Constructs the bottom half of a door of the given material type, facing the specified direction and set to closed
type
- 这个门是用什么材料做成的.必须和这个门的上半部分相同.face
- 门的朝向.Material.LEGACY_WOODEN_DOOR
,
Material.LEGACY_IRON_DOOR_BLOCK
,
Material.LEGACY_SPRUCE_DOOR
,
Material.LEGACY_BIRCH_DOOR
,
Material.LEGACY_JUNGLE_DOOR
,
Material.LEGACY_ACACIA_DOOR
,
Material.LEGACY_DARK_OAK_DOOR
,
BlockFace.WEST
,
BlockFace.NORTH
,
BlockFace.EAST
,
BlockFace.SOUTH
public Door(Material type, BlockFace face, boolean isOpen)
原文:Constructs the bottom half of a door of the given material type, facing the specified direction and set to open or closed
type
- 这个门是用什么材料做成的.必须和这个门的上半部分相同.face
- 门的朝向isOpen
- 这个门是否开着Material.LEGACY_WOODEN_DOOR
,
Material.LEGACY_IRON_DOOR_BLOCK
,
Material.LEGACY_SPRUCE_DOOR
,
Material.LEGACY_BIRCH_DOOR
,
Material.LEGACY_JUNGLE_DOOR
,
Material.LEGACY_ACACIA_DOOR
,
Material.LEGACY_DARK_OAK_DOOR
,
BlockFace.WEST
,
BlockFace.NORTH
,
BlockFace.EAST
,
BlockFace.SOUTH
public Door(Material type, boolean isHingeRight)
原文:Constructs the top half of door of the given material type and with the hinge on the left or right
type
- 这个门是用什么材料做成的.必须和这个门的下半部分相同.isHingeRight
- 门轴在右侧为true,在左侧为falseMaterial.LEGACY_WOODEN_DOOR
,
Material.LEGACY_IRON_DOOR_BLOCK
,
Material.LEGACY_SPRUCE_DOOR
,
Material.LEGACY_BIRCH_DOOR
,
Material.LEGACY_JUNGLE_DOOR
,
Material.LEGACY_ACACIA_DOOR
,
Material.LEGACY_DARK_OAK_DOOR
public Door(TreeSpecies species, BlockFace face)
原文:Constructs the bottom half of a wooden door of the given species, facing the specified direction and set to closed
species
- 这个木门是用什么树种做成的.必须和这个门的上半部分相同.face
- 门的朝向TreeSpecies
,
BlockFace.WEST
,
BlockFace.NORTH
,
BlockFace.EAST
,
BlockFace.SOUTH
public Door(TreeSpecies species, BlockFace face, boolean isOpen)
原文:Constructs the bottom half of a wooden door of the given species, facing the specified direction and set to open or closed
species
- 这个木门是用什么树种做成的.必须和这个门的上半部分相同.face
- 门的朝向isOpen
- 门是否开着TreeSpecies
,
BlockFace.WEST
,
BlockFace.NORTH
,
BlockFace.EAST
,
BlockFace.SOUTH
public Door(TreeSpecies species, boolean isHingeRight)
原文:Constructs the top half of a wooden door of the given species and with the hinge on the left or right
species
- 这个木门是用什么树种做成的.必须和这个门的下半部分相同.isHingeRight
- 门轴在右侧为true,在左侧为falseTreeSpecies
@Deprecated public Door(Material type, byte data)
type
- the typedata
- the raw data valuepublic static Material getWoodDoorOfSpecies(TreeSpecies species)
原文:Returns the item type of a wooden door for the given tree species.
species
- 树的物种Material.LEGACY_WOODEN_DOOR
,
Material.LEGACY_SPRUCE_DOOR
,
Material.LEGACY_BIRCH_DOOR
,
Material.LEGACY_JUNGLE_DOOR
,
Material.LEGACY_ACACIA_DOOR
,
Material.LEGACY_DARK_OAK_DOOR
public boolean isOpen()
isTopHalf()
为true,则得不到结果(个人猜测总得返回false).
原文:Result is undefined if isTopHalf()
is true.
public void setOpen(boolean isOpen)
isTopHalf()
为true则此方法没有效果.
原文:Set whether the door is open. Undefined if isTopHalf()
is true.
public boolean isTopHalf()
public void setTopHalf(boolean isTopHalf)
原文:Configure this part of the door to be either the top or the bottom half
isTopHalf
- true将设此门为上半部分的@Deprecated public BlockFace getHingeCorner()
public java.lang.String toString()
toString
在类中 MaterialData
public void setFacingDirection(BlockFace face)
isTopHalf()
为true,则没有效果.
原文:Set the direction that this door should is facing.
Undefined if isTopHalf()
is true.
setFacingDirection
在接口中 Directional
face
- 朝向public BlockFace getFacing()
isTopHalf()
为true,则没有效果.
原文:Get the direction that this door is facing.
Undefined if isTopHalf()
is true.
getFacing
在接口中 Directional
public boolean getHinge()
isTopHalf()
为false,则没有效果.
原文:Returns the side of the door the hinge is on.
Undefined if isTopHalf()
is false.
public void setHinge(boolean isHingeRight)
isTopHalf()
为false,则没有效果.
原文:Set whether the hinge is on the left or right side. Left is false, right is true.
Undefined if isTopHalf()
is false.
isHingeRight
- 门轴在右侧为true,在左侧为falsepublic Door clone()
clone
在类中 MaterialData