This commit is contained in:
Daniel Mills
2020-01-20 01:53:43 -05:00
parent 1357d817e6
commit fd561cd45d
4 changed files with 67 additions and 4 deletions

View File

@@ -434,4 +434,9 @@ public class IrisGenerator extends ParallelChunkGenerator
return f;
}
public PlacedObject randomObject(String string)
{
return god.randomObject(string);
}
}

View File

@@ -248,4 +248,24 @@ public class GenObjectDecorator extends BlockPopulator
{
return placeHistory;
}
public PlacedObject randomObject(String string)
{
GList<PlacedObject> v = new GList<>();
for(PlacedObject i : placeHistory)
{
if(i.getF().toLowerCase().replaceAll("\\Q:\\E", "/").startsWith(string.toLowerCase()))
{
v.add(i);
}
}
if(v.isEmpty())
{
return null;
}
return v.getRandom();
}
}