Skip to main content

Protocol constants

Namespace: DoriosCore · Package: DoriosCore/index.js

DoriosCore exports selected identifiers so addons can integrate without duplicating protocol strings.

import {
DEFAULT_ENTITY_ID,
DEFAULT_SCHEDULER_PROFILE,
REGISTER_GAS_HOLDER_EVENT_ID,
REGISTER_GAS_ITEM_EVENT_ID,
REGISTER_MACHINE_UPGRADE_EVENT_ID,
SET_SCHEDULER_PROFILE_EVENT_ID,
SET_TICK_SPEED_EVENT_ID,
TICK_GROUP_COUNTS_PROPERTY_ID,
TICK_GROUP_PROPERTY_ID,
} from "DoriosCore/index.js";

Constants

ConstantValuePurpose
DEFAULT_ENTITY_IDutilitycraft:machine_entityDefault helper entity used by machines and generators when settings.entity.identifier is omitted.
DEFAULT_SCHEDULER_PROFILEfastFallback profile for missing or unsupported scheduler settings.
SET_SCHEDULER_PROFILE_EVENT_IDutilitycraft:set_scheduler_profileChanges the active closed-machine scheduler profile.
SET_TICK_SPEED_EVENT_IDutilitycraft:set_tick_speedUpdates the legacy global machinery tick-speed value.
REGISTER_GAS_ITEM_EVENT_IDutilitycraft:register_gas_itemRegisters item-to-gas insertion mappings.
REGISTER_GAS_HOLDER_EVENT_IDutilitycraft:register_gas_holderRegisters gas extraction-holder mappings.
REGISTER_MACHINE_UPGRADE_EVENT_IDutilitycraft:register_machine_upgradeRegisters upgrade item definitions and level perks.
TICK_GROUP_PROPERTY_IDutilitycraft:tick_groupEntity property containing a closed-machine group from 0 through 5.
TICK_GROUP_COUNTS_PROPERTY_IDutilitycraft:tick_group_countsWorld dynamic property containing the persisted five-element group-count array.

DEFAULT_ENTITY_ID

Use DEFAULT_ENTITY_ID when addon code needs to compare or explicitly reuse the standard DoriosCore helper entity.

import { DEFAULT_ENTITY_ID } from "DoriosCore/index.js";

const usesStandardHelper = settings.entity.identifier === DEFAULT_ENTITY_ID;

A custom helper entity is valid when it provides every component, property, event, inventory size, and type family required by the DoriosCore runtime. Changing the identifier alone is not enough.

Scheduler constants

DEFAULT_SCHEDULER_PROFILE, TICK_GROUP_PROPERTY_ID, and TICK_GROUP_COUNTS_PROPERTY_ID are intended for settings, diagnostics, and cross-addon coordination. Prefer TickScheduler methods over reading or writing dynamic state directly because the class validates profiles, normalizes counts, and broadcasts lifecycle changes.

import {
DEFAULT_SCHEDULER_PROFILE,
TickScheduler,
} from "DoriosCore/index.js";

const requestedProfile = addonConfig.scheduler ?? DEFAULT_SCHEDULER_PROFILE;
TickScheduler.setSchedulerProfile(requestedProfile);

Registration event constants

The three registration constants prevent addons from embedding event IDs in several files. See Script events for complete JSON payloads.

import { system } from "@minecraft/server";
import { REGISTER_GAS_ITEM_EVENT_ID } from "DoriosCore/index.js";

system.sendScriptEvent(
REGISTER_GAS_ITEM_EVENT_ID,
JSON.stringify({
"example:hydrogen_cell": {
amount: 1_000,
type: "example_hydrogen",
output: "example:empty_gas_cell",
},
}),
);

For registrations performed inside the same script runtime, prefer the corresponding class API when one exists—for example, MachineUpgradeRegistry.register(). Script events are useful when another module or addon owns the payload and communicates through the shared protocol.

Compatibility notes

  • SET_TICK_SPEED_EVENT_ID remains public for existing integrations. New closed-machine refresh controls should use scheduler profiles.
  • The fluid registration events are supported by DoriosCore but their identifiers are not public exports from DoriosCore/index.js; the Script events page documents their payloads for command and compatibility use.
  • These constants belong to DoriosCore's public contract. Constants not exported by DoriosCore/index.js are internal and should not be imported through deep file paths.