Skip to content

Commit 902f58b

Browse files
committed
New method declarations in Dimension, UI, BlockSource, Item
1 parent 590531b commit 902f58b

10 files changed

Lines changed: 175 additions & 21 deletions

File tree

api/core-engine/BlockSource.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,4 +464,13 @@ declare class BlockSource {
464464
*/
465465
randomTick(x: number, y: number, z: number): void;
466466

467+
/**
468+
* Plays sound to entity by radius 16 blocks from source, if volume bigger than 1.0, radius multiplies on max radius.
469+
* @param entity entity uid
470+
* @param sound registered sound name
471+
* @param volume default `1.0`
472+
* @param pitch default `1.0`
473+
* @param players
474+
*/
475+
playSoundAtEntity(entity: number, sound: string, volume?: number, pitch?: number, players?: number[]): void;
467476
}

api/core-engine/Dimensions.d.ts

Lines changed: 113 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ declare namespace Dimensions {
1010
* Constructs a new dimension with specified name and preferred ID.
1111
* @param name dimension name, can be used to get dimension via
1212
* {@link Dimensions.getDimensionByName} call
13-
* @param preferredId preferred dimension ID. If ID is already occupied
13+
* @param preferredId preferred dimension ID, can't be smaller than 4. If ID is already occupied
1414
* by some another dimension, constructor will look for the next empty
1515
* dimension ID and assign it to the current dimension
1616
*/
1717
constructor(name: string, preferredId: number);
1818

1919
/**
20-
* Custom dimension ID.
20+
* Custom dimension ID. Can't be smaller than 4.
2121
*/
2222
id: number;
2323

@@ -122,6 +122,64 @@ declare namespace Dimensions {
122122
* @since 2.0.2b20
123123
*/
124124
resetFogDistance(): CustomDimension;
125+
126+
/**
127+
* Sets, can liquid evaporate or not.
128+
* @param evaporates if true water will evaporate just like nether
129+
*/
130+
setEvaporatesLiquids(evaporates: boolean): CustomDimension;
131+
132+
/**
133+
* Sets, has world tick of weather seasons or not.
134+
* @param seasons if true weather will work
135+
*/
136+
setWeatherSeasons(seasons: boolean): CustomDimension;
137+
138+
/**
139+
* Sets behavior with interacting between player and bed like a nether or end.
140+
* @param explode if true player can't sleep on beds
141+
*/
142+
setBedExplodesOnSleep(explode: boolean): CustomDimension;
143+
144+
/**
145+
* Sets visualization of sky like overworld.
146+
* @param enabled
147+
*/
148+
setSkyAtmosphereEnabled(enabled: boolean): CustomDimension;
149+
150+
/**
151+
* Sets height of clouds.
152+
* @param height height by "y" angle
153+
*/
154+
setCloudHeight(height: number): CustomDimension;
155+
156+
/**
157+
* Sets time of day by interval.
158+
* @param interval number between 0 and 1
159+
*/
160+
setTimeOfDay(interval: number): CustomDimension;
161+
162+
/**
163+
* Sets time of day by amplifier.
164+
* @param amplifier any number
165+
*/
166+
setTimeOfDayAmplifier(amplifier: number): CustomDimension;
167+
168+
/**
169+
* Resets custom time of day.
170+
*/
171+
resetTimeOfDay(): CustomDimension;
172+
173+
/**
174+
* Sets star brightness.
175+
* @param interval number between 0 and 1
176+
*/
177+
setStarBrightness(interval: number): CustomDimension;
178+
179+
/**
180+
* Resets star brightness.
181+
*/
182+
resetStarBrightness(): CustomDimension;
125183
}
126184

127185
/**
@@ -505,4 +563,57 @@ declare namespace Dimensions {
505563
[number, number] |
506564
{ x: number, y: number } |
507565
number
566+
567+
/**
568+
* Function to enable or disable stars by nights.
569+
* @param dimensionId numeric id of the dimension
570+
* @param enabled
571+
*/
572+
function setShouldRenderStars(dimensionId: number, enabled: boolean): void;
573+
574+
/**
575+
* Function to enable or disable sun by days.
576+
* @param dimensionId numeric id of the dimension
577+
* @param enabled
578+
*/
579+
function setShouldRenderSun(dimensionId: number, enabled: boolean): void;
580+
581+
/**
582+
* Function to enable or disable moon by nights.
583+
* @param dimensionId numeric id of the dimension
584+
* @param enabled
585+
*/
586+
function setShouldRenderMoon(dimensionId: number, enabled: boolean): void;
587+
588+
/**
589+
* Function to enable or disable clouds.
590+
* @param dimensionId numeric id of the dimension
591+
* @param enabled
592+
*/
593+
function setShouldRenderClouds(dimensionId: number, enabled: boolean): void;
594+
595+
/**
596+
* Function to set, can liquid evaporate or not.
597+
* @param dimensionId numeric id of the dimension
598+
* @param evaporates if true water will evaporate just like nether
599+
*/
600+
function setEvaporatesLiquids(dimensionId: number,evaporates: boolean): void;
601+
602+
/**
603+
* Function to set, has world tick of weather seasons or not.
604+
* @param dimensionId numeric id of the dimension
605+
* @param seasons if true weather will work
606+
*/
607+
function setWeatherSeasons(dimensionId: number, seasons: boolean): void;
608+
609+
/**
610+
* Function specifies whether the sky produces light (like in overworld) or not
611+
* (like in the End or Nether).
612+
* @param dimensionId numeric id of the dimension
613+
* @param hasSkyLight if true, the sky produces light in the dimension
614+
*/
615+
function setHasSkyLight(dimensionId: number, hasSkyLight: boolean): void;
616+
617+
function getMoonPhase(): number;
618+
function getMoonBrightness(): number;
508619
}

api/core-engine/Item.d.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ declare namespace Item {
1414
* item.
1515
* @param id string ID of the item
1616
* @returns NativeItem instance associated with this item.
17+
* @deprecated
1718
*/
1819
function getItemById(id: string): NativeItem;
1920

@@ -345,6 +346,33 @@ declare namespace Item {
345346
*/
346347
function setMaxUseDuration(id: number | string, duration: number): void;
347348

349+
function isGlint(id: number | string, data?: number, extra?: ItemExtraData): void;
350+
function isFood(id: number | string): void;
351+
function isArmor(id: number | string): void;
352+
function isThrowable(id: number | string): void;
353+
function getNutrition(id: number | string): number;
354+
function getArmorValue(id: number | string): number;
355+
function isArmorDamageable(id: number | string): boolean;
356+
function isRequiresIconOverride(id: number | string): boolean;
357+
function isToolRender(id: number | string): boolean;
358+
function isHandEquipped(id: number | string): boolean;
359+
function getUseAnimation(id: number | string): EItemAnimation;
360+
function isStackedByData(id: number | string): boolean;
361+
function isAllowedInOffhand(id: number | string): boolean;
362+
function isShouldDespawn(id: number | string): boolean;
363+
function isFireResistant(id: number | string): boolean;
364+
function isExplodable(id: number | string): boolean;
365+
function isMirroredSprite(id: number | string): boolean;
366+
function getEnchantSlot(id: number | string): number;
367+
function getEnchantValue(id: number | string): number;
368+
function getCategory(id: number | string): EItemCategory;
369+
function getCreativeCategory(id: number | string): EItemCategory;
370+
function isLiquidClip(id: number | string): boolean;
371+
function setMirroredSprite(id: number | string, enabled: boolean): void;
372+
function setRequiresIconOverride(id: number | string, enabled: boolean): void;
373+
function setEnchantType(id: number | string, type: number, value: number): void;
374+
function setEnchantibility(id: number | string, type: number, value: number): void;
375+
348376
/**
349377
* Same as {@link Item.registerUseFunction}, but supports numeric IDs only.
350378
*/

api/core-engine/UI.Drawing.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ declare namespace UI {
66

77
interface ColorDrawing {
88
type: "background",
9-
color?: number,
9+
color?: UI.FontColor,
1010
mode?: number,
1111
colorMode?: number;
1212
}

api/core-engine/UI.IWindow.d.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ declare namespace UI {
6464
* @returns Object containing current style of the window.
6565
*/
6666
getStyle(): Style;
67+
getStyleSafe(): Style;
68+
6769
/**
6870
* Forces ui drawables of the window to refresh.
6971
* @param onCurrentThread if `true`, the drawables will be refreshed
@@ -449,6 +451,7 @@ declare namespace UI {
449451
getStringProperty(name: string, fallback: string): string;
450452
getBooleanProperty(name: string, fallback: boolean): boolean;
451453
setProperty(name: string, value: any): void;
452-
static getBitmapByDescription(style: Style, description: string): IBitmapWrap;
454+
getColorProperty(valueOrProperty: number | string, defaultValue: number): number
455+
static getBitmapByDescription(style: Style, description: string): IBitmapWrap;
453456
}
454457
}

api/core-engine/UI.StandardWindow.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ declare namespace UI {
181181
*/
182182
constructor();
183183
getContent(): StandardWindowContent;
184-
getStyleSafe(): Style;
185184
setContent(content: StandardWindowContent): void;
186185
}
187186

api/core-engine/UI.Window.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ declare namespace UI {
207207
* @returns Object containing current style of the window.
208208
*/
209209
getStyle(): Style;
210+
getStyleSafe(): Style;
210211
/**
211212
* Overrides style properties of the current style by the values
212213
* specified in the style parameter.

api/core-engine/UI.WindowGroup.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ declare namespace UI {
132132
* @returns Object containing current style of the window.
133133
*/
134134
getStyle(): Style;
135+
getStyleSafe(): Style;
135136
setBlockingBackground(bb: boolean): void;
136137
/**
137138
* Forces ui elements of the window to refresh.

api/core-engine/UI.d.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ declare namespace UI {
77
[key: string]: string
88
};
99

10-
/**
10+
/**
11+
* Hex color like `#ffffff`or color names like a `red`, `pink` and another or `[r, g, b, a?]` array.
12+
*/
13+
type FontColor = string | [r: number, g: number, b: number, a?: number] | number;
14+
15+
/**
1116
* Object containing font parameters. If no color, size and shadow are
1217
* specified, default values are ignored and white font with text size 20,
1318
* white color and 0.45 shadow is created.
@@ -18,7 +23,7 @@ declare namespace UI {
1823
* {@link android.graphics.Color}).
1924
* @default 0x000 // black
2025
*/
21-
color?: number,
26+
color?: FontColor,
2227
/**
2328
* Font size.
2429
* @default 20
@@ -82,7 +87,7 @@ declare namespace UI {
8287
*/
8388
static readonly ALIGN_CENTER_HORIZONTAL: number;
8489
alignment: number;
85-
color: number;
90+
color: FontColor;
8691
isBold: boolean;
8792
isCursive: boolean;
8893
isUnderlined: boolean;
@@ -95,7 +100,7 @@ declare namespace UI {
95100
* @param size font size
96101
* @param shadow shadow offset
97102
*/
98-
constructor(color: number, size: number, shadow: number);
103+
constructor(color: FontColor, size: number, shadow: number);
99104
/**
100105
* Constructs new instance of the font with specified parameters.
101106
* @param params parameters of the font
@@ -169,4 +174,11 @@ declare namespace UI {
169174
* a replacement in the presented Inner Core API.
170175
*/
171176
function getContext(): android.app.Activity;
177+
178+
/**
179+
*
180+
* @param value hex-string, rgba array or names of color in a string format.
181+
* @param defaultValue returns if result is wrong
182+
*/
183+
function parseColor(value: FontColor, defaultValue: number): number;
172184
}

i18n/ru/docusaurus-plugin-content-docs/current/blocks/renders/conditioning.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,13 @@
11
# Привязка условий
22

3-
```mdx-code-block
4-
import NotImplemented from "@site/src/components/NotImplemented"
5-
6-
<NotImplemented />
7-
```
3+
Вы могли видеть, как ванильные заборы соединяются между собой, как и провода из различных модов. Но как же такое возможно? Ведь обычно блоки являются единой основой, не взаимодействующей с другими внешне. Об этом в этой статье.
84

95
## Для чего нужно
106

11-
```mdx-code-block
12-
<NotImplemented />
13-
```
7+
Данная технология нужна для создания более сложного визуала моделькам блоков, добавляя какие-то новые детали на блоки при определённых условиях.
148

159
## Соседние блоки
1610

17-
```mdx-code-block
18-
<NotImplemented />
19-
```
20-
2111
## Рандомизация
2212

2313
```mdx-code-block

0 commit comments

Comments
 (0)