Add state machine for caching items into chests

This commit is contained in:
2020-09-20 19:08:23 -06:00
parent b8cbd9a5f0
commit f8d44e7e38
12 changed files with 326 additions and 59 deletions
+6 -5
View File
@@ -3,6 +3,7 @@ from math import floor, ceil, sqrt, hypot
import blocks
importlib.reload(blocks)
import data
TICK = 0.05
@@ -65,13 +66,13 @@ def diffrange(n):
def break_time(block_id, held_item=0, in_water=False, on_ground=True, enchantments=[], effects={}):
# from PrismarineJS/prismarine-block
data = blocks.get(block_id)
block_data = blocks.get(block_id)
can_harvest = 'harvestTools' not in data or str(held_item) in data['harvestTools']
material = data.get('material', 'n/a')
tool_multipliers = blocks.mcd.materials.get(material, [])
can_harvest = 'harvestTools' not in block_data or str(held_item) in block_data['harvestTools']
material = block_data.get('material', 'n/a')
tool_multipliers = data.mcd.materials.get(material, [])
is_best_tool = held_item in tool_multipliers
time = data['hardness']
time = block_data['hardness']
if can_harvest:
time *= 1.5