Skip to main content

โŒจ๏ธ Skript

tip

For advanced skript users, please use reflection to achieve more advanced functions. If you encounter problems when using the Skript features provided by CraftEngine, please give us feedback in time. If you'd like to request a new Skript feature and you know Java, consider contributing your code via a pull request!

warning

You need to install Skript 2.15.0+.

Typesโ€‹

CraftEngine registers two extra types that can be stored in variables. Parse them from strings with parsed as:

# A full immutable block state (id + properties)
set {_state} to "default:table_lamp[lit=true,facing=east]" parsed as custom block state

# A block state matcher, mostly used in event filters
set {_matcher} to "default:table_lamp[lit=true]" parsed as unsafe block state matcher

Unquoted literals also work in effects and event filters, e.g. place custom block default:table_lamp[lit=true] at player.

Eventsโ€‹

๐Ÿ“…

Place/Break CraftEngine Block Event

Event

Triggers when placing and breaking CraftEngine blocks

Syntax:

[on] (break[ing]|1ยฆmin(e|ing)) of (custom|ce|craft-engine) block[s] [[of] %-unsafeblockstatematchers%][on] (plac(e|ing)|build[ing]) of (custom|ce|craft-engine) block[s] [[of] %-unsafeblockstatematchers%]

Field:

event-blockevent-locationevent-playerevent-world

Example:

on break of ce block default:palm_log[axis=y]:
    send "You broke the custom block!" to event-player
๐Ÿ“…

Place/Break CraftEngine Furniture Event

Event

Triggers when placing and breaking CraftEngine furniture

Syntax:

[on] (break[ing]) of [(custom|ce|craft-engine)] furniture[s] [[of] %-strings%][on] (plac(e|ing)|build[ing]) of [(custom|ce|craft-engine)] furniture[s] [[of] %-strings%]

Field:

event-entityevent-locationevent-playerevent-world

Example:

on place of custom furniture default:chinese_lantern:
    send "You clicked the custom block!" to event-player
๐Ÿ“…

Click CraftEngine Block/Furniture Event

Event

Triggers when clicking on CraftEngine block and furniture

Syntax:

[on] [(" + RIGHT + ":right|" + LEFT + ":left)(| |-)][mouse(| |-)]click[ing] of (ce|craft-engine) [on %-unsafeblockstatematchers/strings%] [(with|using|holding) %-itemtype%][on] [(" + RIGHT + ":right|" + LEFT + ":left)(| |-)][mouse(| |-)]click[ing] of (ce|craft-engine) (with|using|holding) %itemtype% on %unsafeblockstatematchers/strings%

Field:

event-blockevent-entityevent-locationevent-playerevent-world

Example:

on right-click of craft-engine on default:chinese_lantern:
     send "You clicked the custom block!" to event-player
๐Ÿ“…

CraftEngine Reload Event

Event

Triggers when CraftEngine is loaded

Syntax:

[on] (ce|craft(engine|-engine)) [first] (load[ed]|reload)

Example:

on craft-engine loaded:
    send "Ho, CraftEngine has been loaded, you can get ce items now!" to console
on craft-engine first loaded:
    send "Ho, CraftEngine has been loaded on server enable, script will init something now!" to console
๐Ÿ“…

Hit CraftEngine Furniture Event

Event

Triggers when a player hits CraftEngine furniture. Cancellable

Syntax:

[on] hit[ting] [of] [(custom|ce|craft-engine)] furniture[s] [[of] %-strings%]

Field:

event-entityevent-locationevent-playerevent-world

Example:

on hit of furniture "default:wooden_chair":
    cancel event
๐Ÿ“…

Attempt Place CraftEngine Block/Furniture Event

Event

Triggers when a player attempts to place a custom block or furniture, before it is actually placed. Cancellable

Syntax:

[on] attempt[ing] to place (custom|ce|craft-engine) block[s] [[of] %-unsafeblockstatematchers%][on] attempt[ing] to place [(custom|ce|craft-engine)] furniture[s] [[of] %-strings%]

Field:

event-blockevent-locationevent-playerevent-world

Example:

on attempt to place custom block:
    cancel event

Conditionsโ€‹

โ“

Is Custom Item

Condition

Checks item is a custom item from CraftEngine

Syntax:

%itemstack/itemtype/slot% (is [a[n]]|are) (custom|ce|craft-engine) item[s]%itemstack/itemtype/slot% (isn't|is not|aren't|are not) [a[n]] (custom|ce|craft-engine) item[s]

Example:

on mine:
    if event-player's tool is a custom item:
      send "you are mine with a custom item" to event-player
โ“

Is Custom Block

Condition

Checks block is a custom block from CraftEngine

Syntax:

%blocks% (is|are) [a[n]] (custom|ce|craft-engine) block[s]%blocks% (is|are) (n't| not) [a[n]] (custom|ce|craft-engine) block[s]

Example:

on mine:
    if event-block is custom block:
      send "you break a custom block" to event-player
โ“

Is Custom Furniture

Condition

Checks entity is a custom furniture from CraftEngine

Syntax:

%entities% (is|are) [a[n]] [(custom|ce|craft-engine)] furniture[s]%entities% (is|are) (n't| not) [a[n]] [(custom|ce|craft-engine)] furniture[s]

Example:

on click:
    set {_entity} to nearest pig
    if {_entity} is a ce furniture:
      send "What am I doing?" to event-player
โ“

Is Furniture Seat

Condition

Checks entity is a seat of a CraftEngine furniture

Syntax:

%entities% (is|are) [a[n]] [(custom|ce|craft-engine)] furniture seat[s]%entities% (is|are) (n't| not) [a[n]] [(custom|ce|craft-engine)] furniture seat[s]

Example:

if target entity is a furniture seat:
    send "This is a seat!" to event-player
โ“

Is Furniture Collider

Condition

Checks entity is a collision entity of a CraftEngine furniture

Syntax:

%entities% (is|are) [a[n]] [(custom|ce|craft-engine)] furniture (collider|collision entit(y|ies))%entities% (is|are) (n't| not) [a[n]] [(custom|ce|craft-engine)] furniture (collider|collision entit(y|ies))

Example:

if target entity is a furniture collider:
    send "This is a collider!" to event-player

Expressionsโ€‹

๐Ÿ”ง

Custom Item

Expression

Get custom item from namespace id

Syntax:

[(the|a)] (custom|ce|craft-engine) item [with [namespace] id] %strings%

Example:

set {_item} to custom item with namespace id "default:topaz"
๐Ÿ”ง

Custom Item Id

Expression

Get a namespace id of custom item

Syntax:

(custom|ce|craft-engine) item [namespace] id of %itemstack/itemtype/slot%%itemstack/itemtype/slot%'[s] (custom|ce|craft-engine) item [namespace] id

Example:

set {_itemId} to craft-engine item id of player's tool
๐Ÿ”ง

Custom Block Id

Expression

Get a namespace id of custom block

Syntax:

%blocks/blockdata/customblockstates%'s (custom|ce|craft-engine) block [namespace] id(custom|ce|craft-engine) block [namespace] id of %blocks/blockdata/customblockstates%

Example:

on mine:
    if event-block's ce block id is "default:chinese_lantern":
      send "break a chinese_lantern block" to event-player
๐Ÿ”ง

Custom Block State

Expression

Get block state of custom block

Syntax:

%blocks/blockdata/customblockstates%'s (custom|ce|craft-engine) block[ ]state(custom|ce|craft-engine) block[ ]state of %blocks/blockdata/customblockstates%

Example:

on mine:
    send event-block's ce block state to event-player
๐Ÿ”ง

Furniture Id

Expression

Get furniture id from entity

Syntax:

%entities%'s [(custom|ce|craft-engine)] furniture [namespace] id

Example:

set {_furnitureId} to {_entity}'s craft-engine furniture id
๐Ÿ”ง

Custom Block State Property

Expression

Get or set a single property of a custom block state. Block states are immutable: setting a property replaces the state stored in the variable

Syntax:

(custom|ce|craft-engine) block [state] propert(y|ies) %strings% of %customblockstates%%customblockstates%'[s] (custom|ce|craft-engine) block [state] propert(y|ies) %strings%

Example:

set {_s} to "default:table_lamp[lit=true]" parsed as custom block state
    set custom block property "facing" of {_s} to "south"
    place custom block {_s} at target block
๐Ÿ”ง

All Custom Block States

Expression

Get all possible states of custom blocks

Syntax:

[(all|the)] [possible] [block] states of (custom|ce|craft-engine) block[s] %strings%

Example:

loop all states of custom block "default:table_lamp":
    send "%loop-value%"
๐Ÿ”ง

Furniture Variant

Expression

Get, set or reset the variant of a furniture entity. Resetting restores the default variant

Syntax:

(custom|ce|craft-engine) furniture variant of %entities%%entities%'[s] (custom|ce|craft-engine) furniture variant

Example:

set furniture variant of target entity to "wall"
reset furniture variant of target entity
๐Ÿ”ง

Furniture Variants

Expression

Get all variant names of furniture definitions

Syntax:

[(all|the)] variants of [(custom|ce|craft-engine)] furniture %strings%

Example:

send variants of furniture "default:flower_basket" to player

Effect

โšก

Place Custom Block

Effect

Place a custom block

Syntax:

place (custom|ce|craft-engine) block %customblockstates% [at] [%directions% %locations%]

Example:

place custom block default:palm_log[axis=x] at location of the player
โšก

Place Furniture

Effect

Place a furniture, optionally with a specific variant

Syntax:

place [(custom|ce|craft-engine)] furniture[s] %strings% [with variant %-strings%] [at] [%directions% %locations%]

Example:

place furniture "default:bench" at location of player
place furniture "default:flower_basket" with variant "wall" at location of player
โšก

Remove Custom Block

Effect

Remove custom blocks at the given locations. Non-custom blocks are ignored

Syntax:

(remove|break) (custom|ce|craft-engine) block[s] [at] [%directions% %locations%]

Example:

remove custom block at target block
โšก

Remove Furniture

Effect

Remove a furniture

Syntax:

remove [(custom|ce|craft-engine)] furniture %entities%

Example:

remove craft-engine furniture target entity
โšก

Force Set Furniture Variant

Effect

Forcefully set the variant of furniture entities, skipping the collision check. Compare with 'set furniture variant of ... to ...' which respects collision checks

Syntax:

force[fully] set [(custom|ce|craft-engine)] furniture variant of %entities% to %strings%

Example:

force set furniture variant of target entity to "ceiling"