world: add __lt__ method to RegionSet
So turns out genPOI wants to use sorted() so it can use itertools.groupby. Python 2 somehow just... sorted objects so that groupby (which is basically the UNIX uniq) could group them properly. Python 3 no longer does this, so as comparison method let's just compare regiondir strings since that gives us the desired result. Fixes #1597.
This commit is contained in:
@@ -823,6 +823,13 @@ class RegionSet(object):
|
||||
def __repr__(self):
|
||||
return "<RegionSet regiondir=%r>" % self.regiondir
|
||||
|
||||
def __lt__(self, other):
|
||||
"""This garbage is only needed because genPOI wants to use
|
||||
itertools.groupby, which needs sorted keys, and Python 2 somehow
|
||||
just sorted objects like ???????? how????? why?????
|
||||
"""
|
||||
return self.regiondir < other.regiondir
|
||||
|
||||
def _get_block(self, palette_entry):
|
||||
wood_slabs = ('minecraft:oak_slab','minecraft:spruce_slab','minecraft:birch_slab','minecraft:jungle_slab',
|
||||
'minecraft:acacia_slab','minecraft:dark_oak_slab','minecraft:petrified_oak_slab')
|
||||
|
||||
Reference in New Issue
Block a user