You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 15, 2026. It is now read-only.
EmosewaPixel edited this page Nov 9, 2019
·
2 revisions
Overview
For writing shorter code, PixelLib adds a couple of operator extensions functions to commonly-used class. Since destructuring components are also counted as operator functions, they're listed here as well.
Vectors
PixelLib adds operator functions to Vec3i, Vector3f, Vector4f and Vec3d, as well as an infix function for cross products for all but Vector4f.
val vec1 =Vec3d(1.5, 2.7, -1.9)
val vec2 =Vec3d(16.1, -29.4, 9.2)
val sum = vec1 + vec2
val diff = vec1 - vec2
val product = vec1 * vec2
val q = vec1 / vec2
val cross = vec1 x vec2
val neg1 =-vec1
for ((x, _, z) inlistOf(vec1, vec2)) {
...
}
Stacks
PixelLib lets you easily create Item and Fluid Stacks adds destructure them.
val itemStack1 =Items.COAL*5val fluidStack1 =Fluids.LAVA*420val (item, countI) = itemStack1
val (fluid, countF) = fluidStack1
Resource Locations
PixelLib adds destructuring to Resource Locations and a plus operator for adding to the path. It also lets you easily convert a string into a Resource Location.
val (namespace, path) ="test:block/machine".toResLoc() +"/crusher"