Liking cljdoc? Tell your friends :D

lambdaisland.witchcraft

Clojure API for Minecraft/Bukkit

Clojure API for Minecraft/Bukkit
raw docstring

lambdaisland.witchcraft.adventure.text

Support for parts of the Text sublibary of the Adventure UI library. Adding this out of necessity since Paper has now integrated Adventure directly.

https://docs.adventure.kyori.net/text.html

Support for parts of the Text sublibary of the Adventure UI library. Adding
this out of necessity since Paper has now integrated Adventure directly.

https://docs.adventure.kyori.net/text.html
raw docstring

lambdaisland.witchcraft.citizens.trait

Make it easier to make Trait implementation

To implement a Trait in Citizens you subclass the Trait class, and then register the subclass with the TraitFactory. This means you need an actual concrete class, so [[proxy]] doens't cut it.

You can bypass the TraitFactory and addTrait to an NPC directly, but then your traits won't survive a server restart. Citizens persists which traits a given NPC has and restores them on boot, for this to work we have to go through the Factory.

Note that for this to work the code that defines your traits needs to be loaded before Citizens restores its state. Adding them in init namespaces that you declare in your witchcraft.edn plugin config should do the trick.

To make this work we gen-class a concrete subclass, but instead of writing it out to we just compile and load it in memory (DynamicClassLoader for the win!). The class itself is just a dummy stub that delegates method calls to callbacks from a registry (a simple atom), so they are easy to redefine. You can even use a var directly as a callback, so re-evaluating the defn is immediately reflected.

Make it easier to make Trait implementation

To implement a Trait in Citizens you subclass the Trait class, and then
register the subclass with the TraitFactory. This means you need an actual
concrete class, so [[proxy]] doens't cut it.

You can bypass the TraitFactory and `addTrait` to an NPC directly, but then
your traits won't survive a server restart. Citizens persists which traits a
given NPC has and restores them on boot, for this to work we have to go
through the Factory.

Note that for this to work the code that defines your traits needs to be
loaded before Citizens restores its state. Adding them in `init` namespaces
that you declare in your `witchcraft.edn` plugin config should do the trick.

To make this work we `gen-class` a concrete subclass, but instead of writing
it out to we just compile and load it in memory (DynamicClassLoader for the
win!). The class itself is just a dummy stub that delegates method calls to
callbacks from a registry (a simple atom), so they are easy to redefine. You
can even use a var directly as a callback, so re-evaluating the `defn` is
immediately reflected.
raw docstring

lambdaisland.witchcraft.classpath-hacks

We do some classpath scanning stuff both in lambdaisland.witchcraft.reflect (which much of the interop is based on), and in [[lambdaisland.witchcraft.event]] (to find out which events are supported by the running system)

We do some classpath scanning stuff both
in [[lambdaisland.witchcraft.reflect]] (which much of the interop is based
on), and in [[lambdaisland.witchcraft.event]] (to find out which events are
supported by the running system)
raw docstring

lambdaisland.witchcraft.cursor

Logo-like API for drawing blocks by using a walking metaphor.

This is a functional API, movements simply build up a list of block positions, call build! at the end to actually make them materialize in the game.

A cursor contains a current location (x/y/z), a directions (:north, :north-east, :east, etc.), and a current building material, e.g :lapis-block (see lambdaisland.witchcraft/materials).

It also contains a drawing flag :draw? and a list of blocks :blocks. When drawing is on, then any step will add a block to the list. build! creates blocks in the world based on this, and resets the list.

Call start to get an initial cursor, this will return a cursor that is one step ahead of the player (so what you draw is in sight), facing away from the player.

(require '[lambdaisland.witchcraft.cursor :as c])

(-> (c/start)
    (c/draw)
    (c/material :red-glazed-terracotta)
    (c/steps 3)
    (c/rotate 2)
    (c/material :blue-glazed-terracotta)
    (c/steps 3)
    (c/rotate 2)
    (c/material :green-glazed-terracotta)
    (c/steps 3)
    (c/rotate 2)
    (c/material :yellow-glazed-terracotta)
    (c/steps 3)
    (c/build)
    )
Logo-like API for drawing blocks by using a walking metaphor.

This is a functional API, movements simply build up a list of block positions,
call [[build!]] at the end to actually make them materialize in the game.

A cursor contains a current location (x/y/z), a
directions (:north, :north-east, :east, etc.), and a current building
material, e.g :lapis-block (see [[lambdaisland.witchcraft/materials]]).

It also contains a drawing flag `:draw?` and a list of blocks `:blocks`. When
drawing is on, then any step will add a block to the list. [[build!]] creates
blocks in the world based on this, and resets the list.

Call [[start]] to get an initial cursor, this will return a cursor that is one
step ahead of the player (so what you draw is in sight), facing away from the
player.

```
(require '[lambdaisland.witchcraft.cursor :as c])

(-> (c/start)
    (c/draw)
    (c/material :red-glazed-terracotta)
    (c/steps 3)
    (c/rotate 2)
    (c/material :blue-glazed-terracotta)
    (c/steps 3)
    (c/rotate 2)
    (c/material :green-glazed-terracotta)
    (c/steps 3)
    (c/rotate 2)
    (c/material :yellow-glazed-terracotta)
    (c/steps 3)
    (c/build)
    )
```
raw docstring

lambdaisland.witchcraft.fill

Fill algorithms, find areas of touching blocks based on a predicate.

Fill algorithms, find areas of touching blocks based on a predicate.
raw docstring

lambdaisland.witchcraft.gallery.big-chicken

A 9 block high chicken shape

A 9 block high chicken shape
raw docstring

lambdaisland.witchcraft.gallery.carrier-trait

A trait for NPCs that are able to carry stuff around for you. Right click to open their inventory and put stuff in it.

A trait for NPCs that are able to carry stuff around for you. Right click to
open their inventory and put stuff in it.
raw docstring

lambdaisland.witchcraft.gallery.megachop9000

A magical dwarven axe which chops down a full tree trunk with one chop.

A magical dwarven axe which chops down a full tree trunk with one chop.
raw docstring

lambdaisland.witchcraft.gallery.mob-spawner

'Classic' mob-spawner, plus a varient with multiple levels. For best results put it really high up in the sky, or above the open ocean. There should be little to no other places nearby (like caves beneath you) where mobs could spawn.

'Classic' mob-spawner, plus a varient with multiple levels. For best results
put it really high up in the sky, or above the open ocean. There should be
little to no other places nearby (like caves beneath you) where mobs could
spawn.
raw docstring

lambdaisland.witchcraft.gallery.ocean-space-base

A futuristic base consisting of a big torus suspending by three pointy towers.

A futuristic base consisting of a big torus suspending by three pointy towers.
raw docstring

lambdaisland.witchcraft.gallery.private-chests

Implementation of private chests with shop capabilities

Start by naming a chest @username, only that user will be able to break the chest or interact with its inventory.

You can add items in the chest that form a price list, e.g name the item "16 Golden Carrots : 3 Diamonds" and put it in the chest. Now when someone clicks on a stack of golden carrots in the chest, it will exchage the golden carrots and diamonds between the two inventories.

Current shortcomings:

  • It's very easy to slightly (or deliberately) misspell the username, causing unbreakable chests
  • Placing a chest left of a single chest will merge them and override the name, to be safe always put double chests
  • Make it possible to use the display name of renamed items in the price list
Implementation of private chests with shop capabilities

Start by naming a chest @username, only that user will be able to break the
chest or interact with its inventory.

You can add items in the chest that form a price list, e.g name the item "16
Golden Carrots : 3 Diamonds" and put it in the chest. Now when someone clicks
on a stack of golden carrots in the chest, it will exchage the golden carrots
and diamonds between the two inventories.

Current shortcomings:
- It's very easy to slightly (or deliberately) misspell the username, causing
  unbreakable chests
- Placing a chest left of a single chest will merge them and override the
  name, to be safe always put double chests
- Make it possible to use the display name of renamed items in the price list
raw docstring

lambdaisland.witchcraft.gallery.squid-casa-events

Event handlers that hook up two buttons to beam the player from one to the other.

Event handlers that hook up two buttons to beam the player from one to the
other.
raw docstring

No vars found in this namespace.

lambdaisland.witchcraft.glowstone

Glowstone specific code, in particular server start/stop logic. Kept separate to allow using the Witchcraft API in non-Glowstone Bukkit-compatible servers.

Glowstone specific code, in particular server start/stop logic. Kept separate
to allow using the Witchcraft API in non-Glowstone Bukkit-compatible servers.
raw docstring

lambdaisland.witchcraft.glowstone.config

Create and handle Glowstone ServerConfig instances

Generally to configure Glowstone you edit YAML files, but that's not very Clojure-y. This config munging below allows you to define config values as inline EDN. The values in the config map that you provide to data-config or server-config are keywords derived from the ServerConfig$Key enum, see (keys config-keys)

Create and handle Glowstone ServerConfig instances

Generally to configure Glowstone you edit YAML files, but that's not very
Clojure-y. This config munging below allows you to define config values as
inline EDN. The values in the config map that you provide to [[data-config]]
or [[server-config]] are keywords derived from the `ServerConfig$Key` enum,
see `(keys config-keys)`
raw docstring

lambdaisland.witchcraft.glowstone.worlds

Generate new worlds based on simple xyz->material functions

Quite naive, more a proof of concept.

Generate new worlds based on simple xyz->material functions

Quite naive, more a proof of concept.
raw docstring

lambdaisland.witchcraft.markup

Adding color and text effects to chat messages and titles via hiccup-like Markup

Adding color and text effects to chat messages and titles via hiccup-like
Markup
raw docstring

lambdaisland.witchcraft.matrix

Vector/Matrix math

A vector in this context can be anything that implements [[lambdaisland.witchcraft/with-xyz]]: a Clojure vector ([x y z]), a Clojure map ({:x .. :y .. :z ..}), or a Glowstone Location or Vector. You get the type back that you put in.

A matrix is a vector of vectors (regular Clojure vectors) and can be 3x3 (linear) or 4x4 (affine/homogenous).

This code is not optimized for speed, it is fine for generating and manipulating minecraft structures, not for heavy number crunching.

Vector/Matrix math

A vector in this context can be anything that
implements [[lambdaisland.witchcraft/with-xyz]]: a Clojure vector (`[x y z]`),
a Clojure map (`{:x .. :y .. :z ..}`), or a Glowstone `Location` or `Vector`.
You get the type back that you put in.

A matrix is a vector of vectors (regular Clojure vectors) and can be
3x3 (linear) or 4x4 (affine/homogenous).

This code is not optimized for speed, it is fine for generating and
manipulating minecraft structures, not for heavy number crunching.

raw docstring

lambdaisland.witchcraft.nrepl.task-eval

Schedule all nREPL eval operations on the server thread.

This way you don't have to wrap a lot of operations in a [[wc/run-task]].

Schedule all nREPL eval operations on the server thread.

This way you don't have to wrap a lot of operations in a [[wc/run-task]].
raw docstring

lambdaisland.witchcraft.palette

Utilities for constructing block palettes and working with texture colors.

Utilities for constructing block palettes and working with texture colors.
raw docstring

lambdaisland.witchcraft.paper

Start an embedded Paper server, and paper-specific extensions.

To use this you need to download Paper yourself, and start Clojure/JVM with the right args.

deps.edn:

:aliases {
:cider/nrepl
{:extra-deps
 {nrepl/nrepl                   {:mvn/version "0.8.3"}
  refactor-nrepl/refactor-nrepl {:mvn/version "2.5.1"}
  cider/cider-nrepl             {:mvn/version "0.26.0"}}}

:papermc
{:extra-deps {io.papermc/paper {:local/root "/home/arne/Downloads/paper-1.17.1-157.jar"}}
 :main-opts ["-m" "paper-witch"]}}
}

Command line:

clj -J-Dcom.mojang.eula.agree=true -J-javaagent:/home/arne/Downloads/paper-1.17.1-157.jar -A:cider/nrepl -M:papermc
Start an embedded Paper server, and paper-specific extensions.

To use this you need to download Paper yourself, and start Clojure/JVM with the right args.

deps.edn:
```
:aliases {
:cider/nrepl
{:extra-deps
 {nrepl/nrepl                   {:mvn/version "0.8.3"}
  refactor-nrepl/refactor-nrepl {:mvn/version "2.5.1"}
  cider/cider-nrepl             {:mvn/version "0.26.0"}}}

:papermc
{:extra-deps {io.papermc/paper {:local/root "/home/arne/Downloads/paper-1.17.1-157.jar"}}
 :main-opts ["-m" "paper-witch"]}}
}
```

Command line:
```
clj -J-Dcom.mojang.eula.agree=true -J-javaagent:/home/arne/Downloads/paper-1.17.1-157.jar -A:cider/nrepl -M:papermc
```
raw docstring

lambdaisland.witchcraft.shapes

Functions that create common shapes, like a box, ball, torus, tube, etc.

Functions that create common shapes, like a box, ball, torus, tube, etc.
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close