Documentation
¶
Index ¶
- func LoadAnimation(src string) (*bp.Animation, error)
- func LoadAnimationController(src string) (*bp.AnimationControllerFile, error)
- func LoadBlock(src string) (bp.Block, error)
- func LoadEntity(src string) (*bp.Entity, error)
- func LoadItem(src string) (bp.Item, error)
- func LoadLootTable(src string) (bp.LootTable, error)
- func LoadRecipe(src string) (bp.RecipeInterface, error)
- type AnimationBP
- func (m *AnimationBP) Add(key string, value *bp.Animation)
- func (m *AnimationBP) All() map[string]*AnimationFile
- func (m *AnimationBP) Clear()
- func (m *AnimationBP) Get(key string) (*bp.Animation, bool)
- func (m *AnimationBP) GetFile(key string) (*AnimationFile, bool)
- func (m *AnimationBP) IsEmpty() bool
- func (m *AnimationBP) Load(path string, add ...bool) (*AnimationFile, error)
- func (m *AnimationBP) LoadAll(pathToBP string) error
- func (m *AnimationBP) New(dest string) *bp.Animation
- func (m *AnimationBP) Remove(key string)
- func (m *AnimationBP) Save(pathToBP string) error
- func (m *AnimationBP) Size() int
- func (m *AnimationBP) UnmarshalJSON(data []byte) error
- type AnimationControllerBP
- func (m *AnimationControllerBP) Add(key string, value *bp.AnimationControllerFile)
- func (m *AnimationControllerBP) All() map[string]*AnimationControllerFile
- func (m *AnimationControllerBP) Clear()
- func (m *AnimationControllerBP) Get(key string) (*bp.AnimationControllerFile, bool)
- func (m *AnimationControllerBP) GetFile(key string) (*AnimationControllerFile, bool)
- func (m *AnimationControllerBP) IsEmpty() bool
- func (m *AnimationControllerBP) Load(path string, add ...bool) (*AnimationControllerFile, error)
- func (m *AnimationControllerBP) LoadAll(pathToBP string) error
- func (m *AnimationControllerBP) New(dest string) *bp.AnimationControllerFile
- func (m *AnimationControllerBP) Remove(key string)
- func (m *AnimationControllerBP) Save(pathToBP string) error
- func (m *AnimationControllerBP) Size() int
- func (m *AnimationControllerBP) UnmarshalJSON(data []byte) error
- type AnimationControllerFile
- type AnimationFile
- type BlockBP
- func (e *BlockBP) Add(key string, value bp.Block)
- func (e *BlockBP) All() map[string]*BlockFile
- func (e *BlockBP) Clear()
- func (e *BlockBP) Get(key string) (bp.Block, bool)
- func (e *BlockBP) GetFile(key string) (*BlockFile, bool)
- func (e *BlockBP) IsEmpty() bool
- func (e *BlockBP) Load(src string, add ...bool) (*BlockFile, error)
- func (e *BlockBP) LoadAll(pathToBP string) error
- func (e *BlockBP) New(identifier string, option ...) bp.Block
- func (e *BlockBP) Remove(key string)
- func (e *BlockBP) Save(pathToBP string) error
- func (e *BlockBP) Size() int
- func (e *BlockBP) UnmarshalJSON(data []byte) error
- type BlockFile
- type EntityBP
- func (e *EntityBP) Add(key string, value *bp.Entity)
- func (e *EntityBP) All() map[string]*EntityFile
- func (e *EntityBP) Clear()
- func (e *EntityBP) Get(key string) (*bp.Entity, bool)
- func (e *EntityBP) GetFile(key string) (*EntityFile, bool)
- func (e *EntityBP) IsEmpty() bool
- func (e *EntityBP) Load(src string, add ...bool) (*EntityFile, error)
- func (e *EntityBP) LoadAll(pathToBP string) error
- func (e *EntityBP) New(identifier string) *bp.Entity
- func (e *EntityBP) Remove(key string)
- func (e *EntityBP) Save(pathToBP string) error
- func (e *EntityBP) Size() int
- func (e *EntityBP) UnmarshalJSON(data []byte) error
- type EntityFile
- type GlowstoneBP
- type IAnimationBP
- type IAnimationControllerBP
- type IBlockBP
- type IEntityBP
- type IItemBP
- type ILootTable
- type IManifestDependencies
- type IManifestModules
- type IRecipeBP
- type ItemBP
- func (e *ItemBP) Add(key string, value bp.Item)
- func (e *ItemBP) All() map[string]*ItemFile
- func (e *ItemBP) Clear()
- func (e *ItemBP) Get(key string) (bp.Item, bool)
- func (e *ItemBP) GetFile(key string) (*ItemFile, bool)
- func (e *ItemBP) IsEmpty() bool
- func (e *ItemBP) Load(src string, add ...bool) (*ItemFile, error)
- func (e *ItemBP) LoadAll(pathToBP string) error
- func (e *ItemBP) New(identifier string) bp.Item
- func (e *ItemBP) Remove(key string)
- func (e *ItemBP) Save(pathToBP string) error
- func (e *ItemBP) Size() int
- func (e *ItemBP) UnmarshalJSON(data []byte) error
- type ItemFile
- type LootTable
- func (l *LootTable) Add(key string, value bp.LootTable)
- func (l *LootTable) All() map[string]bp.LootTable
- func (l *LootTable) Clear()
- func (l *LootTable) Get(key string) (bp.LootTable, bool)
- func (l *LootTable) IsEmpty() bool
- func (e *LootTable) Load(src string, add ...bool) (bp.LootTable, error)
- func (l *LootTable) LoadAll(pathToBP string) error
- func (l *LootTable) New(dest string) bp.LootTable
- func (l *LootTable) Remove(key string)
- func (l *LootTable) Save(pathToBP string) error
- func (l *LootTable) Size() int
- func (l *LootTable) UnmarshalJSON(data []byte) error
- type LootTableFile
- type Manifest
- type ManifestDependencies
- func (m *ManifestDependencies) Add(values ...*ManifestDependency)
- func (m *ManifestDependencies) All() []*ManifestDependency
- func (m *ManifestDependencies) Clear()
- func (m *ManifestDependencies) IsEmpty() bool
- func (m *ManifestDependencies) NewModule(name string, version string) *ManifestDependency
- func (m *ManifestDependencies) Size() int
- func (m *ManifestDependencies) UnmarshalJSON(data []byte) error
- type ManifestDependency
- type ManifestHeader
- type ManifestModule
- type ManifestModules
- func (m *ManifestModules) Add(values ...*ManifestModule)
- func (m *ManifestModules) All() []*ManifestModule
- func (m *ManifestModules) Clear()
- func (m *ManifestModules) GetBPModules() []*ManifestModule
- func (m *ManifestModules) GetScriptModules() []*ManifestModule
- func (m *ManifestModules) IsEmpty() bool
- func (m *ManifestModules) NewBP(description string, version []int) *ManifestModule
- func (m *ManifestModules) NewScript(entry string, version []int) *ManifestModule
- func (m *ManifestModules) Size() int
- func (m *ManifestModules) UnmarshalJSON(data []byte) error
- type RecipeBP
- func (e *RecipeBP) Add(key string, value bp.RecipeInterface)
- func (e *RecipeBP) All() map[string]*RecipeFile
- func (e *RecipeBP) Clear()
- func (e *RecipeBP) Get(key string) (bp.RecipeInterface, bool)
- func (e *RecipeBP) GetFile(key string) (*RecipeFile, bool)
- func (e *RecipeBP) IsEmpty() bool
- func (e *RecipeBP) Load(src string, add ...bool) (*RecipeFile, error)
- func (e *RecipeBP) LoadAll(pathToBP string) error
- func (e *RecipeBP) NewBrewingContainer(identifier string, option ...struct{ Subdir string }) bp.IRecipeBrewingContainer
- func (e *RecipeBP) NewBrewingMix(identifier string, option ...struct{ Subdir string }) bp.IRecipeBrewingMix
- func (e *RecipeBP) NewFurnace(identifier string, option ...struct{ Subdir string }) bp.IRecipeFurnace
- func (e *RecipeBP) NewShaped(identifier string, option ...struct{ Subdir string }) bp.IRecipeShaped
- func (e *RecipeBP) NewShapeless(identifier string, option ...struct{ Subdir string }) bp.IRecipeShapeless
- func (e *RecipeBP) NewSmithingTransform(identifier string, option ...struct{ Subdir string }) bp.IRecipeSmithingTransform
- func (e *RecipeBP) Remove(key string)
- func (e *RecipeBP) Save(pathToBP string) error
- func (e *RecipeBP) Size() int
- func (e *RecipeBP) UnmarshalJSON(data []byte) error
- type RecipeFile
- func NewRecipeBrewingContainer(identifier string) *RecipeFile
- func NewRecipeBrewingMix(identifier string) *RecipeFile
- func NewRecipeFurnace(identifier string) *RecipeFile
- func NewRecipeShaped(identifier string) *RecipeFile
- func NewRecipeShapeless(identifier string) *RecipeFile
- func NewRecipeSmithing(identifier string) *RecipeFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadAnimationController ¶
func LoadAnimationController(src string) (*bp.AnimationControllerFile, error)
func LoadEntity ¶
Load an entity file from the given path
Example:
entity, err := bp.LoadEntity(filepath.Join("packs", "BP", "entity", "zombie.json")
func LoadItem ¶
Load an item file from the given path
Example:
item, err := bp.LoadItem(filepath.Join("packs", "BP", "item", "sword.json")
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) All ¶
func (m *AnimationBP) All() map[string]*AnimationFile
func (*AnimationBP) Clear ¶
func (m *AnimationBP) Clear()
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) 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 (m *AnimationControllerBP) Add(key string, value *bp.AnimationControllerFile)
func (*AnimationControllerBP) All ¶
func (m *AnimationControllerBP) All() map[string]*AnimationControllerFile
func (*AnimationControllerBP) Clear ¶
func (m *AnimationControllerBP) Clear()
func (*AnimationControllerBP) Get ¶
func (m *AnimationControllerBP) Get(key string) (*bp.AnimationControllerFile, bool)
func (*AnimationControllerBP) GetFile ¶
func (m *AnimationControllerBP) GetFile(key string) (*AnimationControllerFile, bool)
func (*AnimationControllerBP) IsEmpty ¶
func (m *AnimationControllerBP) IsEmpty() bool
func (*AnimationControllerBP) Load ¶
func (m *AnimationControllerBP) Load(path string, add ...bool) (*AnimationControllerFile, error)
func (*AnimationControllerBP) LoadAll ¶
func (m *AnimationControllerBP) LoadAll(pathToBP string) error
func (*AnimationControllerBP) New ¶
func (m *AnimationControllerBP) New(dest string) *bp.AnimationControllerFile
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 ¶
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 BlockFile ¶
func (*BlockFile) GetFilename ¶
func (*BlockFile) GetIdentifier ¶
GetIdentifier returns the identifier of the entity without namespace
Example:
identifier := e.GetIdentifier()
func (*BlockFile) GetNamespaceIdentifier ¶
GetNamespaceIdentifier returns the identifier of the entity with namespace
Example:
identifier := e.GetNamespaceIdentifier()
type EntityBP ¶
type EntityBP map[string]*EntityFile
func (*EntityBP) All ¶
func (e *EntityBP) All() map[string]*EntityFile
func (*EntityBP) UnmarshalJSON ¶
type EntityFile ¶
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 ¶
func (*ItemBP) UnmarshalJSON ¶
type ItemFile ¶
func (*ItemFile) GetFilename ¶
func (*ItemFile) GetIdentifier ¶
GetIdentifier returns the identifier of the item without namespace
Example:
identifier := e.GetIdentifier()
func (*ItemFile) GetNamespaceIdentifier ¶
GetNamespaceIdentifier returns the identifier of the item with namespace
Example:
identifier := e.GetNamespaceIdentifier()
type LootTable ¶
func (*LootTable) UnmarshalJSON ¶
type LootTableFile ¶
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 NewManifest ¶
func NewManifest() *Manifest
type ManifestDependencies ¶
type ManifestDependencies []*ManifestDependency
func (*ManifestDependencies) Add ¶
func (m *ManifestDependencies) Add(values ...*ManifestDependency)
func (*ManifestDependencies) All ¶
func (m *ManifestDependencies) All() []*ManifestDependency
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 ManifestHeader ¶
type ManifestModule ¶
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) All ¶
func (e *RecipeBP) All() map[string]*RecipeFile
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) UnmarshalJSON ¶
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()