Difference between revisions of "Redstone Input Port"
(→Recipe) |
|||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
The Redstone Input Port is an [[Screen#Upgrades|upgrade]] which allows web pages to read the redstone levels around the screen. | The Redstone Input Port is an [[Screen#Upgrades|upgrade]] which allows web pages to read the redstone levels around the screen. | ||
+ | |||
+ | {{#widget:AdSense}} | ||
==Recipe== | ==Recipe== | ||
Line 5: | Line 7: | ||
The item on the left is a [[Blank Upgrade]]. | The item on the left is a [[Blank Upgrade]]. | ||
+ | |||
+ | ==How to use== | ||
+ | Like any other upgrades, install it by right-clicking on a screen with the upgrade in your main hand. You will need the "Link & upgrade" permission to do that. | ||
==JavaScript== | ==JavaScript== | ||
− | The upgrade name returned by <code>GetUpgrades</code> is <code>webdisplays:redinput</code> | + | * The upgrade name returned by <code>GetUpgrades</code> is <code>webdisplays:redinput</code> |
− | + | * If this upgrade is used in combination with the [[Redstone Output Port]] upgrade, the redstone level obtained by any of these queries/callbacks on an emitting block is undefined | |
− | If this upgrade is used in combination with the [[Redstone Output Port]] upgrade, the redstone level obtained by any of these | + | * For more information on how to use these queries, check out [[Screen#JavaScript]] |
− | === | + | ===Queries=== |
− | This upgrade adds the following | + | This upgrade adds the following queries: |
{| class="wikitable" | {| class="wikitable" | ||
Line 23: | Line 28: | ||
|GetRedstoneAt||int, int||<code>{"level":int}</code>||0, 0 is the bottom left block. Rotation is not handled. | |GetRedstoneAt||int, int||<code>{"level":int}</code>||0, 0 is the bottom left block. Rotation is not handled. | ||
|- | |- | ||
− | |GetRedstoneArray||None||<code>{"levels":[int]}</code>||The block x, y is at <code> | + | |GetRedstoneArray||None||<code>{"levels":[int]}</code>||The level of the block at (x, y) is at index <code>y * width + x</code> |
|} | |} | ||
Latest revision as of 08:09, 14 February 2018
The Redstone Input Port is an upgrade which allows web pages to read the redstone levels around the screen.
Recipe
The item on the left is a Blank Upgrade.
How to use
Like any other upgrades, install it by right-clicking on a screen with the upgrade in your main hand. You will need the "Link & upgrade" permission to do that.
JavaScript
- The upgrade name returned by
GetUpgrades
iswebdisplays:redinput
- If this upgrade is used in combination with the Redstone Output Port upgrade, the redstone level obtained by any of these queries/callbacks on an emitting block is undefined
- For more information on how to use these queries, check out Screen#JavaScript
Queries
This upgrade adds the following queries:
Query name | Arguments | Return value | Comment |
---|---|---|---|
GetRedstoneAt | int, int | {"level":int} |
0, 0 is the bottom left block. Rotation is not handled. |
GetRedstoneArray | None | {"levels":[int]} |
The level of the block at (x, y) is at index y * width + x
|
Callbacks
This upgrade adds the following callbacks:
-
webdisplaysRedstoneCallback(x, y, level)
will be called if the redstone level of the block at x, y has changed.