Documentation
¶
Index ¶
- Constants
- Variables
- func DisplayName(id uint8) string
- func GetDefaultDurability(id uint8) int
- func HasTag(id uint8, tag tag) bool
- func IsBestTool(blockID, toolID uint8) bool
- func IsStackable(id uint8) bool
- func RandomBlock() uint8
- func RandomItem() uint8
- type CraftTable
- func (c *CraftTable) CheckRecipe(recipes map[uint8]Recipe) (uint8, uint8)
- func (c *CraftTable) ClearCurrenSlot()
- func (c *CraftTable) ClearTable()
- func (c *CraftTable) CurrentSlot() *Slot
- func (c *CraftTable) Equal(recipeA, recipeB Recipe) bool
- func (c *CraftTable) RemoveItem(x, y int)
- func (c *CraftTable) UpdateResultSlot(recipes map[uint8]Recipe) uint8
- type Inventory
- func (i *Inventory) AddItemIfEmpty(id uint8, dura int) bool
- func (i *Inventory) ClearCurrentSlot()
- func (i *Inventory) ClearSlot(index int)
- func (i *Inventory) CurrentSlot() *Slot
- func (i *Inventory) CurrentSlotID() uint8
- func (i *Inventory) CurrentSlotQuantity() uint8
- func (i *Inventory) HasEmptySlot() (index int, ok bool)
- func (i *Inventory) HasItem(id uint8) (index int, ok bool)
- func (i *Inventory) HasItemStackSpace(id uint8) (index int, ok bool)
- func (i *Inventory) IsCurrentSlotEmpty() bool
- func (i *Inventory) RandomFillAllSlots()
- func (i *Inventory) RemoveItem(id uint8) bool
- func (i *Inventory) RemoveItemFromSelectedSlot() (uint8, int)
- func (i *Inventory) Reset()
- func (i *Inventory) ResetUnusedSlots()
- func (i *Inventory) SelectNextSlot()
- func (i *Inventory) SelectPrevSlot()
- func (i *Inventory) SetSize(n int)
- func (i *Inventory) SetSlot(slotIndex int, id uint8, quantity uint8, dur int)
- type ItemProperty
- type Recipe
- type Slot
Constants ¶
View Source
const ( Air uint8 = iota Bedrock Bread Bucket Coal CoalOre CraftingTable Diamond DiamondAxe DiamondOre DiamondPickaxe DiamondShovel Dirt Furnace GoldIngot GoldOre GrassBlock GrassBlockSnow IronAxe IronIngot IronOre IronPickaxe IronShovel OakLeaves OakLog OakPlanks OakSapling Obsidian RawGold RawIron Sand SmoothStone Snow Snowball Stick Stone StoneAxe StoneBricks StonePickaxe StoneShovel Tnt Torch WaterBucket WoodenAxe WoodenPickaxe WoodenShovel Random )
Item ID
View Source
const ( None tag = 0 Block tag = 1 << iota OreBlock UnbreakableBlock NonSolidBlock Harvestable DropItem Item RawOre Tool Weapon Food MaterialWooden MaterialGold MaterialStone MaterialIron MaterialDiamond ToolHand ToolAxe ToolPickaxe ToolShovel ToolBucket )
Item Bitmask tag
View Source
const All = tag(^uint(0))
Variables ¶
View Source
var Blocks []uint8
View Source
var ColorMap = map[uint8]color.RGBA{
Air: rgb(0, 62, 161),
CraftingTable: rgb(194, 137, 62),
GrassBlock: rgb(133, 75, 54),
Dirt: rgb(133, 75, 54),
Sand: rgb(199, 193, 158),
Stone: rgb(120, 120, 120),
CoalOre: rgb(0, 0, 0),
GoldOre: rgb(255, 221, 0),
IronOre: rgb(151, 176, 205),
DiamondOre: rgb(0, 247, 255),
OakLog: rgb(227, 131, 104),
OakPlanks: rgb(224, 153, 145),
OakLeaves: rgb(0, 160, 16),
}
View Source
var CraftingRecipes map[uint8]Recipe
View Source
var FurnaceRecipes map[uint8]Recipe
View Source
var Property = map[uint8]ItemProperty{ Air: { DisplayName: "Air", DropID: Air, MaxStackSize: 1, Tags: None | NonSolidBlock | UnbreakableBlock, }, Bedrock: { DisplayName: "Bedrock", DropID: Bedrock, MaxStackSize: 1, Tags: Block | UnbreakableBlock, }, Random: { DisplayName: "Random", MaxStackSize: 64, Tags: Block | UnbreakableBlock, }, Bread: { DisplayName: "Bread", MaxStackSize: 64, Tags: Item | Food, }, Bucket: { DisplayName: "Bucket", MaxStackSize: 1, Tags: Item | Tool, }, Coal: { DisplayName: "Coal", MaxStackSize: 64, Tags: Item | DropItem | RawOre, }, CoalOre: { DisplayName: "Coal Ore", DropID: Coal, MaxStackSize: 64, Tags: Block | OreBlock, BestToolTag: ToolPickaxe, }, CraftingTable: { DisplayName: "Crafting Table", DropID: CraftingTable, MaxStackSize: 1, Tags: Block, BestToolTag: ToolAxe, }, Diamond: { DisplayName: "Diamond", MaxStackSize: 64, Tags: Item | DropItem | RawOre, }, DiamondAxe: { DisplayName: "Diamond Axe", MaxStackSize: 1, Tags: Item | Tool | ToolAxe | Weapon | MaterialDiamond, }, DiamondOre: { DisplayName: "Diamond Ore", DropID: Diamond, MaxStackSize: 64, Tags: Block | OreBlock, BestToolTag: ToolPickaxe, }, DiamondPickaxe: { DisplayName: "Diamond Pickaxe", MaxStackSize: 1, Tags: Item | Tool | ToolPickaxe | MaterialDiamond, }, DiamondShovel: { DisplayName: "Diamond Shovel", MaxStackSize: 1, Tags: Item | Tool | ToolShovel | MaterialDiamond, }, Dirt: { DisplayName: "Dirt", DropID: Dirt, MaxStackSize: 64, Tags: Block, BestToolTag: ToolShovel, }, Furnace: { DisplayName: "Furnace", DropID: Furnace, MaxStackSize: 1, Tags: Block, BestToolTag: ToolPickaxe, }, GoldIngot: { DisplayName: "Gold Ingot", MaxStackSize: 64, Tags: Item, }, GoldOre: { DisplayName: "Gold Ore", DropID: RawGold, MaxStackSize: 64, Tags: Block | OreBlock, BestToolTag: ToolPickaxe, }, GrassBlock: { DisplayName: "Grass Block", DropID: Dirt, MaxStackSize: 64, Tags: Block, BestToolTag: ToolShovel, }, GrassBlockSnow: { DisplayName: "Grass Block Snow", DropID: Dirt, MaxStackSize: 64, Tags: Block, BestToolTag: ToolShovel, }, IronAxe: { DisplayName: "Iron Axe", MaxStackSize: 1, Tags: Item | Tool | ToolAxe | MaterialIron, }, IronIngot: { DisplayName: "Iron Ingot", MaxStackSize: 64, Tags: Item, }, IronOre: { DisplayName: "Iron Ore", DropID: RawIron, MaxStackSize: 64, Tags: Block | OreBlock, BestToolTag: ToolPickaxe, }, IronPickaxe: { DisplayName: "Iron Pickaxe", MaxStackSize: 1, Tags: Item | Tool | ToolPickaxe | MaterialIron, }, IronShovel: { DisplayName: "Iron Shovel", MaxStackSize: 1, Tags: Item | Tool | ToolShovel | MaterialIron, }, OakLeaves: { DisplayName: "Oak Leaves", DropID: OakSapling, MaxStackSize: 64, Tags: Block, BestToolTag: All, }, OakLog: { DisplayName: "Oak Log", DropID: OakLog, MaxStackSize: 64, Tags: Block, BestToolTag: ToolAxe, }, OakPlanks: { DisplayName: "Oak Planks", DropID: OakPlanks, MaxStackSize: 64, Tags: Block, BestToolTag: ToolAxe, }, OakSapling: { DisplayName: "Oak Sapling", DropID: OakSapling, MaxStackSize: 64, Tags: Block | Item | NonSolidBlock, BestToolTag: ToolAxe, }, Obsidian: { DisplayName: "Obsidian", DropID: Obsidian, MaxStackSize: 64, Tags: Block, BestToolTag: ToolPickaxe, }, RawGold: { DisplayName: "Raw Gold", MaxStackSize: 64, Tags: Item | DropItem | RawOre, }, RawIron: { DisplayName: "Raw Iron", MaxStackSize: 64, Tags: Item | DropItem | RawOre, }, Sand: { DisplayName: "Sand", DropID: Sand, MaxStackSize: 64, Tags: Block, BestToolTag: ToolShovel, }, SmoothStone: { DisplayName: "Smooth Stone", DropID: SmoothStone, MaxStackSize: 64, Tags: Block, }, Snow: { DisplayName: "Snow", DropID: Dirt, MaxStackSize: 64, Tags: Block, BestToolTag: ToolShovel, }, Snowball: { DisplayName: "Snowball", DropID: Snowball, MaxStackSize: 64, Tags: Item, }, Stick: { DisplayName: "Stick", MaxStackSize: 64, Tags: Item, }, Stone: { DisplayName: "Stone", DropID: Stone, MaxStackSize: 64, Tags: Block, BestToolTag: ToolPickaxe, }, StoneAxe: { DisplayName: "Stone Axe", MaxStackSize: 1, Tags: Item | Tool | ToolAxe | MaterialStone, }, StoneBricks: { DisplayName: "Stone Bricks", DropID: StoneBricks, MaxStackSize: 64, Tags: Block, BestToolTag: ToolPickaxe, }, StonePickaxe: { DisplayName: "Stone Pickaxe", MaxStackSize: 1, Tags: Item | Tool | ToolPickaxe | MaterialStone, }, StoneShovel: { DisplayName: "Stone Shovel", MaxStackSize: 1, Tags: Item | Tool | ToolShovel | MaterialStone, }, Tnt: { DisplayName: "TNT", DropID: Tnt, MaxStackSize: 64, Tags: Block, BestToolTag: All, }, Torch: { DisplayName: "Torch", DropID: Torch, MaxStackSize: 64, Tags: Item | Block | NonSolidBlock, BestToolTag: All, }, WaterBucket: { DisplayName: "Water Bucket", MaxStackSize: 1, Tags: Item | Tool | ToolBucket | MaterialIron, }, WoodenAxe: { DisplayName: "Wooden Axe", MaxStackSize: 1, Tags: Item | Tool | ToolAxe | MaterialWooden, }, WoodenPickaxe: { DisplayName: "Wooden Pickaxe", MaxStackSize: 1, Tags: Item | Tool | ToolPickaxe | MaterialWooden, }, WoodenShovel: { DisplayName: "Wooden Shovel", MaxStackSize: 1, Tags: Item | Tool | ToolShovel | MaterialWooden, }, }
Functions ¶
func DisplayName ¶
func GetDefaultDurability ¶
func IsBestTool ¶
func IsStackable ¶
func RandomBlock ¶
func RandomBlock() uint8
func RandomItem ¶
func RandomItem() uint8
Types ¶
type CraftTable ¶
func NewCraftTable ¶
func NewCraftTable() *CraftTable
func (*CraftTable) CheckRecipe ¶
func (c *CraftTable) CheckRecipe(recipes map[uint8]Recipe) (uint8, uint8)
returns zero (air) if no recipe is found, otherwise returns the recipe result and quantity.
func (*CraftTable) ClearCurrenSlot ¶
func (c *CraftTable) ClearCurrenSlot()
func (*CraftTable) ClearTable ¶
func (c *CraftTable) ClearTable()
func (*CraftTable) CurrentSlot ¶
func (c *CraftTable) CurrentSlot() *Slot
func (*CraftTable) Equal ¶
func (c *CraftTable) Equal(recipeA, recipeB Recipe) bool
func (*CraftTable) RemoveItem ¶
func (c *CraftTable) RemoveItem(x, y int)
func (*CraftTable) UpdateResultSlot ¶
func (c *CraftTable) UpdateResultSlot(recipes map[uint8]Recipe) uint8
returns minimum result item quantity
type Inventory ¶
func NewInventory ¶
func (*Inventory) AddItemIfEmpty ¶
AddItemIfEmpty adds item to inventory if empty
func (*Inventory) ClearCurrentSlot ¶
func (i *Inventory) ClearCurrentSlot()
func (*Inventory) CurrentSlot ¶
func (*Inventory) CurrentSlotID ¶
func (*Inventory) CurrentSlotQuantity ¶
func (*Inventory) HasEmptySlot ¶
func (*Inventory) HasItemStackSpace ¶
func (*Inventory) IsCurrentSlotEmpty ¶
func (*Inventory) RandomFillAllSlots ¶
func (i *Inventory) RandomFillAllSlots()
func (*Inventory) RemoveItem ¶
func (*Inventory) RemoveItemFromSelectedSlot ¶
func (*Inventory) ResetUnusedSlots ¶
func (i *Inventory) ResetUnusedSlots()
func (*Inventory) SelectNextSlot ¶
func (i *Inventory) SelectNextSlot()
func (*Inventory) SelectPrevSlot ¶
func (i *Inventory) SelectPrevSlot()
type ItemProperty ¶
Click to show internal directories.
Click to hide internal directories.