‪GamecraftModdingAPI  ‪v1.8.0
‪The unofficial Gamecraft modding API
GamecraftModdingAPI.Blocks.SignalingBlock Class Reference

‪Common implementation for blocks that support wiring. More...

Inheritance diagram for GamecraftModdingAPI.Blocks.SignalingBlock:
GamecraftModdingAPI.Block GamecraftModdingAPI.Blocks.LogicGate GamecraftModdingAPI.Blocks.Motor GamecraftModdingAPI.Blocks.MusicBlock GamecraftModdingAPI.Blocks.Piston GamecraftModdingAPI.Blocks.Servo GamecraftModdingAPI.Blocks.SfxBlock GamecraftModdingAPI.Blocks.TextBlock GamecraftModdingAPI.Blocks.Timer

Public Member Functions

 SignalingBlock (EGID id)
 
 SignalingBlock (uint id)
 
Wire Connect (byte sourcePort, SignalingBlock destination, byte destinationPort)
 ‪Connect an output on this block to an input on another block. More...
 
Wire[] ConnectedToOutput (byte port)
 ‪All wires connected to the output port. These wires will always be wired output -> input. More...
 
Copy< T > ()
 ‪Creates a copy of the block in the game with the same properties, stats and wires. More...
 
bool Equals (Block other)
 
bool Equals (EGID other)
 
override bool Equals (object obj)
 
Block[] GetConnectedCubes ()
 ‪Returns an array of blocks that are connected to this one. Returns an empty array if the block doesn't exist. More...
 
override int GetHashCode ()
 
string InputPortName (byte port)
 ‪The input port's name. More...
 
string PortName (byte port, bool input)
 ‪The port's name. This is localized to the user's language, so this is not reliable for port identification. More...
 
Specialise< T > ()
 ‪Convert the block to a specialised block class. More...
 
override string ToString ()
 

Static Public Member Functions

static Block GetLastPlacedBlock ()
 ‪Returns the most recently placed block. More...
 
static void Init ()
 
static Block PlaceNew (BlockIDs block, float3 position, bool autoWire=false, Player player=null)
 ‪Place a new block at the given position. If scaled, position means the center of the block. The default block size is 0.2 in terms of position. Place blocks next to each other to connect them. The placed block will be a complete block with a placement grid and collision which will be saved along with the game. More...
 
static T PlaceNew< T > (BlockIDs block, float3 position, bool autoWire=false, Player player=null)
 ‪Place a new block at the given position. If scaled, position means the center of the block. The default block size is 0.2 in terms of position. Place blocks next to each other to connect them. The placed block will be a complete block with a placement grid and collision which will be saved along with the game. More...
 

Public Attributes

bool Exists => BlockEngine.BlockExists(Id)
 ‪Whether the block exists. The other properties will return a default value if the block doesn't exist. If the block was just placed, then this will also return false but the properties will work correctly. More...
 

Protected Member Functions

ref ChannelDataStruct GetChannelData (EGID portId, out bool exists)
 ‪[EXPERIMENTAL] Gets the channel data. More...
 
ref WireEntityStruct GetConnectedWire (EGID portId, out bool connected)
 ‪Gets the connected wire. More...
 
EGID[] GetInputIds ()
 ‪Generates the input port identifiers. More...
 
EGID[] GetOutputIds ()
 ‪Generates the output port identifiers. More...
 

Static Protected Attributes

static readonly BlockCloneEngine BlockCloneEngine = new BlockCloneEngine()
 
static readonly BlockEventsEngine BlockEventsEngine = new BlockEventsEngine()
 
static readonly MovementEngine MovementEngine = new MovementEngine()
 
static readonly PlacementEngine PlacementEngine = new PlacementEngine()
 
static readonly RemovalEngine RemovalEngine = new RemovalEngine()
 
static readonly RotationEngine RotationEngine = new RotationEngine()
 
static readonly ScalingEngine ScalingEngine = new ScalingEngine()
 
static readonly SignalEngine SignalEngine = new SignalEngine()
 

Package Attributes

BlockEngine.BlockInitData InitData
 

Static Package Attributes

static readonly BlockEngine BlockEngine = new BlockEngine()
 

Properties

BlockGroup?????? BlockGroup [get, set]
 ‪Returns the block group this block is a part of. Block groups can also be placed using blueprints. Returns null if not part of a group.
Setting the group after the block has been initialized will not update everything properly, so you can only set this property on blocks newly placed by your code.
To set it for existing blocks, you can use the Copy() method and set the property on the resulting block (and remove this block). More...
 
BlockColor Color [get, set]
 ‪The block's color. Returns BlockColors.Default if the block no longer exists. More...
 
float4 CustomColor [get, set]
 ‪The block's exact color. Gets reset to the palette color (Color property) after reentering the game. More...
 
bool? Flipped [get, set]
 
EGID Id [get]
 
uint InputCount [get]
 ‪The input port count. More...
 
string? Label [get, set]
 ‪The text displayed on the block if applicable, or null. Setting it is temporary to the session, it won't be saved. More...
 
BlockMaterial Material [get, set]
 
uint OutputCount [get]
 ‪The output port count. More...
 
float3 Position [get, set]
 ‪The block's current position or zero if the block no longer exists. A block is 0.2 wide by default in terms of position. More...
 
float3 Rotation [get, set]
 ‪The block's current rotation in degrees or zero if the block doesn't exist. More...
 
float3 Scale [get, set]
 ‪The block's non-uniform scale or zero if the block's invalid. Independent of the uniform scaling. The default scale of 1 means 0.2 in terms of position. More...
 
BlockIDs Type [get]
 ‪The block's type (ID). Returns BlockIDs.Invalid if the block doesn't exist anymore. More...
 
int UniformScale [get, set]
 ‪The block's uniform scale or zero if the block's invalid. Also sets the non-uniform scale. The default scale of 1 means 0.2 in terms of position. More...
 

Events

static EventHandler< BlockPlacedRemovedEventArgsPlaced [add, remove]
 ‪An event that fires each time a block is placed. More...
 
static EventHandler< BlockPlacedRemovedEventArgsRemoved [add, remove]
 ‪An event that fires each time a block is removed. More...
 

Detailed Description

Common implementation for blocks that support wiring.

Constructor & Destructor Documentation

◆ SignalingBlock() [1/2]

GamecraftModdingAPI.Blocks.SignalingBlock.SignalingBlock ( EGID  id)
inline

◆ SignalingBlock() [2/2]

GamecraftModdingAPI.Blocks.SignalingBlock.SignalingBlock ( uint  id)
inline

Member Function Documentation

◆ Connect()

Wire GamecraftModdingAPI.Blocks.SignalingBlock.Connect ( byte  sourcePort,
SignalingBlock  destination,
byte  destinationPort 
)
inline

‪Connect an output on this block to an input on another block.

Parameters
sourcePort‪Output port number.
destinationInput block.
destinationPortInput port number.
Returns
‪The wire connection
Exceptions
WiringException‪The wire could not be created.

◆ ConnectedToOutput()

Wire [] GamecraftModdingAPI.Blocks.SignalingBlock.ConnectedToOutput ( byte  port)
inline

‪All wires connected to the output port. These wires will always be wired output -> input.

Parameters
port‪Port number.
Returns
‪Wires connected to the output port.

◆ Copy< T >()

T GamecraftModdingAPI.Block.Copy< T > ( )
inlineinherited

‪Creates a copy of the block in the game with the same properties, stats and wires.

Returns
Type Constraints
T :Block 

◆ Equals() [1/3]

bool GamecraftModdingAPI.Block.Equals ( Block  other)
inlineinherited

◆ Equals() [2/3]

bool GamecraftModdingAPI.Block.Equals ( EGID  other)
inlineinherited

◆ Equals() [3/3]

override bool GamecraftModdingAPI.Block.Equals ( object  obj)
inlineinherited

◆ GetChannelData()

ref ChannelDataStruct GamecraftModdingAPI.Blocks.SignalingBlock.GetChannelData ( EGID  portId,
out bool  exists 
)
inlineprotected

‪[EXPERIMENTAL] Gets the channel data.

Returns
‪The channel data.
Parameters
portId‪Port identifier.
exists‪Whether the channel actually exists.

◆ GetConnectedCubes()

Block [] GamecraftModdingAPI.Block.GetConnectedCubes ( )
inlineinherited

‪Returns an array of blocks that are connected to this one. Returns an empty array if the block doesn't exist.

◆ GetConnectedWire()

ref WireEntityStruct GamecraftModdingAPI.Blocks.SignalingBlock.GetConnectedWire ( EGID  portId,
out bool  connected 
)
inlineprotected

‪Gets the connected wire.

Returns
‪The connected wire.
Parameters
portId‪Port identifier.
connected‪Whether the port has a wire connected to it.

◆ GetHashCode()

override int GamecraftModdingAPI.Block.GetHashCode ( )
inlineinherited

◆ GetInputIds()

EGID [] GamecraftModdingAPI.Blocks.SignalingBlock.GetInputIds ( )
inlineprotected

‪Generates the input port identifiers.

Returns
‪The input identifiers.

◆ GetLastPlacedBlock()

static Block GamecraftModdingAPI.Block.GetLastPlacedBlock ( )
inlinestaticinherited

‪Returns the most recently placed block.

Returns
‪The block object

◆ GetOutputIds()

EGID [] GamecraftModdingAPI.Blocks.SignalingBlock.GetOutputIds ( )
inlineprotected

‪Generates the output port identifiers.

Returns
‪The output identifiers.

◆ Init()

static void GamecraftModdingAPI.Block.Init ( )
inlinestaticinherited

◆ InputPortName()

string GamecraftModdingAPI.Blocks.SignalingBlock.InputPortName ( byte  port)
inline

‪The input port's name.

Parameters
portInput port number.
Returns
‪The port name, localized to the user's language.

◆ PlaceNew()

static Block GamecraftModdingAPI.Block.PlaceNew ( BlockIDs  block,
float3  position,
bool  autoWire = false,
Player  player = null 
)
inlinestaticinherited

‪Place a new block at the given position. If scaled, position means the center of the block. The default block size is 0.2 in terms of position. Place blocks next to each other to connect them. The placed block will be a complete block with a placement grid and collision which will be saved along with the game.

Parameters
block‪The block's type
color‪The block's color
material‪The block's material
position‪The block's position - default block size is 0.2
rotation‪The block's rotation in degrees
uscale‪The block's uniform scale - default scale is 1 (with 0.2 width)
scale‪The block's non-uniform scale - 0 means uscale is used
isFlipped‪Whether the block should be flipped
autoWire‪Whether the block should be auto-wired (if functional)
player‪The player who placed the block
Returns
‪The placed block or null if failed

◆ PlaceNew< T >()

static T GamecraftModdingAPI.Block.PlaceNew< T > ( BlockIDs  block,
float3  position,
bool  autoWire = false,
Player  player = null 
)
inlinestaticinherited

‪Place a new block at the given position. If scaled, position means the center of the block. The default block size is 0.2 in terms of position. Place blocks next to each other to connect them. The placed block will be a complete block with a placement grid and collision which will be saved along with the game.

Parameters
block‪The block's type
color‪The block's color
material‪The block's materialr
position‪The block's position - default block size is 0.2
rotation‪The block's rotation in degrees
uscale‪The block's uniform scale - default scale is 1 (with 0.2 width)
scale‪The block's non-uniform scale - 0 means uscale is used
isFlipped‪Whether the block should be flipped
autoWire‪Whether the block should be auto-wired (if functional)
player‪The player who placed the block
Returns
‪The placed block or null if failed
Type Constraints
T :Block 

◆ PortName()

string GamecraftModdingAPI.Blocks.SignalingBlock.PortName ( byte  port,
bool  input 
)
inline

‪The port's name. This is localized to the user's language, so this is not reliable for port identification.

Parameters
port‪Port number.
input‪Whether the port is an input (true) or an output (false).
Returns
‪The localized port name.

◆ Specialise< T >()

T GamecraftModdingAPI.Block.Specialise< T > ( )
inlineinherited

‪Convert the block to a specialised block class.

Returns
‪The block.
Template Parameters
T‪The specialised block type.
Type Constraints
T :Block 

◆ ToString()

override string GamecraftModdingAPI.Block.ToString ( )
inlineinherited

Member Data Documentation

◆ BlockCloneEngine

readonly BlockCloneEngine GamecraftModdingAPI.Block.BlockCloneEngine = new BlockCloneEngine()
staticprotectedinherited

◆ BlockEngine

readonly BlockEngine GamecraftModdingAPI.Block.BlockEngine = new BlockEngine()
staticpackageinherited

◆ BlockEventsEngine

readonly BlockEventsEngine GamecraftModdingAPI.Block.BlockEventsEngine = new BlockEventsEngine()
staticprotectedinherited

◆ Exists

bool GamecraftModdingAPI.Block.Exists => BlockEngine.BlockExists(Id)
inherited

‪Whether the block exists. The other properties will return a default value if the block doesn't exist. If the block was just placed, then this will also return false but the properties will work correctly.

◆ InitData

BlockEngine.BlockInitData GamecraftModdingAPI.Block.InitData
packageinherited

◆ MovementEngine

readonly MovementEngine GamecraftModdingAPI.Block.MovementEngine = new MovementEngine()
staticprotectedinherited

◆ PlacementEngine

readonly PlacementEngine GamecraftModdingAPI.Block.PlacementEngine = new PlacementEngine()
staticprotectedinherited

◆ RemovalEngine

readonly RemovalEngine GamecraftModdingAPI.Block.RemovalEngine = new RemovalEngine()
staticprotectedinherited

◆ RotationEngine

readonly RotationEngine GamecraftModdingAPI.Block.RotationEngine = new RotationEngine()
staticprotectedinherited

◆ ScalingEngine

readonly ScalingEngine GamecraftModdingAPI.Block.ScalingEngine = new ScalingEngine()
staticprotectedinherited

◆ SignalEngine

readonly SignalEngine GamecraftModdingAPI.Block.SignalEngine = new SignalEngine()
staticprotectedinherited

Property Documentation

◆ BlockGroup

BlockGroup?????? GamecraftModdingAPI.Block.BlockGroup
getsetinherited

‪Returns the block group this block is a part of. Block groups can also be placed using blueprints. Returns null if not part of a group.
Setting the group after the block has been initialized will not update everything properly, so you can only set this property on blocks newly placed by your code.
To set it for existing blocks, you can use the Copy() method and set the property on the resulting block (and remove this block).

◆ Color

BlockColor GamecraftModdingAPI.Block.Color
getsetinherited

‪The block's color. Returns BlockColors.Default if the block no longer exists.

◆ CustomColor

float4 GamecraftModdingAPI.Block.CustomColor
getsetinherited

‪The block's exact color. Gets reset to the palette color (Color property) after reentering the game.

◆ Flipped

bool? GamecraftModdingAPI.Block.Flipped
getsetinherited

Whether the block is flipped.

◆ Id

EGID GamecraftModdingAPI.Block.Id
getinherited

◆ InputCount

uint GamecraftModdingAPI.Blocks.SignalingBlock.InputCount
get

‪The input port count.

◆ Label

string? GamecraftModdingAPI.Block.Label
getsetinherited

‪The text displayed on the block if applicable, or null. Setting it is temporary to the session, it won't be saved.

◆ Material

BlockMaterial GamecraftModdingAPI.Block.Material
getsetinherited

The block's material.

◆ OutputCount

uint GamecraftModdingAPI.Blocks.SignalingBlock.OutputCount
get

‪The output port count.

◆ Position

float3 GamecraftModdingAPI.Block.Position
getsetinherited

‪The block's current position or zero if the block no longer exists. A block is 0.2 wide by default in terms of position.

◆ Rotation

float3 GamecraftModdingAPI.Block.Rotation
getsetinherited

‪The block's current rotation in degrees or zero if the block doesn't exist.

◆ Scale

float3 GamecraftModdingAPI.Block.Scale
getsetinherited

‪The block's non-uniform scale or zero if the block's invalid. Independent of the uniform scaling. The default scale of 1 means 0.2 in terms of position.

◆ Type

BlockIDs GamecraftModdingAPI.Block.Type
getinherited

‪The block's type (ID). Returns BlockIDs.Invalid if the block doesn't exist anymore.

◆ UniformScale

int GamecraftModdingAPI.Block.UniformScale
getsetinherited

‪The block's uniform scale or zero if the block's invalid. Also sets the non-uniform scale. The default scale of 1 means 0.2 in terms of position.

Event Documentation

◆ Placed

EventHandler< BlockPlacedRemovedEventArgs> GamecraftModdingAPI.Block.Placed
staticaddremoveinherited

‪An event that fires each time a block is placed.

◆ Removed

EventHandler< BlockPlacedRemovedEventArgs> GamecraftModdingAPI.Block.Removed
staticaddremoveinherited

‪An event that fires each time a block is removed.


The documentation for this class was generated from the following file: