Add state machine for caching items into chests
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user