Skip to content

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 โ€‹

ItemContent
Bridge classesCraftEngineBridge / CraftEngineManager
Three object categories involvedCustom 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 โ€‹

CapabilitySignatureEffect
Build itembuildItemStack(identifier, amount)Fetch a CraftEngine item
Place blockplaceBlock(location, blockId, playSound)Place a custom block at the given location, optionally playing a sound
Remove blockremoveBlock(block)Remove a custom block
Check custom blockisCustomBlock(block)Whether this block is a CraftEngine custom block
Read block idgetCustomBlockId(block)Get the id of a custom block
Place furnitureplaceFurniture(location, furnitureId) โ†’ entityPlace furniture, returns the furniture entity
Remove furnitureremoveFurniture(entity)Remove furniture
Check furnitureisFurniture(entity)Whether this entity is furniture
Read furniture idgetFurnitureId(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:

ComponentRole
CustomBlockBridgeAggregator: gathers all "custom block providers"
CustomBlockProviderInterface: id / isAvailable / isCustomBlock / getCustomBlockId / getCustomBlockAt
CraftEngineBlockProviderBuilt-in provider, id = craftengine
CustomBlockConfigServer-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 + getCustomBlockId to determine "is this one of my configured custom blocks", and decide drops accordingly.

๐Ÿค– 2. ModelEngine โ€” Modeled Entities / Animations / Bone-Held Items โ€‹

ItemContent
Bridge classesModelEngineBridge / Manager
Detection classcom.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 โ€‹

CapabilityEffect
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)

MethodEffect
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)

MethodEffect
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 โ€‹

MethodEffect
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 playAnimation on attack/hit/death to play the matching animation.
  • Use setHeldItem to make a model's bone (hand) hold a weapon item.

๐ŸŒพ 3. CustomCrops โ€” Crop Detection / Harvesting / Planting / Growth / Bone Meal โ€‹

ItemContent
Bridge classesCustomCropsBridge / Manager
Detection classnet.momirealms.customcrops.api.CustomCropsAPI

CustomCrops provides a custom farming-crop system, and QCL bridges out all of its core actions.

๐Ÿ”ง Capability table โ€‹

CapabilityEffect
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 tryPlant in a script to plant for the player, tryHarvest for one-click harvesting.
  • Item effects: an item triggers tryGrow to ripen surrounding crops.
  • Use isCrop / getCropId to 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 โ€‹