Previous: ็ฉๅ็ฑปๆไปถ.mdใยทใNext: ็ปๆตๆไปถ.md Related: ../02-ๆไธปๆๅ/่ชๅฎไนๆนๅ.md ยท ../04-ๅผๅ่ /ๅทฅๅ ท้.md ยท ๆฆ่ง.md
๐งฑ Block / Model / Crop Integration โ
Beyond "fetching items", QCL also wires in three kinds of world-interaction capabilities: CraftEngine's blocks and furniture, ModelEngine's modeled entities, and CustomCrops' crops. They all follow the soft-dependency + reflection bridge approach: if the plugin isn't installed they silently become unavailable, never affecting startup.
๐งฐ Shared foundation: The "multi-version, multi-signature compatibility" of every bridge on this page is built on top of
ReflectionBridge/ReflectionCacheโ method signatures across different major versions of the same plugin are matched automatically. For developer details see ๐ ../04-ๅผๅ่ /ๅทฅๅ ท้.md.
๐ ๏ธ 1. CraftEngine โ Items / Blocks / Furniture โ
| Item | Content |
|---|---|
| Bridge classes | CraftEngineBridge / CraftEngineManager |
| Three object categories involved | Custom items, custom blocks, custom furniture |
CraftEngine's item references (ce-namespace_id) are covered in ็ฉๅ็ฑปๆไปถ.md. This page focuses on its block and furniture capabilities.
๐ง CraftEngineManager capability table โ
| Capability | Signature | Effect |
|---|---|---|
| Build item | buildItemStack(identifier, amount) | Fetch a CraftEngine item |
| Place block | placeBlock(location, blockId, playSound) | Place a custom block at the given location, optionally playing a sound |
| Remove block | removeBlock(block) | Remove a custom block |
| Check custom block | isCustomBlock(block) | Whether this block is a CraftEngine custom block |
| Read block id | getCustomBlockId(block) | Get the id of a custom block |
| Place furniture | placeFurniture(location, furnitureId) โ entity | Place furniture, returns the furniture entity |
| Remove furniture | removeFurniture(entity) | Remove furniture |
| Check furniture | isFurniture(entity) | Whether this entity is furniture |
| Read furniture id | getFurnitureId(entity) | Get the furniture id |
๐ช Block vs furniture: CraftEngine splits "blocks you can stand on" and "decorative entities (furniture)" into two separate object types, so the placement/identification APIs are also split into two sets โ blocks use
*Block, furniture uses*Furniture.
๐งฉ CustomBlock abstraction layer โ not bound to CraftEngine โ
On top of CraftEngine, QCL adds another "custom block" abstraction layer so that upper-level logic doesn't directly depend on any specific plugin:
| Component | Role |
|---|---|
CustomBlockBridge | Aggregator: gathers all "custom block providers" |
CustomBlockProvider | Interface: id / isAvailable / isCustomBlock / getCustomBlockId / getCustomBlockAt |
CraftEngineBlockProvider | Built-in provider, id = craftengine |
CustomBlockConfig | Server-owner configuration for custom blocks (see the Custom Blocks page) |
This means: to integrate another block plugin later, you only need to implement one more CustomBlockProvider โ the upper layer is unaffected.
For how server owners configure custom blocks (drops, behaviors, etc.), see ๐ ../02-ๆไธปๆๅ/่ชๅฎไนๆนๅ.md.
๐ฏ Typical uses โ
- Programmatically place a CraftEngine block or furniture from a GUI / script.
- When listening for a player breaking a block, use
isCustomBlock+getCustomBlockIdto determine "is this one of my configured custom blocks", and decide drops accordingly.
๐ค 2. ModelEngine โ Modeled Entities / Animations / Bone-Held Items โ
| Item | Content |
|---|---|
| Bridge classes | ModelEngineBridge / Manager |
| Detection class | com.ticxo.modelengine.api.ModelEngineAPI |
ModelEngine lets an ordinary entity "wear" a 3D model and play animations. QCL wraps this capability into a more convenient API.
๐ง Bridge capability table โ
| Capability | Effect |
|---|---|
createModeledEntity(entity) | Turn an entity into a modeled entity |
removeModeledEntity(...) | Cancel modeling |
getModeledEntity(...) | Get an entity's modeled wrapper |
createActiveModel(modelId) | Create an active model instance |
๐ฆ Wrapper API โ
QCL provides two wrappers that condense the reflection calls into clean methods:
ModeledEntityWrapper (modeled-entity wrapper)
| Method | Effect |
|---|---|
addModel(...) | Add a model to the entity |
removeModel(...) | Remove a model |
setBaseEntityVisible(...) | Set whether the underlying entity is visible (commonly used to hide the vanilla body and show only the model) |
destroy() | Destroy |
getModels() | Get all current models |
ActiveModelWrapper (active-model wrapper)
| Method | Effect |
|---|---|
playAnimation(name, speed, force) | Play the specified animation |
getBones() | Get the bone list |
setHeldItem(bone, item) | Make a bone "hold" an item |
โก Manager shortcut methods โ
| Method | Effect |
|---|---|
spawnModel(entity, modelId, hideBaseEntity) | One step: spawn the model and optionally hide the underlying entity |
playAnimation(...) | Play an animation |
setHeldItem(...) | Bone-held item |
๐ The bridge provides multi-signature compatibility for these methods to cope with API differences across ModelEngine versions.
๐ฏ Typical uses โ
- Spawn a modeled Boss / NPC, hiding the underlying entity to show only the model.
- Call
playAnimationon attack/hit/death to play the matching animation. - Use
setHeldItemto make a model's bone (hand) hold a weapon item.
๐พ 3. CustomCrops โ Crop Detection / Harvesting / Planting / Growth / Bone Meal โ
| Item | Content |
|---|---|
| Bridge classes | CustomCropsBridge / Manager |
| Detection class | net.momirealms.customcrops.api.CustomCropsAPI |
CustomCrops provides a custom farming-crop system, and QCL bridges out all of its core actions.
๐ง Capability table โ
| Capability | Effect |
|---|---|
isCrop(block / location) | Whether this block/location is a crop |
getCropId(...) | Get the crop id |
tryHarvest(block, player?) | Attempt to harvest (player parameter optional) |
tryPlant(location, player, item, cropId) | Attempt to plant |
tryGrow(location, boneMeal?, multiplier?) | Attempt to force growth (optionally with bone meal and growth multiplier) |
isBoneMeal(item) | Whether this item is bone meal |
getBoneMealItem() | Get the bone meal item |
๐ฑ The
try*family of methods returns "whether it succeeded" semantics; the caller can decide follow-up logic accordingly (e.g. deduct stamina, grant experience).
๐ฏ Typical uses โ
- Custom farm gameplay: use
tryPlantin a script to plant for the player,tryHarvestfor one-click harvesting. - Item effects: an item triggers
tryGrowto ripen surrounding crops. - Use
isCrop/getCropIdto let a GUI or quest system identify the crop in front of the player.
๐งฐ Shared compatibility foundation: ReflectionBridge โ
To emphasize once more: the "multi-version, multi-signature compatibility" of every bridge above relies on the underlying:
ReflectionBridgeโisClassAvailable(className)probes whether the target class exists.ReflectionCacheโ caches method/field lookups (getMethod/findMethodByName/invoke/safeCallโฆ).
If a developer wants to reuse this reflection toolkit in their own code, see ๐ ../04-ๅผๅ่ /ๅทฅๅ ท้.md.
๐ Continue reading โ
- ๐งฑ ../02-ๆไธปๆๅ/่ชๅฎไนๆนๅ.md โ CustomBlockConfig server-owner configuration.
- ๐ง ../04-ๅผๅ่ /ๅทฅๅ ท้.md โ ReflectionBridge / ReflectionCache.
- ๐ ็ฉๅ็ฑปๆไปถ.md โ CraftEngine / other plugins' item references.
- ๐ฐ ็ปๆตๆไปถ.md โ Integration with three economy backends.