JeiDrawable
Link to jeidrawable
Represents anything that can be drawn in a JEI recipe or category.
A drawable can be anything from an ingredient, to a blank image, to something with animations. Refer to all the available factory methods for more information.
All JeiIngredients can automatically convert into a JeiDrawable, avoiding some boilerplate. Refer to invalid#asJeiDrawable(RawJeiIngredient) and its specialized versions invalid#asJeiDrawable(IItemStack) and invalid#asJeiDrawable(IFluidStack) for more information.
导入类
Link to 导入类
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.
ZenScript Copyimport mods.jei.component.JeiDrawable;
Static Methods
Link to static-methods
Name: blank
Creates a blank drawable of the given width and height.
A blank drawable draws nothing.
Returns: A blank JeiDrawable.
Return Type: JeiDrawable
ZenScript CopyJeiDrawable.blank(width as int, height as int) as JeiDrawable
参数 | 类型 | 描述 |
---|---|---|
参数 width #宽度 | 类型 int | 描述 The width of the drawable. |
参数 height #实体高度 | 类型 int | 描述 The height of the drawable. |
Name: of
Creates a drawable that draws the given JeiIngredient.
Returns: An ingredient JeiDrawable.
Return Type: JeiDrawable
ZenScript CopyJeiDrawable.of(ingredient as JeiIngredient) as JeiDrawable
参数 | 类型 | 描述 |
---|---|---|
参数 ingredient | 类型 JeiIngredient | 描述 The ingredient to draw. |
Name: of
Creates a drawable that draws the given texture, as specified in the parameters.
Returns: A texture JeiDrawable.
Return Type: JeiDrawable
ZenScript CopyJeiDrawable.of(texture as ResourceLocation, u as int, v as int, width as int, height as int) as JeiDrawable
参数 | 类型 | 描述 |
---|---|---|
参数 texture | 类型 资源位置 | 描述 A ResourceLocation identifying the path of the texture to draw. |
参数 u | 类型 int | 描述 The u coordinate of the texture (i.e. the top-left x coordinate of the rectangle to draw). |
参数 v | 类型 int | 描述 The v coordinate of the texture (i.e. the top-left y coordinate of the rectangle to draw). |
参数 width #宽度 | 类型 int | 描述 The width of the texture to draw. |
参数 height #实体高度 | 类型 int | 描述 The height of the texture to draw. |
Name: ofAnimated
Creates an animated version of the given drawable that animates over the course of a set of ticks.
The original drawable is left untouched, meaning that the returned instance is a fully separate drawable.
Returns: An animated JeiDrawable.
Return Type: JeiDrawable
ZenScript CopyJeiDrawable.ofAnimated(delegate as JeiDrawable, ticks as int, animation as JeiDrawableAnimation) as JeiDrawable
参数 | 类型 | 描述 |
---|---|---|
参数 delegate | 类型 JeiDrawable | 描述 The drawable that should be animated. |
参数 ticks | 类型 int | 描述 The amount of ticks over which the animation unfolds. 20 ticks is 1 second. |
参数 animation | 类型 JeiDrawableAnimation | 描述 The type of animation that should be rendered. |
Name: ofAnimated
Creates an animated version of a texture drawable.
Using this method is effectively equivalent to
ofAnimated(of(texture, u, v, width, height), ticks, animation)
. It is thus merely provided as a
convenience to avoid having to create two drawables.
Returns: An animated texture JeiDrawable.
Return Type: JeiDrawable
ZenScript CopyJeiDrawable.ofAnimated(texture as ResourceLocation, u as int, v as int, width as int, height as int, ticks as int, animation as JeiDrawableAnimation) as JeiDrawable
参数 | 类型 | 描述 |
---|---|---|
参数 texture | 类型 资源位置 | 描述 A ResourceLocation identifying the path of the texture to draw. |
参数 u | 类型 int | 描述 The u coordinate of the texture (i.e. the top-left x coordinate of the rectangle to draw). |
参数 v | 类型 int | 描述 The v coordinate of the texture (i.e. the top-left y coordinate of the rectangle to draw). |
参数 width #宽度 | 类型 int | 描述 The width of the texture to draw. |
参数 height #实体高度 | 类型 int | 描述 The height of the texture to draw. |
参数 ticks | 类型 int | 描述 The amount of ticks over which the animation unfolds. 20 ticks is 1 second. |
参数 animation | 类型 JeiDrawableAnimation | 描述 The type of animation that should be rendered. |
Name: ofNinePatch
Creates a new texture drawable which is based on a nine-patch texture.
Returns: A nine-patch texture JeiDrawable.
Return Type: JeiDrawable
ZenScript CopyJeiDrawable.ofNinePatch(texture as ResourceLocation, u as int, v as int, width as int, height as int, expectedWidth as int, expectedHeight as int) as JeiDrawable
参数 | 类型 | 描述 |
---|---|---|
参数 texture | 类型 资源位置 | 描述 A ResourceLocation identifying the path of the texture to draw. |
参数 u | 类型 int | 描述 The u coordinate of the texture (i.e. the top-left x coordinate of the rectangle to draw). |
参数 v | 类型 int | 描述 The v coordinate of the texture (i.e. the top-left y coordinate of the rectangle to draw). |
参数 width #宽度 | 类型 int | 描述 The width of the texture to draw. |
参数 height #实体高度 | 类型 int | 描述 The height of the texture to draw. |
参数 expectedWidth | 类型 int | 描述 The width of the drawable. |
参数 expectedHeight | 类型 int | 描述 The height of the drawable. |