Skip to main content

Example Script with crafts

· One min read
HollowHorizon
Developer of HE and HC
Examples
CraftingTable.replaceShaped(item("minecraft:diamond_pickaxe", 4)) {
grid( //crafting grid
"xxx",
" y ",
" y "
)

where { //items
'x' - item("minecraft:diamond_block") //if you need a tag, not a subject, then you write tag("...")
'y' - item("minecraft:cobblestone")
}

extra["stage"] = "expert" // temporarily
}

Furnace.addRecipe(item("minecraft:dirt"), item("minecraft:diamond"))

Furnace.addRecipe(item("minecraft:diamond"), item("minecraft:dirt"))

index

· 0 min read

Example Script with Animations

· 2 min read
HollowHorizon
Developer of HE and HC
AlgorithmLX
Docs developer and contributor

Script of going npc and starting animation

import net.minecraft.core.BlockPos
import ru.hollowhorizon.hc.client.gltf.animations.PlayType
import ru.hollowhorizon.hollowengine.common.npcs.IHollowNPC

team.sendMessage("Hello World! ${this.world.level}")

//Creating a new NPC
val npc: IHollowNPC = makeNPC(
NPCSettings("Виталик"),
this.world.level, //Level, where a script has been started
BlockPos(-88, 71, 154) //Random pos with player
)

team.sendMessage("[debug] NPC created")

//New task, go to the nearest player in the team
npc.makeTask {
movement.go(team).await() //await() it means that the code will not go further until the npc reaches the goal
}

npc say "Hi :)"

npc.makeTask {
movement.go(2, -60, 1).await() //await() it means that the code will not go further until the npc reaches the goal
}

npc say "Ha, I can animate"

npc.play("animation.npcsteve.happy", playType = PlayType.LOOPED)

wait(1.5f)

npc stop "animation.npcsteve.happy"

npc say "Well, that's it, bye!"

//New challenge, avoid all players in the team
npc.makeTask {
movement.avoid(team)
.async() //async() means that the task will be executed asynchronously (the code will continue to go further, even if the goal is not reached)
}
wait(10f)