mapping

package
v0.0.0-...-1cf8517 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block interface {
	// StateToRuntimeID converts a block state to a runtime ID.
	StateToRuntimeID(blockupgrader.BlockState) (uint32, bool)
	// RuntimeIDToState converts a runtime ID to a name and its state properties.
	RuntimeIDToState(uint32) (blockupgrader.BlockState, bool)
	// DowngradeBlockActorData downgrades the input sub chunk to a legacy block actor.
	DowngradeBlockActorData(map[string]any)
	// UpgradeBlockActorData upgrades the input sub chunk to the latest block actor.
	UpgradeBlockActorData(map[string]any)
	// Adjust adjusts the latest mappings to account for custom states.
	Adjust([]protocol.BlockEntry)
	Air() uint32
}

type DefaultBlockMapping

type DefaultBlockMapping struct {
	// contains filtered or unexported fields
}

func NewBlockMapping

func NewBlockMapping(raw []byte) *DefaultBlockMapping

func (*DefaultBlockMapping) Adjust

func (m *DefaultBlockMapping) Adjust(entries []protocol.BlockEntry)

func (*DefaultBlockMapping) Air

func (m *DefaultBlockMapping) Air() uint32

func (*DefaultBlockMapping) DowngradeBlockActorData

func (m *DefaultBlockMapping) DowngradeBlockActorData(actorData map[string]any)

func (*DefaultBlockMapping) RuntimeIDToState

func (m *DefaultBlockMapping) RuntimeIDToState(runtimeId uint32) (blockupgrader.BlockState, bool)

func (*DefaultBlockMapping) StateToRuntimeID

func (m *DefaultBlockMapping) StateToRuntimeID(state blockupgrader.BlockState) (uint32, bool)

func (*DefaultBlockMapping) UpgradeBlockActorData

func (m *DefaultBlockMapping) UpgradeBlockActorData(actorData map[string]any)

func (*DefaultBlockMapping) WithBlockActorRemapper

func (m *DefaultBlockMapping) WithBlockActorRemapper(downgrader, upgrader func(map[string]any) map[string]any) *DefaultBlockMapping

type DefaultItemMapping

type DefaultItemMapping struct {
	// contains filtered or unexported fields
}

func NewItemMapping

func NewItemMapping(raw []byte) *DefaultItemMapping

func (*DefaultItemMapping) Air

func (m *DefaultItemMapping) Air() int32

func (*DefaultItemMapping) ItemNameToRuntimeID

func (m *DefaultItemMapping) ItemNameToRuntimeID(itemMeta itemupgrader.ItemMeta) (runtimeID int32, found bool)

func (*DefaultItemMapping) ItemRuntimeIDToName

func (m *DefaultItemMapping) ItemRuntimeIDToName(runtimeID int32) (itemMeta itemupgrader.ItemMeta, found bool)

func (*DefaultItemMapping) RegisterEntry

func (m *DefaultItemMapping) RegisterEntry(name string) int32

type Item

type Item interface {
	// ItemRuntimeIDToName converts an item runtime ID to a string ID.
	ItemRuntimeIDToName(int32) (itemupgrader.ItemMeta, bool)
	// ItemNameToRuntimeID converts a string ID to an item runtime ID.
	ItemNameToRuntimeID(itemupgrader.ItemMeta) (int32, bool)
	RegisterEntry(string) int32
	Air() int32
}

Jump to

Keyboard shortcuts

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