bp

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadAnimation

func LoadAnimation(src string) (*bp.Animation, error)

func LoadAnimationController

func LoadAnimationController(src string) (*bp.AnimationControllerFile, error)

func LoadBlock

func LoadBlock(src string) (bp.Block, error)

Load loads block

Example:

block, err := bp.LoadBlock("./bp/block/block.json")

func LoadEntity

func LoadEntity(src string) (*bp.Entity, error)

Load an entity file from the given path

Example:

entity, err := bp.LoadEntity(filepath.Join("packs", "BP", "entity", "zombie.json")

func LoadItem

func LoadItem(src string) (bp.Item, error)

Load an item file from the given path

Example:

item, err := bp.LoadItem(filepath.Join("packs", "BP", "item", "sword.json")

func LoadLootTable

func LoadLootTable(src string) (bp.LootTable, error)

func LoadRecipe

func LoadRecipe(src string) (bp.RecipeInterface, error)

Load an recipe file from the given path

Example:

recipe, err := bp.LoadRecipe(filepath.Join("packs", "BP", "recipe", "sword.json")

Types

type AnimationBP

type AnimationBP map[string]*AnimationFile

func (*AnimationBP) Add

func (m *AnimationBP) Add(key string, value *bp.Animation)

func (*AnimationBP) All

func (m *AnimationBP) All() map[string]*AnimationFile

func (*AnimationBP) Clear

func (m *AnimationBP) Clear()

func (*AnimationBP) Get

func (m *AnimationBP) Get(key string) (*bp.Animation, bool)

func (*AnimationBP) GetFile

func (m *AnimationBP) GetFile(key string) (*AnimationFile, bool)

func (*AnimationBP) IsEmpty

func (m *AnimationBP) IsEmpty() bool

func (*AnimationBP) Load

func (m *AnimationBP) Load(path string, add ...bool) (*AnimationFile, error)

func (*AnimationBP) LoadAll

func (m *AnimationBP) LoadAll(pathToBP string) error

func (*AnimationBP) New

func (m *AnimationBP) New(dest string) *bp.Animation

func (*AnimationBP) Remove

func (m *AnimationBP) Remove(key string)

func (*AnimationBP) Save

func (m *AnimationBP) Save(pathToBP string) error

func (*AnimationBP) Size

func (m *AnimationBP) Size() int

func (*AnimationBP) UnmarshalJSON

func (m *AnimationBP) UnmarshalJSON(data []byte) error

type AnimationControllerBP

type AnimationControllerBP map[string]*AnimationControllerFile

func (*AnimationControllerBP) Add

func (*AnimationControllerBP) All

func (*AnimationControllerBP) Clear

func (m *AnimationControllerBP) Clear()

func (*AnimationControllerBP) Get

func (*AnimationControllerBP) GetFile

func (*AnimationControllerBP) IsEmpty

func (m *AnimationControllerBP) IsEmpty() bool

func (*AnimationControllerBP) Load

func (*AnimationControllerBP) LoadAll

func (m *AnimationControllerBP) LoadAll(pathToBP string) error

func (*AnimationControllerBP) New

func (*AnimationControllerBP) Remove

func (m *AnimationControllerBP) Remove(key string)

func (*AnimationControllerBP) Save

func (m *AnimationControllerBP) Save(pathToBP string) error

func (*AnimationControllerBP) Size

func (m *AnimationControllerBP) Size() int

func (*AnimationControllerBP) UnmarshalJSON

func (m *AnimationControllerBP) UnmarshalJSON(data []byte) error

type AnimationControllerFile

type AnimationControllerFile struct {
	Data *bp.AnimationControllerFile
}

func NewAnimationController

func NewAnimationController(dest string) *AnimationControllerFile

Create a new animation controller file

Example:

animation_controller := bp.NewAnimationController("vanilla/player.animation.controller.json")

func (*AnimationControllerFile) Encode

func (e *AnimationControllerFile) Encode() ([]byte, error)

func (*AnimationControllerFile) GetAnimations

func (e *AnimationControllerFile) GetAnimations() []string

Returns all animations that exist in the animation controller file.

Example:

animations := e.GetAnimations() // []string{"controller.animation.player.move", "controller.animation.player.idle"}

func (*AnimationControllerFile) GetAnimationsAsMap

func (e *AnimationControllerFile) GetAnimationsAsMap() map[string]string

Returns all animations that exist in the animation file as a map. The key is the animation name, but the "controller.animation." prefix is replaced with "controller.".

Example:

animations := e.GetAnimationsAsMap() // map[string]string{"controller.player.move": "animation.player.move", "controller.player.idle": "animation.player.idle"}

type AnimationFile

type AnimationFile struct {
	Data *bp.Animation

	// Other stuff
	Subdir string
}

func (*AnimationFile) Encode

func (e *AnimationFile) Encode() ([]byte, error)

func (*AnimationFile) GetAnimations

func (e *AnimationFile) GetAnimations() []string

Returns all animations that exist in the animation file.

Example:

animations := e.GetAnimations() // []string{"animation.player.move", "animation.player.idle"}

func (*AnimationFile) GetAnimationsAsMap

func (e *AnimationFile) GetAnimationsAsMap() map[string]string

Returns all animations that exist in the animation file as a map. The key is the animation name without "animation." prefix.

Example:

animations := e.GetAnimationsAsMap() // map[string]string{"player.move": "animation.player.move", "player.idle": "animation.player.idle"}

type BlockBP

type BlockBP map[string]*BlockFile

func (*BlockBP) Add

func (e *BlockBP) Add(key string, value bp.Block)

func (*BlockBP) All

func (e *BlockBP) All() map[string]*BlockFile

func (*BlockBP) Clear

func (e *BlockBP) Clear()

func (*BlockBP) Get

func (e *BlockBP) Get(key string) (bp.Block, bool)

func (*BlockBP) GetFile

func (e *BlockBP) GetFile(key string) (*BlockFile, bool)

func (*BlockBP) IsEmpty

func (e *BlockBP) IsEmpty() bool

func (*BlockBP) Load

func (e *BlockBP) Load(src string, add ...bool) (*BlockFile, error)

func (*BlockBP) LoadAll

func (e *BlockBP) LoadAll(pathToBP string) error

func (*BlockBP) New

func (e *BlockBP) New(identifier string, option ...struct {
	Subdir string
	Lang   string
},
) bp.Block

func (*BlockBP) Remove

func (e *BlockBP) Remove(key string)

func (*BlockBP) Save

func (e *BlockBP) Save(pathToBP string) error

func (*BlockBP) Size

func (e *BlockBP) Size() int

func (*BlockBP) UnmarshalJSON

func (e *BlockBP) UnmarshalJSON(data []byte) error

type BlockFile

type BlockFile struct {
	Data bp.Block

	// Other stuff
	Subdir   string
	Lang     string
	Filename string
}

func NewBlock

func NewBlock(identifier string) *BlockFile

Create a new block file

Example:

block := bp.NewBlock("glostone:diamond_sword")

func (*BlockFile) Encode

func (e *BlockFile) Encode() ([]byte, error)

Encode returns []byte of the block.

Example:

block, err := e.Encode()

func (*BlockFile) GetFilename

func (e *BlockFile) GetFilename() string

func (*BlockFile) GetIdentifier

func (e *BlockFile) GetIdentifier() string

GetIdentifier returns the identifier of the entity without namespace

Example:

identifier := e.GetIdentifier()

func (*BlockFile) GetNamespaceIdentifier

func (e *BlockFile) GetNamespaceIdentifier() string

GetNamespaceIdentifier returns the identifier of the entity with namespace

Example:

identifier := e.GetNamespaceIdentifier()

type EntityBP

type EntityBP map[string]*EntityFile

func (*EntityBP) Add

func (e *EntityBP) Add(key string, value *bp.Entity)

func (*EntityBP) All

func (e *EntityBP) All() map[string]*EntityFile

func (*EntityBP) Clear

func (e *EntityBP) Clear()

func (*EntityBP) Get

func (e *EntityBP) Get(key string) (*bp.Entity, bool)

func (*EntityBP) GetFile

func (e *EntityBP) GetFile(key string) (*EntityFile, bool)

func (*EntityBP) IsEmpty

func (e *EntityBP) IsEmpty() bool

func (*EntityBP) Load

func (e *EntityBP) Load(src string, add ...bool) (*EntityFile, error)

func (*EntityBP) LoadAll

func (e *EntityBP) LoadAll(pathToBP string) error

func (*EntityBP) New

func (e *EntityBP) New(identifier string) *bp.Entity

func (*EntityBP) Remove

func (e *EntityBP) Remove(key string)

func (*EntityBP) Save

func (e *EntityBP) Save(pathToBP string) error

func (*EntityBP) Size

func (e *EntityBP) Size() int

func (*EntityBP) UnmarshalJSON

func (e *EntityBP) UnmarshalJSON(data []byte) error

type EntityFile

type EntityFile struct {
	Data *bp.Entity

	// Other stuff
	Subdir   string
	Filename string
}

func NewEntity

func NewEntity(identifier string) *EntityFile

Create a new entity file

Example:

entity := bp.NewEntity("glostone:diamond_sword")

func (*EntityFile) Encode

func (e *EntityFile) Encode() ([]byte, error)

Encode returns []byte of the entity.

Example:

entity, err := e.Encode()

func (*EntityFile) GetFilename

func (e *EntityFile) GetFilename() string

func (*EntityFile) GetIdentifier

func (e *EntityFile) GetIdentifier() string

GetIdentifier returns the identifier of the entity without namespace

Example:

identifier := e.GetIdentifier()

func (*EntityFile) GetNamespaceIdentifier

func (e *EntityFile) GetNamespaceIdentifier() string

GetNamespaceIdentifier returns the identifier of the entity with namespace

Example:

identifier := e.GetNamespaceIdentifier()

type GlowstoneBP

type GlowstoneBP struct {
	// Path to the project.
	Path string

	// Contains all animation controllers in the project.
	AnimationController IAnimationControllerBP

	// Contains all animations in the project.
	Animation IAnimationBP

	// Contains all blocks in the project.
	Block IBlockBP

	// Contains all entities in the project.
	Entity IEntityBP

	// Contains all items in the project.
	Item IItemBP

	// Contains all loot tables in the project.
	LootTable ILootTable

	// Contains all recipes in the project.
	Recipe IRecipeBP

	// Manifest of the behavior pack.
	Manifest *Manifest
}

func New

func New(path string) *GlowstoneBP

func (*GlowstoneBP) Initialize

func (g *GlowstoneBP) Initialize() error

func (*GlowstoneBP) Preload

func (g *GlowstoneBP) Preload() error

Preload loads all files from the project.

func (*GlowstoneBP) Save

func (g *GlowstoneBP) Save() error

Apply and save changes to the project.

type IAnimationBP

type IAnimationBP interface {
	Add(string, *bp.Animation)

	// Get returns the Animation of the given path.
	//
	// Example:
	//
	//  animation, ok := project.BP.Animation.Get("player.animation.json")
	Get(string) (*bp.Animation, bool)

	// GetFile returns the AnimationFile of the given path.
	//
	// Example:
	//
	//  animation, ok := project.BP.Animation.GetFile("player.animation.json")
	GetFile(string) (*AnimationFile, bool)

	// Remove removes the Animation of the given path.
	//
	// Example:
	//
	//  project.BP.Animation.Remove("player.animation.json")
	Remove(string)
	Clear()

	// All returns all Animations.
	//
	// Example:
	//
	//  animations := project.BP.Animation.All()
	All() map[string]*AnimationFile
	IsEmpty() bool
	Size() int
	UnmarshalJSON([]byte) error

	// New creates a new BPAnimation. Dest doesn't need to start with "animation/"
	//
	// Example:
	//
	//	a := New("player.animation.json")
	//	b := New("player/effect.animation.json")
	New(string) *bp.Animation

	Save(string) error

	LoadAll(string) error

	// Load a single animation file.
	//
	// Last parameter is whether the file should be added to the project.
	//
	// Default is true.
	//
	// Example:
	//
	//	animation, err := project.BP.Animation.Load(filepath.Join(project.BP.Path, "animations", "player.animation.json"))
	Load(string, ...bool) (*AnimationFile, error)
}

type IAnimationControllerBP

type IAnimationControllerBP interface {
	Add(string, *bp.AnimationControllerFile)

	// Get returns the AnimationController of the given path.
	//
	// Example:
	//
	//  animation_controller, ok := project.BP.AnimationController.Get("player.animation_controller.json")
	Get(string) (*bp.AnimationControllerFile, bool)

	// GetFile returns the AnimationControllerFile of the given path.
	//
	// Example:
	//
	//  animation_controller, ok := project.BP.AnimationController.GetFile("player.animation_controller.json")
	GetFile(string) (*AnimationControllerFile, bool)

	// Remove removes the AnimationController of the given path.
	//
	// Example:
	//
	//  project.BP.AnimationController.Remove("player.animation_controller.json")
	Remove(string)
	Clear()

	// All returns all AnimationControllers.
	//
	// Example:
	//
	//  animation_controllers := project.BP.AnimationController.All()
	All() map[string]*AnimationControllerFile
	IsEmpty() bool
	Size() int
	UnmarshalJSON([]byte) error

	// New creates a new BPAnimationController. Dest doesn't need to start with "animation_controllers/"
	//
	// Example:
	//
	//	a := New("player.animation_controller.json")
	//	b := New("player/effect.animation_controller.json")
	New(string) *bp.AnimationControllerFile

	Save(string) error

	LoadAll(string) error

	// Load a single animation_controller file, without subdir and filename.
	//
	// Last parameter is whether the file should be added to the project.
	//
	// Default is true.
	//
	// Example:
	//
	//	animation_controller, err := project.BP.AnimationController.Load(filepath.Join(project.BP.Path, "animation_controllers", "player.animation_controller.json"))
	Load(string, ...bool) (*AnimationControllerFile, error)
}

type IBlockBP

type IBlockBP interface {
	Add(string, bp.Block)

	// Get returns the Block of the given identifier.
	//
	// Example:
	//
	//  block, ok := project.BP.Block.Get("glowstone:chair")
	Get(string) (bp.Block, bool)

	// GetFile returns the BlockFile of the given identifier.
	//
	// Example:
	//
	//  block, ok := project.BP.Block.GetFile("glowstone:chair")
	GetFile(string) (*BlockFile, bool)

	// Remove removes the Block of the given identifier.
	//
	// Example:
	//
	//  project.BP.Block.Remove("glowstone:chair")
	Remove(string)
	Clear()

	// All returns all Blocks.
	//
	// Example:
	//
	//  blocks := project.BP.Block.All()
	All() map[string]*BlockFile
	IsEmpty() bool
	Size() int
	UnmarshalJSON([]byte) error

	// New creates a new BPBlock.
	//
	// Example:
	//
	//	a := New("glowstone:chair")
	//	b := New("glowstone:table")
	New(string, ...struct {
		Subdir string
		Lang   string
	}) bp.Block

	Save(string) error

	LoadAll(string) error

	// Load a single block file.
	//
	// Last parameter is whether the file should be added to the project.
	//
	// Default is true.
	//
	// Example:
	//
	//	block, err := project.BP.block.Load(filepath.Join(project.BP.Path, "blocks", "glowstone.json"))
	Load(string, ...bool) (*BlockFile, error)
}

type IEntityBP

type IEntityBP interface {
	Add(string, *bp.Entity)

	// Get returns the Entity of the given identifier.
	//
	// Example:
	//
	//  entity, ok := project.BP.Entity.Get("glowstone:chair")
	Get(string) (*bp.Entity, bool)

	// GetFile returns the EntityFile of the given identifier.
	//
	// Example:
	//
	//  entity, ok := project.BP.Entity.GetFile("glowstone:chair")
	GetFile(string) (*EntityFile, bool)

	// Remove removes the Entity of the given identifier.
	//
	// Example:
	//
	//  project.BP.Entity.Remove("glowstone:chair")
	Remove(string)
	Clear()

	// All returns all Entities.
	//
	// Example:
	//
	//  entitys := project.BP.Entity.All()
	All() map[string]*EntityFile
	IsEmpty() bool
	Size() int
	UnmarshalJSON([]byte) error

	// New creates a new BPEntity.
	//
	// Example:
	//
	//	a := New("glowstone:chair")
	//	b := New("glowstone:table")
	New(string) *bp.Entity

	// Save saves all BPEntity to the given path.
	//
	// Example:
	//
	//	project := glowstone.NewProject()
	// 	entities := project.BP.Entity
	// 	entities.New("glowstone:chair")
	// 	entities.New("glowstone:table")
	// 	entities.Save(path.Join("packs", "BP"))
	Save(string) error

	LoadAll(string) error

	// Load a single entity file.
	//
	// Last parameter is whether the file should be added to the project.
	//
	// Default is true.
	//
	// Example:
	//
	//	entity, err := project.BP.Entity.Load(filepath.Join(project.BP.Path, "entities", "player.json"))
	Load(string, ...bool) (*EntityFile, error)
}

type IItemBP

type IItemBP interface {
	Add(string, bp.Item)

	// Get returns the Item of the given identifier.
	//
	// Example:
	//
	//  item, ok := project.BP.Item.Get("glowstone:chair")
	Get(string) (bp.Item, bool)

	// GetFile returns the ItemFile of the given identifier.
	//
	// Example:
	//
	//  item, ok := project.BP.Item.GetFile("glowstone:chair")
	GetFile(string) (*ItemFile, bool)

	// Remove removes the Item of the given identifier.
	//
	// Example:
	//
	//  project.BP.Item.Remove("glowstone:chair")
	Remove(string)
	Clear()

	// All returns all Items.
	//
	// Example:
	//
	//  items := project.BP.Item.All()
	All() map[string]*ItemFile
	IsEmpty() bool
	Size() int
	UnmarshalJSON([]byte) error

	// New creates a new BPItem.
	//
	// Example:
	//
	//	a := New("glowstone:chair")
	//	b := New("glowstone:table")
	New(string) bp.Item

	Save(string) error

	LoadAll(string) error

	// Load a single item file.
	//
	// Last parameter is whether the file should be added to the project.
	//
	// Default is true.
	//
	// Example:
	//
	//	item, err := project.BP.Item.Load(filepath.Join(project.BP.Path, "items", "apple.json"))
	Load(string, ...bool) (*ItemFile, error)
}

type ILootTable

type ILootTable interface {
	Add(string, bp.LootTable)

	// Get returns the LootTable of the given path.
	//
	// Example:
	//
	//  loot_table, ok := project.BP.LootTable.Get("vanilla/player.json")
	Get(string) (bp.LootTable, bool)
	Remove(string)
	Clear()

	// All returns all LootTables.
	//
	// Example:
	//
	//  loot_tables := project.BP.LootTable.All()
	All() map[string]bp.LootTable
	IsEmpty() bool
	Size() int
	UnmarshalJSON([]byte) error

	// Create a new loot table
	//
	// Example:
	//
	// 	lootTable := New("entities/pig.json")
	New(string) bp.LootTable

	Save(string) error

	LoadAll(string) error

	// Load a single loot_table file.
	//
	// Last parameter is whether the file should be added to the project.
	//
	// Default is true.
	//
	// Example:
	//
	//	loot_table, err := project.BP.LootTable.Load(filepath.Join(project.BP.Path, "loot_tables", "apple.json"))
	Load(string, ...bool) (bp.LootTable, error)
}

type IManifestDependencies

type IManifestDependencies interface {
	Add(...*ManifestDependency)
	All() []*ManifestDependency
	Clear()
	IsEmpty() bool
	Size() int
	UnmarshalJSON([]byte) error

	New(string) *ManifestDependency
}

type IManifestModules

type IManifestModules interface {
	Add(...*ManifestModule)
	All() []*ManifestModule
	Clear()
	IsEmpty() bool
	Size() int
	UnmarshalJSON([]byte) error

	// NewBP creates a new Module for Behavior Pack.
	//
	// Example:
	//
	//	a := NewBP("My Behavior Pack", []int{1, 0, 0})
	NewBP(string, []int) *ManifestModule

	// NewScript creates a new Module for Script.
	//
	// Example:
	//
	//	a := NewScript("scripts/main.js", []int{1, 0, 0})
	NewScript(string, []int) *ManifestModule

	GetBPModules() []*ManifestModule
	GetScriptModules() []*ManifestModule

	Save(string) error
}

type IRecipeBP

type IRecipeBP interface {
	Add(string, bp.RecipeInterface)

	// Get returns the Recipe of the given identifier.
	//
	// Example:
	//
	//  recipe, ok := project.BP.Recipe.Get("glowstone:chair")
	Get(string) (bp.RecipeInterface, bool)

	// GetFile returns the RecipeFile of the given identifier.
	//
	// Example:
	//
	//  recipe, ok := project.BP.Recipe.GetFile("glowstone:chair")
	GetFile(string) (*RecipeFile, bool)

	// Remove removes the Recipe of the given identifier.
	//
	// Example:
	//
	//  project.BP.Recipe.Remove("glowstone:chair")
	Remove(string)
	Clear()

	// All returns all Recipes.
	//
	// Example:
	//
	//  recipes := project.BP.Recipe.All()
	All() map[string]*RecipeFile
	IsEmpty() bool
	Size() int
	UnmarshalJSON([]byte) error

	Save(string) error

	// NewBrewingContainer creates a new recipe for a brewing container.
	//
	// Example:
	//
	//	a := New("glowstone:chair")
	//	b := New("glowstone:table")
	NewBrewingContainer(string, ...struct{ Subdir string }) bp.IRecipeBrewingContainer

	// NewBrewingMix creates a new recipe for a brewing container with a mix.
	//
	// Example:
	//
	//	a := New("glowstone:chair")
	//	b := New("glowstone:table")
	NewBrewingMix(string, ...struct{ Subdir string }) bp.IRecipeBrewingMix

	// NewFurnace creates a new recipe to smelt items in a furnace.
	//
	// Example:
	//
	//	a := New("glowstone:chair")
	//	b := New("glowstone:table")
	NewFurnace(string, ...struct{ Subdir string }) bp.IRecipeFurnace

	// NewShaped creates a new crafting recipe with a shape.
	//
	// Example:
	//
	//	a := New("glowstone:chair")
	//	b := New("glowstone:table")
	NewShaped(string, ...struct{ Subdir string }) bp.IRecipeShaped

	// NewShapeless creates a new crafting recipe without a shape.
	//
	// Example:
	//
	//	a := New("glowstone:chair")
	//	b := New("glowstone:table")
	NewShapeless(string, ...struct{ Subdir string }) bp.IRecipeShapeless

	// NewSmithingTransform creates a new smithing recipe.
	//
	// Example:
	//
	//	a := New("glowstone:chair")
	//	b := New("glowstone:table")
	NewSmithingTransform(string, ...struct{ Subdir string }) bp.IRecipeSmithingTransform

	LoadAll(string) error

	// Load a single recipe file.
	//
	// Last parameter is whether the file should be added to the project.
	//
	// Default is true.
	//
	// Example:
	//
	//	recipe, err := project.BP.Recipe.Load(filepath.Join(project.BP.Path, "", "apple.json"))
	Load(string, ...bool) (*RecipeFile, error)
}

type ItemBP

type ItemBP map[string]*ItemFile

func (*ItemBP) Add

func (e *ItemBP) Add(key string, value bp.Item)

func (*ItemBP) All

func (e *ItemBP) All() map[string]*ItemFile

func (*ItemBP) Clear

func (e *ItemBP) Clear()

func (*ItemBP) Get

func (e *ItemBP) Get(key string) (bp.Item, bool)

func (*ItemBP) GetFile

func (e *ItemBP) GetFile(key string) (*ItemFile, bool)

func (*ItemBP) IsEmpty

func (e *ItemBP) IsEmpty() bool

func (*ItemBP) Load

func (e *ItemBP) Load(src string, add ...bool) (*ItemFile, error)

func (*ItemBP) LoadAll

func (e *ItemBP) LoadAll(pathToBP string) error

func (*ItemBP) New

func (e *ItemBP) New(identifier string) bp.Item

func (*ItemBP) Remove

func (e *ItemBP) Remove(key string)

func (*ItemBP) Save

func (e *ItemBP) Save(pathToBP string) error

func (*ItemBP) Size

func (e *ItemBP) Size() int

func (*ItemBP) UnmarshalJSON

func (e *ItemBP) UnmarshalJSON(data []byte) error

type ItemFile

type ItemFile struct {
	Data bp.Item

	// Other stuff
	Subdir   string
	Filename string
}

func NewItem

func NewItem(identifier string) *ItemFile

Create a new item file

Example:

item := bp.NewItem("glostone:diamond_sword")

func (*ItemFile) Encode

func (e *ItemFile) Encode() ([]byte, error)

Encode returns []byte of the item.

Example:

item, err := e.Encode()

func (*ItemFile) GetFilename

func (e *ItemFile) GetFilename() string

func (*ItemFile) GetIdentifier

func (e *ItemFile) GetIdentifier() string

GetIdentifier returns the identifier of the item without namespace

Example:

identifier := e.GetIdentifier()

func (*ItemFile) GetNamespaceIdentifier

func (e *ItemFile) GetNamespaceIdentifier() string

GetNamespaceIdentifier returns the identifier of the item with namespace

Example:

identifier := e.GetNamespaceIdentifier()

type LootTable

type LootTable map[string]bp.LootTable

func (*LootTable) Add

func (l *LootTable) Add(key string, value bp.LootTable)

func (*LootTable) All

func (l *LootTable) All() map[string]bp.LootTable

func (*LootTable) Clear

func (l *LootTable) Clear()

func (*LootTable) Get

func (l *LootTable) Get(key string) (bp.LootTable, bool)

func (*LootTable) IsEmpty

func (l *LootTable) IsEmpty() bool

func (*LootTable) Load

func (e *LootTable) Load(src string, add ...bool) (bp.LootTable, error)

func (*LootTable) LoadAll

func (l *LootTable) LoadAll(pathToBP string) error

func (*LootTable) New

func (l *LootTable) New(dest string) bp.LootTable

func (*LootTable) Remove

func (l *LootTable) Remove(key string)

func (*LootTable) Save

func (l *LootTable) Save(pathToBP string) error

func (*LootTable) Size

func (l *LootTable) Size() int

func (*LootTable) UnmarshalJSON

func (l *LootTable) UnmarshalJSON(data []byte) error

type LootTableFile

type LootTableFile struct {
	Data bp.LootTable
}

func NewLootTable

func NewLootTable(dest string) *LootTableFile

Create a new animation controller file

Example:

loot_table := bp.NewLootTable("vanilla/player.animation.controller.json")

func (*LootTableFile) Encode

func (e *LootTableFile) Encode() ([]byte, error)

type Manifest

type Manifest struct {
	FormatVersion int                  `json:"format_version"`
	Header        *ManifestHeader      `json:"header,omitempty"`
	Modules       ManifestModules      `json:"modules,omitempty"`
	Dependencies  ManifestDependencies `json:"dependencies,omitempty"`
}

func LoadManifest

func LoadManifest(src string) (*Manifest, error)

func NewManifest

func NewManifest() *Manifest

func (*Manifest) Encode

func (e *Manifest) Encode() ([]byte, error)

func (*Manifest) IsEmpty

func (e *Manifest) IsEmpty() bool

func (*Manifest) Load

func (e *Manifest) Load(src string) error

func (*Manifest) Save

func (e *Manifest) Save(pathToBP string) error

type ManifestDependencies

type ManifestDependencies []*ManifestDependency

func (*ManifestDependencies) Add

func (m *ManifestDependencies) Add(values ...*ManifestDependency)

func (*ManifestDependencies) All

func (*ManifestDependencies) Clear

func (m *ManifestDependencies) Clear()

func (*ManifestDependencies) IsEmpty

func (m *ManifestDependencies) IsEmpty() bool

func (*ManifestDependencies) NewModule

func (m *ManifestDependencies) NewModule(name string, version string) *ManifestDependency

Create a new dependency module

name: The name of the module.

return: The new dependency

Example:

dependency := New("@minecraft/server", "1.7.0")

func (*ManifestDependencies) Size

func (m *ManifestDependencies) Size() int

func (*ManifestDependencies) UnmarshalJSON

func (m *ManifestDependencies) UnmarshalJSON(data []byte) error

type ManifestDependency

type ManifestDependency struct {
	Uuid       string      `json:"uuid,omitempty"`
	ModuleName string      `json:"module_name,omitempty"`
	Version    interface{} `json:"version,omitempty"`
}

type ManifestHeader

type ManifestHeader struct {
	Name             string `json:"name,omitempty"`
	Uuid             string `json:"uuid,omitempty"`
	Description      string `json:"description,omitempty"`
	Version          []int  `json:"version,omitempty"`
	MinEngineVersion []int  `json:"min_engine_version,omitempty"`
}

type ManifestModule

type ManifestModule struct {
	Type        string      `json:"type,omitempty"`
	Uuid        string      `json:"uuid,omitempty"`
	Description string      `json:"description,omitempty"`
	Version     interface{} `json:"version,omitempty"`
	Entry       string      `json:"entry,omitempty"`
	Language    string      `json:"language,omitempty"`
}

type ManifestModules

type ManifestModules []*ManifestModule

func (*ManifestModules) Add

func (m *ManifestModules) Add(values ...*ManifestModule)

func (*ManifestModules) All

func (m *ManifestModules) All() []*ManifestModule

func (*ManifestModules) Clear

func (m *ManifestModules) Clear()

func (*ManifestModules) GetBPModules

func (m *ManifestModules) GetBPModules() []*ManifestModule

func (*ManifestModules) GetScriptModules

func (m *ManifestModules) GetScriptModules() []*ManifestModule

func (*ManifestModules) IsEmpty

func (m *ManifestModules) IsEmpty() bool

func (*ManifestModules) NewBP

func (m *ManifestModules) NewBP(description string, version []int) *ManifestModule

func (*ManifestModules) NewScript

func (m *ManifestModules) NewScript(entry string, version []int) *ManifestModule

func (*ManifestModules) Size

func (m *ManifestModules) Size() int

func (*ManifestModules) UnmarshalJSON

func (m *ManifestModules) UnmarshalJSON(data []byte) error

type RecipeBP

type RecipeBP map[string]*RecipeFile

func (*RecipeBP) Add

func (e *RecipeBP) Add(key string, value bp.RecipeInterface)

func (*RecipeBP) All

func (e *RecipeBP) All() map[string]*RecipeFile

func (*RecipeBP) Clear

func (e *RecipeBP) Clear()

func (*RecipeBP) Get

func (e *RecipeBP) Get(key string) (bp.RecipeInterface, bool)

func (*RecipeBP) GetFile

func (e *RecipeBP) GetFile(key string) (*RecipeFile, bool)

func (*RecipeBP) IsEmpty

func (e *RecipeBP) IsEmpty() bool

func (*RecipeBP) Load

func (e *RecipeBP) Load(src string, add ...bool) (*RecipeFile, error)

func (*RecipeBP) LoadAll

func (e *RecipeBP) LoadAll(pathToBP string) error

func (*RecipeBP) NewBrewingContainer

func (e *RecipeBP) NewBrewingContainer(identifier string, option ...struct{ Subdir string }) bp.IRecipeBrewingContainer

func (*RecipeBP) NewBrewingMix

func (e *RecipeBP) NewBrewingMix(identifier string, option ...struct{ Subdir string }) bp.IRecipeBrewingMix

func (*RecipeBP) NewFurnace

func (e *RecipeBP) NewFurnace(identifier string, option ...struct{ Subdir string }) bp.IRecipeFurnace

func (*RecipeBP) NewShaped

func (e *RecipeBP) NewShaped(identifier string, option ...struct{ Subdir string }) bp.IRecipeShaped

func (*RecipeBP) NewShapeless

func (e *RecipeBP) NewShapeless(identifier string, option ...struct{ Subdir string }) bp.IRecipeShapeless

func (*RecipeBP) NewSmithingTransform

func (e *RecipeBP) NewSmithingTransform(identifier string, option ...struct{ Subdir string }) bp.IRecipeSmithingTransform

func (*RecipeBP) Remove

func (e *RecipeBP) Remove(key string)

func (*RecipeBP) Save

func (e *RecipeBP) Save(pathToBP string) error

func (*RecipeBP) Size

func (e *RecipeBP) Size() int

func (*RecipeBP) UnmarshalJSON

func (e *RecipeBP) UnmarshalJSON(data []byte) error

type RecipeFile

type RecipeFile struct {
	Data bp.RecipeInterface

	// Other stuff
	Subdir   string
	Filename string
}

func NewRecipeBrewingContainer

func NewRecipeBrewingContainer(identifier string) *RecipeFile

Create a new brewing container recipe file

Example:

recipe := bp.NewRecipeBrewingContainer("glostone:diamond_sword")

func NewRecipeBrewingMix

func NewRecipeBrewingMix(identifier string) *RecipeFile

Create a new brewing mix recipe file

Example:

recipe := bp.NewRecipeBrewingMix("glostone:diamond_sword")

func NewRecipeFurnace

func NewRecipeFurnace(identifier string) *RecipeFile

Create a new furnace recipe file

Example:

recipe := bp.NewRecipeFurnace("glostone:diamond_sword")

func NewRecipeShaped

func NewRecipeShaped(identifier string) *RecipeFile

Create a new shaped recipe file

Example:

recipe := bp.NewRecipeShaped("glostone:diamond_sword")

func NewRecipeShapeless

func NewRecipeShapeless(identifier string) *RecipeFile

Create a new shapeless recipe file

Example:

recipe := bp.NewRecipeShapeless("glostone:diamond_sword")

func NewRecipeSmithing

func NewRecipeSmithing(identifier string) *RecipeFile

Create a new smithing recipe file

Example:

recipe := bp.NewRecipeSmithing("glostone:diamond_sword")

func (*RecipeFile) Encode

func (e *RecipeFile) Encode() ([]byte, error)

Encode returns []byte of the recipe.

Example:

recipe, err := e.Encode()

func (*RecipeFile) GetFilename

func (e *RecipeFile) GetFilename() string

func (*RecipeFile) GetIdentifier

func (e *RecipeFile) GetIdentifier() string

GetIdentifier returns the identifier of the recipe without namespace

Example:

identifier := e.GetIdentifier()

func (*RecipeFile) GetNamespaceIdentifier

func (e *RecipeFile) GetNamespaceIdentifier() string

GetNamespaceIdentifier returns the identifier of the recipe with namespace

Example:

identifier := e.GetNamespaceIdentifier()

Jump to

Keyboard shortcuts

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