model

package
v0.9.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 9, 2023 License: MIT Imports: 4 Imported by: 8

Documentation

Overview

Package model has world.BlockModel implementations for each world.Block implementation in the block package. These models may be reused by blocks that share the same model. Some block models require additional fields and knowledge about the surrounding blocks to calculate the correct model.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Anvil added in v0.7.3

type Anvil struct {
	// Facing is the direction that the anvil is facing.
	Facing cube.Direction
}

Anvil is a model used by anvils.

func (Anvil) BBox added in v0.7.3

func (a Anvil) BBox(cube.Pos, *world.World) []cube.BBox

BBox ...

func (Anvil) FaceSolid added in v0.7.3

func (Anvil) FaceSolid(cube.Pos, cube.Face, *world.World) bool

FaceSolid ...

type Cactus added in v0.7.0

type Cactus struct{}

Cactus is the model for a Cactus. It is just barely not a full block, having a slightly reduced width and depth.

func (Cactus) BBox added in v0.7.0

func (Cactus) BBox(cube.Pos, *world.World) []cube.BBox

BBox returns a physics.BBox that is slightly smaller than a full block.

func (Cactus) FaceSolid added in v0.7.0

func (Cactus) FaceSolid(cube.Pos, cube.Face, *world.World) bool

FaceSolid always returns false.

type Cake

type Cake struct {
	// Bites is the amount of bites that were taken from the cake. A cake can have up to 7 bites taken from it, before
	// being consumed entirely.
	Bites int
}

Cake is a model used by cake blocks.

func (Cake) BBox added in v0.7.0

func (c Cake) BBox(cube.Pos, *world.World) []cube.BBox

BBox returns an BBox with a size that depends on the amount of bites taken.

func (Cake) FaceSolid

func (c Cake) FaceSolid(cube.Pos, cube.Face, *world.World) bool

FaceSolid always returns false.

type Carpet

type Carpet struct{}

Carpet is a model for carpet-like extremely thin blocks.

func (Carpet) BBox added in v0.7.0

func (Carpet) BBox(cube.Pos, *world.World) []cube.BBox

BBox returns a flat BBox with a width of 0.0625.

func (Carpet) FaceSolid

func (Carpet) FaceSolid(cube.Pos, cube.Face, *world.World) bool

FaceSolid always returns false.

type Chain added in v0.5.0

type Chain struct {
	// Axis is the axis which the chain faces.
	Axis cube.Axis
}

Chain is a model used by chain blocks.

func (Chain) BBox added in v0.7.0

func (c Chain) BBox(cube.Pos, *world.World) []cube.BBox

BBox ...

func (Chain) FaceSolid added in v0.5.0

func (Chain) FaceSolid(cube.Pos, cube.Face, *world.World) bool

FaceSolid ...

type Chest

type Chest struct{}

Chest is the model of a chest. It is just barely not a full block, having a slightly reduced with on all axes.

func (Chest) BBox added in v0.7.0

func (Chest) BBox(cube.Pos, *world.World) []cube.BBox

BBox returns a physics.BBox that is slightly smaller than a full block.

func (Chest) FaceSolid

func (Chest) FaceSolid(cube.Pos, cube.Face, *world.World) bool

FaceSolid always returns false.

type CocoaBean

type CocoaBean struct {
	// Facing is the face that the cocoa bean faces. It is the opposite of the face that the CocoaBean is attached to.
	Facing cube.Direction
	// Age is the age of the CocoaBean. The age influences the size of the CocoaBean. The maximum age value of a cocoa
	// bean is 3.
	Age int
}

CocoaBean is a model used by cocoa bean blocks.

func (CocoaBean) BBox added in v0.7.0

func (c CocoaBean) BBox(cube.Pos, *world.World) []cube.BBox

BBox returns a single physics.BBox whose size depends on the age of the CocoaBean.

func (CocoaBean) FaceSolid

func (c CocoaBean) FaceSolid(cube.Pos, cube.Face, *world.World) bool

FaceSolid always returns false.

type Composter added in v0.8.2

type Composter struct {
	// Level is the level of compost inside the composter.
	Level int
}

Composter is a model used by composter blocks. It is solid on all sides apart from the top, and the height of the inside area depends on the level of compost inside the composter.

func (Composter) BBox added in v0.8.2

func (c Composter) BBox(_ cube.Pos, _ *world.World) []cube.BBox

BBox ...

func (Composter) FaceSolid added in v0.8.2

func (Composter) FaceSolid(_ cube.Pos, face cube.Face, _ *world.World) bool

FaceSolid returns true for all faces other than the top.

type DecoratedPot added in v0.9.7

type DecoratedPot struct{}

DecoratedPot is the model for a DecoratedPot. It is just barely not a full block, having a slightly reduced width and depth.

func (DecoratedPot) BBox added in v0.9.7

func (DecoratedPot) BBox(cube.Pos, *world.World) []cube.BBox

BBox returns a physics.BBox that is slightly smaller than a full block.

func (DecoratedPot) FaceSolid added in v0.9.7

func (DecoratedPot) FaceSolid(_ cube.Pos, face cube.Face, _ *world.World) bool

FaceSolid always returns true for the top and bottom face, and false for all other faces.

type Door

type Door struct {
	// Facing is the direction that the door is facing when closed.
	Facing cube.Direction
	// Open specifies if the Door is open. The direction it opens towards depends on the Right field.
	Open bool
	// Right specifies the attachment side of the door and, with that, the direction it opens in.
	Right bool
}

Door is a model used for doors. It has no solid faces and a bounding box that changes depending on the direction of the door, whether it is open, and the side of its hinge.

func (Door) BBox added in v0.7.0

func (d Door) BBox(cube.Pos, *world.World) []cube.BBox

BBox returns a physics.BBox that depends on if the Door is open, what direction it is facing and whether it is attached to the right/left side of a block.

func (Door) FaceSolid

func (d Door) FaceSolid(cube.Pos, cube.Face, *world.World) bool

FaceSolid always returns false.

type Empty

type Empty struct{}

Empty is a model that is completely empty. It has no collision boxes or solid faces.

func (Empty) BBox added in v0.7.0

func (Empty) BBox(cube.Pos, *world.World) []cube.BBox

BBox returns an empty slice.

func (Empty) FaceSolid

func (Empty) FaceSolid(cube.Pos, cube.Face, *world.World) bool

FaceSolid always returns false.

type EnchantingTable added in v0.8.0

type EnchantingTable struct{}

EnchantingTable is a model used by enchanting tables.

func (EnchantingTable) BBox added in v0.8.0

BBox ...

func (EnchantingTable) FaceSolid added in v0.8.0

func (EnchantingTable) FaceSolid(cube.Pos, cube.Face, *world.World) bool

FaceSolid ...

type Fence

type Fence struct {
	// Wood specifies if the Fence is made from wood. This field is used to check if two fences are able to attach to
	// each other.
	Wood bool
}

Fence is a model used by fences of any type. It can attach to blocks with solid faces and other fences of the same type and has a model height just slightly over 1.

func (Fence) BBox added in v0.7.0

func (f Fence) BBox(pos cube.Pos, w *world.World) []cube.BBox

BBox returns multiple physics.BBox depending on how many connections it has with the surrounding blocks.

func (Fence) FaceSolid

func (f Fence) FaceSolid(_ cube.Pos, face cube.Face, _ *world.World) bool

FaceSolid returns true if the face is cube.FaceDown or cube.FaceUp.

type FenceGate

type FenceGate struct {
	// Facing is the facing direction of the FenceGate. A fence gate can only be opened in this direction or the
	// direction opposite to it.
	Facing cube.Direction
	// Open specifies if the FenceGate is open. In this case, BBox returns an empty slice.
	Open bool
}

FenceGate is a model used by fence gates. The model is completely zero-ed when the FenceGate is opened.

func (FenceGate) BBox added in v0.7.0

func (f FenceGate) BBox(cube.Pos, *world.World) []cube.BBox

BBox returns up to one physics.BBox depending on the facing direction of the FenceGate and whether it is open.

func (FenceGate) FaceSolid

func (f FenceGate) FaceSolid(cube.Pos, cube.Face, *world.World) bool

FaceSolid always returns false.

type Grindstone added in v0.8.2

type Grindstone struct {
	// Axis is the axis the grindstone is attached to.
	Axis cube.Axis
}

Grindstone is a model used by grindstones.

func (Grindstone) BBox added in v0.8.2

func (g Grindstone) BBox(cube.Pos, *world.World) []cube.BBox

BBox ...

func (Grindstone) FaceSolid added in v0.8.2

func (g Grindstone) FaceSolid(cube.Pos, cube.Face, *world.World) bool

FaceSolid always returns false.

type Ladder added in v0.2.0

type Ladder struct {
	// Facing is the side opposite to the block the Ladder is currently attached to.
	Facing cube.Direction
}

Ladder is the model for a ladder block.

func (Ladder) BBox added in v0.7.0

func (l Ladder) BBox(cube.Pos, *world.World) []cube.BBox

BBox returns one physics.BBox that depends on the facing direction of the Ladder.

func (Ladder) FaceSolid added in v0.2.0

func (l Ladder) FaceSolid(cube.Pos, cube.Face, *world.World) bool

FaceSolid always returns false.

type Lantern

type Lantern struct {
	// Hanging specifies if the lantern is hanging from a block or if it's placed on the ground.
	Hanging bool
}

Lantern is a model for the lantern block. It can be placed on the ground or hanging from the ceiling.

func (Lantern) BBox added in v0.7.0

func (l Lantern) BBox(cube.Pos, *world.World) []cube.BBox

BBox returns a physics.BBox attached to either the ceiling or to the ground.

func (Lantern) FaceSolid

func (l Lantern) FaceSolid(cube.Pos, cube.Face, *world.World) bool

FaceSolid always returns false.

type Leaves

type Leaves struct{}

Leaves is a model for leaves-like blocks. These blocks have a full collision box, but none of their faces are solid.

func (Leaves) BBox added in v0.7.0

func (Leaves) BBox(cube.Pos, *world.World) []cube.BBox

BBox returns a physics.BBox that spans a full block.

func (Leaves) FaceSolid

func (Leaves) FaceSolid(cube.Pos, cube.Face, *world.World) bool

FaceSolid always returns false.

type Lectern added in v0.9.8

type Lectern struct{}

Lectern is a model used by lecterns.

func (Lectern) BBox added in v0.9.8

func (Lectern) BBox(cube.Pos, *world.World) []cube.BBox

BBox ...

func (Lectern) FaceSolid added in v0.9.8

func (Lectern) FaceSolid(cube.Pos, cube.Face, *world.World) bool

FaceSolid ...

type Skull added in v0.8.0

type Skull struct {
	// Direction is the direction the skull is facing.
	Direction cube.Face
	// Hanging specifies if the Skull is hanging on a wall.
	Hanging bool
}

Skull is a model used by skull blocks.

func (Skull) BBox added in v0.8.0

func (s Skull) BBox(cube.Pos, *world.World) []cube.BBox

BBox ...

func (Skull) FaceSolid added in v0.8.0

func (Skull) FaceSolid(cube.Pos, cube.Face, *world.World) bool

FaceSolid ...

type Slab

type Slab struct {
	// Double and Top specify if the Slab is a double slab and if it's in the top slot respectively. If Double is true,
	// the BBox returned is always a full block.
	Double, Top bool
}

Slab is the model of a slab-like block, which is either a half block or a full block, depending on if the slab is double.

func (Slab) BBox added in v0.7.0

func (s Slab) BBox(cube.Pos, *world.World) []cube.BBox

BBox returns either a physics.BBox spanning a full block or a half block in the top/bottom part of the block, depending on the Double and Top fields.

func (Slab) FaceSolid

func (s Slab) FaceSolid(_ cube.Pos, face cube.Face, _ *world.World) bool

FaceSolid returns true if the Slab is double, or if the face is cube.FaceUp when the Top field is true, or if the face is cube.FaceDown when the Top field is false.

type Solid

type Solid struct{}

Solid is the model of a fully solid block. Blocks with this model, such as stone or wooden planks, have a 1x1x1 collision box.

func (Solid) BBox added in v0.7.0

func (Solid) BBox(cube.Pos, *world.World) []cube.BBox

BBox returns a physics.BBox spanning a full block.

func (Solid) FaceSolid

func (Solid) FaceSolid(cube.Pos, cube.Face, *world.World) bool

FaceSolid always returns true.

type Stair

type Stair struct {
	// Facing specifies the direction that the full side of the Stair faces.
	Facing cube.Direction
	// UpsideDown turns the Stair upside-down, meaning the full side of the Stair is turned to the top side of the
	// block.
	UpsideDown bool
}

Stair is a model for stair-like blocks. These have different solid sides depending on the direction the stairs are facing, the surrounding blocks and whether it is upside down or not.

func (Stair) BBox added in v0.7.0

func (s Stair) BBox(pos cube.Pos, w *world.World) []cube.BBox

BBox returns a slice of physics.BBox depending on if the Stair is upside down and which direction it is facing. Additionally, these BBoxs depend on the Stair blocks surrounding this one, which can influence the model.

func (Stair) FaceSolid

func (s Stair) FaceSolid(pos cube.Pos, face cube.Face, w *world.World) bool

FaceSolid returns true for all faces of the Stair that are completely filled.

type Stonecutter added in v0.8.0

type Stonecutter struct{}

Stonecutter is a model used by stonecutters.

func (Stonecutter) BBox added in v0.8.0

func (Stonecutter) BBox(cube.Pos, *world.World) []cube.BBox

BBox ...

func (Stonecutter) FaceSolid added in v0.8.0

func (Stonecutter) FaceSolid(cube.Pos, cube.Face, *world.World) bool

FaceSolid ...

type Thin

type Thin struct{}

Thin is a model for thin, partial blocks such as a glass pane or an iron bar. It changes its bounding box depending on solid faces next to it.

func (Thin) BBox added in v0.7.0

func (t Thin) BBox(pos cube.Pos, w *world.World) []cube.BBox

BBox returns a slice of physics.BBox that depends on the blocks surrounding the Thin block. Thin blocks can connect to any other Thin block, wall or solid faces of other blocks.

func (Thin) FaceSolid

func (t Thin) FaceSolid(_ cube.Pos, face cube.Face, _ *world.World) bool

FaceSolid returns true if the face passed is cube.FaceDown.

type TilledGrass

type TilledGrass struct{}

TilledGrass is a model used for grass that has been tilled in some way, such as dirt paths and farmland.

func (TilledGrass) BBox added in v0.7.0

func (TilledGrass) BBox(cube.Pos, *world.World) []cube.BBox

BBox returns a physics.BBox that spans an entire block.

func (TilledGrass) FaceSolid

func (TilledGrass) FaceSolid(cube.Pos, cube.Face, *world.World) bool

FaceSolid always returns true.

type Trapdoor

type Trapdoor struct {
	// Facing is the facing direction of the Trapdoor. In addition to the texture, it influences the direction in which
	// the Trapdoor is opened.
	Facing cube.Direction
	// Open and Top specify if the Trapdoor is opened and if it's in the top or bottom part of a block respectively.
	Open, Top bool
}

Trapdoor is a model used for trapdoors. It has no solid faces and a bounding box that changes depending on the direction of the trapdoor.

func (Trapdoor) BBox added in v0.7.0

func (t Trapdoor) BBox(cube.Pos, *world.World) []cube.BBox

BBox returns a physics.BBox that depends on the facing direction of the Trapdoor and whether it is open and in the top part of the block.

func (Trapdoor) FaceSolid

func (t Trapdoor) FaceSolid(pos cube.Pos, face cube.Face, w *world.World) bool

FaceSolid returns true if the face is completely filled with the trapdoor.

type Wall added in v0.8.0

type Wall struct {
	// NorthConnection is the height of the connection for the north direction.
	NorthConnection float64
	// EastConnection is the height of the connection for the east direction.
	EastConnection float64
	// SouthConnection is the height of the connection for the south direction.
	SouthConnection float64
	// WestConnection is the height of the connection for the west direction.
	WestConnection float64
	// Post is if the wall is the full height of a block or not.
	Post bool
}

Wall is a model used by all wall types.

func (Wall) BBox added in v0.8.0

func (w Wall) BBox(cube.Pos, *world.World) []cube.BBox

BBox ...

func (Wall) FaceSolid added in v0.8.0

func (w Wall) FaceSolid(_ cube.Pos, face cube.Face, _ *world.World) bool

FaceSolid returns true if the face is in the Y axis.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL