MineCrafting

ABC - MineCrafting custom objects

MineCrafting Environment ABC’s

All redifined specialized objects used for the MineCrafting environment.

class Block(item_id: int, name: str, hardness: float, required_tools: Optional[list] = None, drops: Optional[List[crafting.world.items.Item]] = None)

Bases: crafting.world.items.Item

Blocks are common minecraft items that can be gathered with tools.

item_id

Unique item identification number.

Type

int

name

Block name.

Type

str

hardness

How hard is the block to break.

Type

float

items_dropped

(Optional) Items dropped when the block breaks. Blocks drops themselves by default.

Type

list of Item

class Loot(item_id: int, name: str, required_tools: Optional[list] = None, stack_size: int = 1)

Bases: crafting.world.items.Item

Loots are common minecraft items that can be gathered in wilderness.

item_id

Unique item identification number.

Type

int

name

Loot name.

Type

str

stack_size

Number of loots dropped at once.

Type

int

class McTool(item_id: int, name: str, durability: int, speed: int)

Bases: crafting.world.items.Tool

Special tool for minecraft, with durability and speed.

item_id

Unique item identification number.

Type

int

name

Tool name.

Type

str

durability

Tool durability

Type

int

speed

Tool speed.

Type

int

max_stack

Maximum number of tool per stack.

Type

int

use(item: Optional[Union[crafting.examples.minecraft.abc.Block, crafting.examples.minecraft.abc.Loot, crafting.world.items.Item]] = None)

Use the tool on the (optional) given item.

Parameters

item – Item to use the tool on.

Returns

The list of found item stacks.

property is_broken
reset()
class McPlayer(world: crafting.world.world.World)

Bases: crafting.player.player.Player

choose_tool(item: crafting.world.items.Item)crafting.world.items.Tool

Choose a tool to search for an item.

Parameters

item – The item to search for.

Returns

The chosen tool.

search_for(item: crafting.world.items.Item, tool: crafting.examples.minecraft.abc.McTool)int

Search for an item using a tool and add them to inventory.

Parameters
  • item – The item to look for.

  • tool – The tool to use to search.

Returns

Number of items found.

Custom World

class McWorld

Bases: crafting.world.world.World

Minecraft world

Gym Environment

MineCrafting Environment

Crafting environment adapted to the Minecraft inventory

class MineCraftingEnv(*args: Any, **kwargs: Any)

Bases: gym.

MineCrafting Environment

Rendering

Zones list

Minecraft Zones

Abstract zones to simulate simply a Minecraft environment.

FOREST = Forest(0)[Wood(17), Dirt(3), Stone(1)]

FOREST

SWAMP = Swamp(1)[Dirt(3), Reeds(83)]

SWAMP

MEADOW = Meadow(2)[Dirt(3), Stone(1), Leather(334), Egg(344)]

MEADOW

UNDERGROUND = Underground(3)[Dirt(3), Stone(1), Iron_ore(15), Gold_ore(14)]

UNDERGROUND

BEDROCK = Bedrock(4)[Dirt(3), Stone(1), Iron_ore(15), Gold_ore(14), Diamond_ore(56), Redstone_ore(73), Obsidian(49)]

BEDROCK

Recipes list

Minecraft Recipes

All used Minecraft recipies.

R_WOOD_PLANK = Wood_plank(5)[4] <- Wood(17)[1]

Recipe of WOOD_PLANK

R_STICK = Stick(280)[4] <- Wood_plank(5)[2]

Recipe of STICK

R_CRAFTING_TABLE = {'has_crafting': True} <- Wood_plank(5)[4]

Recipe of CRAFTING_TABLE (enable ‘has_crafting’ zone property)

R_FURNACE = {'has_furnace': True} <- Cobblestone(4)[8]{'has_crafting': True}

Recipe of FURNACE (enable ‘has_furnace’ zone property)

R_IRON_INGOT_PLANK = Iron_ingot(265)[3] <- [Iron_ore(15)[3], Wood_plank(5)[2]]{'has_furnace': True}

Recipe of IRON_INGOT using PLANK

R_GOLD_INGOT_PLANK = Gold_ingot(266)[3] <- [Gold_ore(14)[3], Wood_plank(5)[2]]{'has_furnace': True}

Recipe of GOLD_INGOT using PLANK

R_WOODEN_PICKAXE = Wooden_pickaxe(270)[1] <- [Wood_plank(5)[3], Stick(280)[2]]{'has_crafting': True}

Recipe of WOODEN_PICKAXE

R_WOODEN_AXE = Wooden_axe(271)[1] <- [Wood_plank(5)[3], Stick(280)[2]]{'has_crafting': True}

Recipe of WOODEN_AXE

R_WOODEN_SWORD = Wooden_sword(268)[1] <- [Wood_plank(5)[2], Stick(280)[1]]{'has_crafting': True}

Recipe of WOODEN_SWORD

R_STONE_PICKAXE = Stone_pickaxe(274)[1] <- [Cobblestone(4)[3], Stick(280)[2]]{'has_crafting': True}

Recipe of STONE_PICKAXE

R_STONE_AXE = Stone_axe(275)[1] <- [Cobblestone(4)[3], Stick(280)[2]]{'has_crafting': True}

Recipe of STONE_AXE

R_STONE_SWORD = Stone_sword(272)[1] <- [Cobblestone(4)[2], Stick(280)[1]]{'has_crafting': True}

Recipe of STONE_SWORD

R_IRON_PICKAXE = Iron_pickaxe(257)[1] <- [Iron_ingot(265)[3], Stick(280)[2]]{'has_crafting': True}

Recipe of IRON_PICKAXE

R_IRON_AXE = Iron_axe(258)[1] <- [Iron_ingot(265)[3], Stick(280)[2]]{'has_crafting': True}

Recipe of IRON_AXE

R_IRON_SWORD = Iron_sword(267)[1] <- [Iron_ingot(265)[2], Stick(280)[1]]{'has_crafting': True}

Recipe of IRON_SWORD

R_GOLD_PICKAXE = Gold_pickaxe(285)[1] <- [Gold_ingot(266)[3], Stick(280)[2]]{'has_crafting': True}

Recipe of GOLD_PICKAXE

R_GOLD_AXE = Gold_axe(286)[1] <- [Gold_ingot(266)[3], Stick(280)[2]]{'has_crafting': True}

Recipe of GOLD_AXE

R_GOLD_SWORD = Gold_sword(283)[1] <- [Gold_ingot(266)[2], Stick(280)[1]]{'has_crafting': True}

Recipe of GOLD_SWORD

R_DIAMOND_PICKAXE = Diamond_pickaxe(278)[1] <- [Diamond(264)[3], Stick(280)[2]]{'has_crafting': True}

Recipe of DIAMOND_PICKAXE

R_DIAMOND_AXE = Diamond_axe(279)[1] <- [Diamond(264)[3], Stick(280)[2]]{'has_crafting': True}

Recipe of DIAMOND_AXE

R_DIAMOND_SWORD = Diamond_sword(276)[1] <- [Diamond(264)[2], Stick(280)[1]]{'has_crafting': True}

Recipe of DIAMOND_SWORD

R_PAPER = Paper(339)[3] <- Reeds(83)[3]{'has_crafting': True}

Recipe of PAPER

R_BOOK = Book(340)[1] <- [Paper(339)[3], Leather(334)[1]]{'has_crafting': True}

Recipe of BOOK

R_ENCHANTING_TABLE = Enchanting_table(116)[1] <- [Book(340)[1], Obsidian(49)[4], Diamond(264)[2]]{'has_crafting': True}

Recipe of ENCHANTING_TABLE

R_CLOCK = Clock(347)[1] <- [Gold_ingot(266)[4], Redstone(331)[1]]{'has_crafting': True}

Recipe of CLOCK

Items list

Minecraft Items

All used minecraft items. They are three kinds of items: Loots and Blocks that can be found, and other items that can only be obtain through crafting.

DIAMOND = Diamond(264)

DIAMOND

IRON_INGOT = Iron_ingot(265)

IRON_INGOT

GOLD_INGOT = Gold_ingot(266)

GOLD_INGOT

PAPER = Paper(339)

PAPER

BOOK = Book(340)

BOOK

REDSTONE = Redstone(331)

REDSTONE

CLOCK = Clock(347)

CLOCK

ENCHANTING_TABLE = Enchanting_table(116)

ENCHANTING_TABLE

STICK = Stick(280)

STICK

DIRT = Dirt(3)

DIRT

COBBLESTONE = Cobblestone(4)

COBBLESTONE

STONE = Stone(1)

STONE

WOOD_PLANK = Wood_plank(5)

WOOD_PLANK

GOLD_ORE = Gold_ore(14)

GOLD_ORE

IRON_ORE = Iron_ore(15)

IRON_ORE

WOOD = Wood(17)

WOOD

DIAMOND_ORE = Diamond_ore(56)

DIAMOND_ORE

OBSIDIAN = Obsidian(49)

OBSIDIAN

REDSTONE_ORE = Redstone_ore(73)

REDSTONE_ORE

REEDS = Reeds(83)

REEDS

EGG = Egg(344)

EGG

LEATHER = Leather(334)

LEATHER

Tools list

Minecraft Tools

All used minecraft tools

WOODEN_PICKAXE = Wooden_pickaxe(270)

WOODEN_PICKAXE

WOODEN_AXE = Wooden_axe(271)

WOODEN_AXE

WOODEN_SWORD = Wooden_sword(268)

WOODEN_SWORD

STONE_PICKAXE = Stone_pickaxe(274)

STONE_PICKAXE

STONE_AXE = Stone_axe(275)

STONE_AXE

STONE_SWORD = Stone_sword(272)

STONE_SWORD

IRON_PICKAXE = Iron_pickaxe(257)

IRON_PICKAXE

IRON_AXE = Iron_axe(258)

IRON_AXE

IRON_SWORD = Iron_sword(267)

IRON_SWORD

GOLD_PICKAXE = Gold_pickaxe(285)

GOLD_PICKAXE

GOLD_AXE = Gold_axe(286)

GOLD_AXE

GOLD_SWORD = Gold_sword(283)

GOLD_SWORD

DIAMOND_PICKAXE = Diamond_pickaxe(278)

DIAMOND_PICKAXE

DIAMOND_AXE = Diamond_axe(279)

DIAMOND_AXE

DIAMOND_SWORD = Diamond_sword(276)

DIAMOND_SWORD