def _load_mob_types(self, load_mob_types=True): if not load_mob_types: return mob_property_data = minecraft_specs.get_mob_property_data() mob_name_to_properties = mob_property_data["name_to_properties"] for (name, m) in SPAWN_OBJECTS.items(): type_name = "spawn " + name # load single mob as schematics memid = SchematicNode.create(self, [((0, 0, 0), (383, m))]) self.add_triple(subj=memid, pred_text="has_name", obj_text=type_name) if "block" in type_name: self.add_triple(subj=memid, pred_text="has_name", obj_text=type_name.strip("block").strip()) # then load properties memid = MobTypeNode.create(self, type_name, (383, m)) self.add_triple(subj=memid, pred_text="has_name", obj_text=type_name) if mob_name_to_properties.get(type_name) is not None: for property in mob_name_to_properties[type_name]: self.add_triple(subj=memid, pred_text="has_name", obj_text=property)
get_locs_from_entity, build_safe_diag_adjacent, euclid_dist, to_block_pos, fill_idmeta, ) from block_data import BORING_BLOCKS, PASSABLE_BLOCKS, COLOR_BID_MAP from search import depth_first_search from mc_memory_nodes import InstSegNode, BlockObjectNode GROUND_BLOCKS = [1, 2, 3, 7, 8, 9, 12, 79, 80] MAX_RADIUS = 20 BLOCK_DATA = minecraft_specs.get_block_data() COLOUR_DATA = minecraft_specs.get_colour_data() BLOCK_PROPERTY_DATA = minecraft_specs.get_block_property_data() MOB_PROPERTY_DATA = minecraft_specs.get_mob_property_data() BID_COLOR_DATA = minecraft_specs.get_bid_to_colours() COLOUR_LIST = list(COLOR_BID_MAP.keys()) # Taken from : stackoverflow.com/questions/16750618/ # whats-an-efficient-way-to-find-if-a-point-lies-in-the-convex-hull-of-a-point-cl def in_hull(points, x): """Check if x is in the convex hull of points""" n_points = len(points) c = np.zeros(n_points) A = np.r_[points.T, np.ones((1, n_points))] b = np.r_[x, np.ones(1)] lp = linprog(c, A_eq=A, b_eq=b) return lp.success