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

@ -2,6 +2,7 @@ package ninja.bytecode.iris;
import org.bukkit.ChatColor;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@ -12,6 +13,7 @@ import mortar.api.nms.NMP;
import mortar.util.text.C;
import ninja.bytecode.iris.controller.TimingsController;
import ninja.bytecode.iris.generator.IrisGenerator;
import ninja.bytecode.iris.generator.genobject.PlacedObject;
import ninja.bytecode.iris.pack.IrisBiome;
import ninja.bytecode.iris.util.BiomeLayer;
import ninja.bytecode.shuriken.format.F;
@ -86,6 +88,40 @@ public class CommandIris implements CommandExecutor
}
}
if(args[0].equalsIgnoreCase("otp"))
{
if(sender instanceof Player)
{
Player p = (Player) sender;
World w = p.getWorld();
if(w.getGenerator() instanceof IrisGenerator)
{
if(args.length >= 2)
{
PlacedObject o = ((IrisGenerator) w.getGenerator()).randomObject(args[1]);
if(o != null)
{
Location l = new Location(w, o.getX(), o.getY(), o.getZ());
p.teleport(l);
msg(p, "Found " + C.DARK_GREEN + o.getF().replace(":", "/" + C.WHITE));
}
else
{
msg(p, "Found Nothing");
}
}
else
{
msg(p, "/iris otp <object/group>");
}
}
}
}
if(args[0].equalsIgnoreCase("rtp"))
{
if(sender instanceof Player)

View File

@ -103,7 +103,7 @@ public class PackController implements IrisController
}
L.v(ChatColor.LIGHT_PURPLE + "Processing Content");
for(GenObjectGroup i : genObjectGroups.v())
{
i.processVariants();
@ -129,6 +129,8 @@ public class PackController implements IrisController
GenObjectGroup ggx = genObjectGroups.get(k).copy("-snowy-" + j.getSnow());
ggx.applySnowFilter((int) (j.getSnow() * 4));
d.registerObject(ggx);
j.getSchematicGroups().put(ggx.getName(), j.getSchematicGroups().get(k));
j.getSchematicGroups().remove(k);
}
}
}
@ -285,17 +287,17 @@ public class PackController implements IrisController
{
i.dispose();
}
for(IrisDimension i : dimensions.values())
{
i.dispose();
}
for(CompiledDimension i : compiledDimensions.values())
{
i.dispose();
}
compiledDimensions.clear();
dimensions.clear();
biomes.clear();

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();
}
}