mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 10:12:53 +00:00
Total rotation support
This commit is contained in:
parent
71c90c6d31
commit
f3d87f09d7
@ -18,15 +18,13 @@ import org.bukkit.plugin.Plugin;
|
||||
import com.google.gson.Gson;
|
||||
import com.volmit.iris.command.CommandIris;
|
||||
import com.volmit.iris.command.PermissionIris;
|
||||
import com.volmit.iris.command.util.MortarPlugin;
|
||||
import com.volmit.iris.command.util.Permission;
|
||||
import com.volmit.iris.generator.IrisChunkGenerator;
|
||||
import com.volmit.iris.layer.post.PostFloatingNibDeleter;
|
||||
import com.volmit.iris.layer.post.PostNibSmoother;
|
||||
import com.volmit.iris.layer.post.PostPotholeFiller;
|
||||
import com.volmit.iris.layer.post.PostSlabber;
|
||||
import com.volmit.iris.layer.post.PostWallPatcher;
|
||||
import com.volmit.iris.layer.post.PostWaterlogger;
|
||||
import com.volmit.iris.gen.IrisChunkGenerator;
|
||||
import com.volmit.iris.gen.post.PostFloatingNibDeleter;
|
||||
import com.volmit.iris.gen.post.PostNibSmoother;
|
||||
import com.volmit.iris.gen.post.PostPotholeFiller;
|
||||
import com.volmit.iris.gen.post.PostSlabber;
|
||||
import com.volmit.iris.gen.post.PostWallPatcher;
|
||||
import com.volmit.iris.gen.post.PostWaterlogger;
|
||||
import com.volmit.iris.object.IrisBiome;
|
||||
import com.volmit.iris.util.BiomeResult;
|
||||
import com.volmit.iris.util.BoardManager;
|
||||
@ -45,9 +43,10 @@ import com.volmit.iris.util.JSONObject;
|
||||
import com.volmit.iris.util.JarScanner;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.KMap;
|
||||
import com.volmit.iris.util.MortarPlugin;
|
||||
import com.volmit.iris.util.Permission;
|
||||
import com.volmit.iris.util.RollingSequence;
|
||||
import com.volmit.iris.util.ScoreDirection;
|
||||
import com.volmit.iris.wand.WandController;
|
||||
|
||||
public class Iris extends MortarPlugin implements BoardProvider
|
||||
{
|
||||
@ -70,7 +69,7 @@ public class Iris extends MortarPlugin implements BoardProvider
|
||||
@Permission
|
||||
public static PermissionIris perm;
|
||||
|
||||
@com.volmit.iris.command.util.Command
|
||||
@com.volmit.iris.util.Command
|
||||
public CommandIris commandIris;
|
||||
|
||||
public Iris()
|
||||
|
@ -11,12 +11,12 @@ import org.bukkit.World;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.WorldType;
|
||||
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.generator.IrisChunkGenerator;
|
||||
import com.volmit.iris.gen.IrisChunkGenerator;
|
||||
import com.volmit.iris.object.IrisDimension;
|
||||
import com.volmit.iris.util.Form;
|
||||
import com.volmit.iris.util.IO;
|
||||
import com.volmit.iris.util.J;
|
||||
import com.volmit.iris.util.MortarSender;
|
||||
import com.volmit.iris.util.O;
|
||||
|
||||
import lombok.Data;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.volmit.iris.wand;
|
||||
package com.volmit.iris;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.Iterator;
|
||||
@ -23,7 +23,6 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.util.BlockVector;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.object.IrisObject;
|
||||
import com.volmit.iris.util.Cuboid;
|
||||
import com.volmit.iris.util.KList;
|
@ -1,9 +1,9 @@
|
||||
package com.volmit.iris.command;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.Command;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.util.Command;
|
||||
import com.volmit.iris.util.MortarCommand;
|
||||
import com.volmit.iris.util.MortarSender;
|
||||
|
||||
public class CommandIris extends MortarCommand
|
||||
{
|
||||
|
@ -5,10 +5,10 @@ import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.generator.IrisChunkGenerator;
|
||||
import com.volmit.iris.gen.IrisChunkGenerator;
|
||||
import com.volmit.iris.object.IrisBiome;
|
||||
import com.volmit.iris.util.MortarCommand;
|
||||
import com.volmit.iris.util.MortarSender;
|
||||
import com.volmit.iris.util.RNG;
|
||||
|
||||
public class CommandIrisGoto extends MortarCommand
|
||||
|
@ -6,10 +6,10 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.IrisMetrics;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.generator.IrisChunkGenerator;
|
||||
import com.volmit.iris.gen.IrisChunkGenerator;
|
||||
import com.volmit.iris.util.Form;
|
||||
import com.volmit.iris.util.MortarCommand;
|
||||
import com.volmit.iris.util.MortarSender;
|
||||
|
||||
public class CommandIrisMetrics extends MortarCommand
|
||||
{
|
||||
|
@ -1,9 +1,9 @@
|
||||
package com.volmit.iris.command;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.Command;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.util.Command;
|
||||
import com.volmit.iris.util.MortarCommand;
|
||||
import com.volmit.iris.util.MortarSender;
|
||||
|
||||
public class CommandIrisObject extends MortarCommand
|
||||
{
|
||||
|
@ -5,11 +5,11 @@ import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.WandController;
|
||||
import com.volmit.iris.util.Cuboid;
|
||||
import com.volmit.iris.util.Direction;
|
||||
import com.volmit.iris.wand.WandController;
|
||||
import com.volmit.iris.util.MortarCommand;
|
||||
import com.volmit.iris.util.MortarSender;
|
||||
|
||||
public class CommandIrisObjectContract extends MortarCommand
|
||||
{
|
||||
|
@ -5,11 +5,11 @@ import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.WandController;
|
||||
import com.volmit.iris.util.Cuboid;
|
||||
import com.volmit.iris.util.Direction;
|
||||
import com.volmit.iris.wand.WandController;
|
||||
import com.volmit.iris.util.MortarCommand;
|
||||
import com.volmit.iris.util.MortarSender;
|
||||
|
||||
public class CommandIrisObjectExpand extends MortarCommand
|
||||
{
|
||||
|
@ -8,9 +8,9 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.wand.WandController;
|
||||
import com.volmit.iris.WandController;
|
||||
import com.volmit.iris.util.MortarCommand;
|
||||
import com.volmit.iris.util.MortarSender;
|
||||
|
||||
public class CommandIrisObjectP1 extends MortarCommand
|
||||
{
|
||||
|
@ -8,9 +8,9 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.wand.WandController;
|
||||
import com.volmit.iris.WandController;
|
||||
import com.volmit.iris.util.MortarCommand;
|
||||
import com.volmit.iris.util.MortarSender;
|
||||
|
||||
public class CommandIrisObjectP2 extends MortarCommand
|
||||
{
|
||||
|
@ -11,10 +11,10 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.WandController;
|
||||
import com.volmit.iris.object.IrisObject;
|
||||
import com.volmit.iris.wand.WandController;
|
||||
import com.volmit.iris.util.MortarCommand;
|
||||
import com.volmit.iris.util.MortarSender;
|
||||
|
||||
public class CommandIrisObjectPaste extends MortarCommand
|
||||
{
|
||||
|
@ -8,10 +8,10 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.WandController;
|
||||
import com.volmit.iris.object.IrisObject;
|
||||
import com.volmit.iris.wand.WandController;
|
||||
import com.volmit.iris.util.MortarCommand;
|
||||
import com.volmit.iris.util.MortarSender;
|
||||
|
||||
public class CommandIrisObjectSave extends MortarCommand
|
||||
{
|
||||
@ -38,14 +38,14 @@ public class CommandIrisObjectSave extends MortarCommand
|
||||
|
||||
try
|
||||
{
|
||||
o.write(new File(Iris.instance.getDataFolder(), "objects/" + args[1] + ".iob"));
|
||||
sender.sendMessage("Saved " + "objects/" + args[1] + ".iob");
|
||||
o.write(new File(Iris.instance.getDataFolder(), "objects/" + args[0] + ".iob"));
|
||||
sender.sendMessage("Saved " + "objects/" + args[0] + ".iob");
|
||||
p.getWorld().playSound(p.getLocation(), Sound.BLOCK_ENCHANTMENT_TABLE_USE, 1f, 1.5f);
|
||||
}
|
||||
|
||||
catch(IOException e)
|
||||
{
|
||||
sender.sendMessage("Failed to save " + "objects/" + args[1] + ".iob. Are you holding your wand?");
|
||||
sender.sendMessage("Failed to save " + "objects/" + args[0] + ".iob. Are you holding your wand?");
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -5,11 +5,11 @@ import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.WandController;
|
||||
import com.volmit.iris.util.Cuboid;
|
||||
import com.volmit.iris.util.Direction;
|
||||
import com.volmit.iris.wand.WandController;
|
||||
import com.volmit.iris.util.MortarCommand;
|
||||
import com.volmit.iris.util.MortarSender;
|
||||
|
||||
public class CommandIrisObjectShift extends MortarCommand
|
||||
{
|
||||
|
@ -3,9 +3,9 @@ package com.volmit.iris.command;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.wand.WandController;
|
||||
import com.volmit.iris.WandController;
|
||||
import com.volmit.iris.util.MortarCommand;
|
||||
import com.volmit.iris.util.MortarSender;
|
||||
|
||||
public class CommandIrisObjectWand extends MortarCommand
|
||||
{
|
||||
|
@ -7,11 +7,11 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.WandController;
|
||||
import com.volmit.iris.util.Cuboid;
|
||||
import com.volmit.iris.util.MortarCommand;
|
||||
import com.volmit.iris.util.MortarSender;
|
||||
import com.volmit.iris.util.Cuboid.CuboidDirection;
|
||||
import com.volmit.iris.wand.WandController;
|
||||
|
||||
public class CommandIrisObjectXAY extends MortarCommand
|
||||
{
|
||||
|
@ -7,11 +7,11 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.WandController;
|
||||
import com.volmit.iris.util.Cuboid;
|
||||
import com.volmit.iris.util.MortarCommand;
|
||||
import com.volmit.iris.util.MortarSender;
|
||||
import com.volmit.iris.util.Cuboid.CuboidDirection;
|
||||
import com.volmit.iris.wand.WandController;
|
||||
|
||||
public class CommandIrisObjectXPY extends MortarCommand
|
||||
{
|
||||
|
@ -1,9 +1,9 @@
|
||||
package com.volmit.iris.command;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.Command;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.util.Command;
|
||||
import com.volmit.iris.util.MortarCommand;
|
||||
import com.volmit.iris.util.MortarSender;
|
||||
|
||||
public class CommandIrisStudio extends MortarCommand
|
||||
{
|
||||
|
@ -5,8 +5,8 @@ import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.util.MortarCommand;
|
||||
import com.volmit.iris.util.MortarSender;
|
||||
|
||||
public class CommandIrisStudioClose extends MortarCommand
|
||||
{
|
||||
|
@ -4,8 +4,6 @@ import java.io.IOException;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.object.InterpolationMethod;
|
||||
import com.volmit.iris.object.IrisBiome;
|
||||
import com.volmit.iris.object.IrisBiomeGeneratorLink;
|
||||
@ -17,6 +15,8 @@ import com.volmit.iris.util.Form;
|
||||
import com.volmit.iris.util.IO;
|
||||
import com.volmit.iris.util.JSONException;
|
||||
import com.volmit.iris.util.JSONObject;
|
||||
import com.volmit.iris.util.MortarCommand;
|
||||
import com.volmit.iris.util.MortarSender;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
@ -43,6 +43,12 @@ public class CommandIrisStudioCreate extends MortarCommand
|
||||
IrisDimension dimension = new IrisDimension();
|
||||
dimension.setLoadKey(args[0]);
|
||||
dimension.setName(Form.capitalizeWords(args[0].replaceAll("\\Q-\\E", " ")));
|
||||
|
||||
if(Iris.instance.getDataFile("packs", dimension.getLoadKey(), "dimensions", dimension.getLoadKey() + ".json").exists())
|
||||
{
|
||||
sender.sendMessage("Project Already Exists! Open it instead!");
|
||||
return true;
|
||||
}
|
||||
sender.sendMessage("Creating New Project \"" + dimension.getName() + "\"...");
|
||||
IrisRegion exampleRegion = new IrisRegion();
|
||||
exampleRegion.setName("Example Region");
|
||||
|
@ -3,9 +3,9 @@ package com.volmit.iris.command;
|
||||
import java.io.File;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.object.IrisDimension;
|
||||
import com.volmit.iris.util.MortarCommand;
|
||||
import com.volmit.iris.util.MortarSender;
|
||||
|
||||
public class CommandIrisStudioList extends MortarCommand
|
||||
{
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.volmit.iris.command;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.util.MortarCommand;
|
||||
import com.volmit.iris.util.MortarSender;
|
||||
|
||||
public class CommandIrisStudioOpen extends MortarCommand
|
||||
{
|
||||
|
@ -7,8 +7,6 @@ import org.zeroturnaround.zip.ZipUtil;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.object.IrisBiome;
|
||||
import com.volmit.iris.object.IrisDimension;
|
||||
import com.volmit.iris.object.IrisGenerator;
|
||||
@ -20,6 +18,8 @@ import com.volmit.iris.util.JSONObject;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.KMap;
|
||||
import com.volmit.iris.util.KSet;
|
||||
import com.volmit.iris.util.MortarCommand;
|
||||
import com.volmit.iris.util.MortarSender;
|
||||
|
||||
public class CommandIrisStudioPackage extends MortarCommand
|
||||
{
|
||||
|
@ -6,11 +6,11 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.IrisMetrics;
|
||||
import com.volmit.iris.command.util.Command;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.generator.IrisChunkGenerator;
|
||||
import com.volmit.iris.gen.IrisChunkGenerator;
|
||||
import com.volmit.iris.util.Command;
|
||||
import com.volmit.iris.util.Form;
|
||||
import com.volmit.iris.util.MortarCommand;
|
||||
import com.volmit.iris.util.MortarSender;
|
||||
|
||||
public class CommandIrisWhat extends MortarCommand
|
||||
{
|
||||
|
@ -6,8 +6,8 @@ import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.util.MortarCommand;
|
||||
import com.volmit.iris.util.MortarSender;
|
||||
|
||||
public class CommandIrisWhatBlock extends MortarCommand
|
||||
{
|
||||
|
@ -6,8 +6,8 @@ import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.util.MortarCommand;
|
||||
import com.volmit.iris.util.MortarSender;
|
||||
|
||||
public class CommandIrisWhatHand extends MortarCommand
|
||||
{
|
||||
|
@ -1,9 +1,9 @@
|
||||
package com.volmit.iris.command;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.Command;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.util.Command;
|
||||
import com.volmit.iris.util.MortarCommand;
|
||||
import com.volmit.iris.util.MortarSender;
|
||||
|
||||
public class CommandIrisWorld extends MortarCommand
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.volmit.iris.command;
|
||||
|
||||
import com.volmit.iris.command.util.MortarPermission;
|
||||
import com.volmit.iris.command.util.Permission;
|
||||
import com.volmit.iris.util.MortarPermission;
|
||||
import com.volmit.iris.util.Permission;
|
||||
|
||||
public class PermissionIris extends MortarPermission
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.volmit.iris.command;
|
||||
|
||||
import com.volmit.iris.command.util.MortarPermission;
|
||||
import com.volmit.iris.util.MortarPermission;
|
||||
|
||||
public class PermissionIrisStudio extends MortarPermission
|
||||
{
|
||||
|
@ -2,6 +2,7 @@ package com.volmit.iris.object;
|
||||
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.M;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@ -47,10 +48,14 @@ public class IrisAxisRotationClamp
|
||||
{
|
||||
if(isUnlimited())
|
||||
{
|
||||
return Math.toRadians((rng * interval) % 360D);
|
||||
if(interval < 1)
|
||||
{
|
||||
interval = 1;
|
||||
}
|
||||
|
||||
return Math.toRadians(((double) interval * (Math.ceil(Math.abs((rng % 360D) / (double) interval)))) % 360D);
|
||||
}
|
||||
|
||||
double deg = min + (rng * interval) % (Math.abs(max - min) / 360D);
|
||||
return Math.toRadians(deg);
|
||||
return Math.toRadians(M.clip(((double) interval * (Math.ceil(Math.abs((rng % 360D) / (double) interval)))) % 360D, Math.min(min, max), Math.max(min, max)));
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||
import org.bukkit.util.BlockVector;
|
||||
|
||||
import com.volmit.iris.generator.TerrainChunkGenerator;
|
||||
import com.volmit.iris.gen.TerrainChunkGenerator;
|
||||
import com.volmit.iris.util.BlockDataTools;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
|
@ -7,7 +7,7 @@ import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.util.BlockVector;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.generator.PostBlockChunkGenerator;
|
||||
import com.volmit.iris.gen.PostBlockChunkGenerator;
|
||||
import com.volmit.iris.util.BlockDataTools;
|
||||
import com.volmit.iris.util.CNG;
|
||||
import com.volmit.iris.util.ChunkPosition;
|
||||
|
@ -127,12 +127,10 @@ public class IrisObject extends IrisRegistrant
|
||||
|
||||
public void place(int x, int yv, int z, IObjectPlacer placer, IrisObjectPlacement config, RNG rng)
|
||||
{
|
||||
boolean yf = rng.nextBoolean();
|
||||
boolean xf = rng.nextBoolean();
|
||||
int spinx = rng.imax() / 1000;
|
||||
int spiny = rng.imax() / 1000;
|
||||
int spinz = rng.imax() / 1000;
|
||||
int y = yv < 0 ? placer.getHighest(x, z, config.isUnderwater()) + config.getRotation().rotate(new BlockVector(0, getCenter().getBlockY(), 0), yf, xf, spinx, spiny, spinz).getBlockY() : yv;
|
||||
int y = yv < 0 ? placer.getHighest(x, z, config.isUnderwater()) + config.getRotation().rotate(new BlockVector(0, getCenter().getBlockY(), 0), spinx, spiny, spinz).getBlockY() : yv;
|
||||
KMap<ChunkPosition, Integer> heightmap = config.getSnow() > 0 ? new KMap<>() : null;
|
||||
|
||||
if(yv < 0)
|
||||
@ -146,9 +144,9 @@ public class IrisObject extends IrisRegistrant
|
||||
for(BlockVector g : blocks.keySet())
|
||||
{
|
||||
BlockVector i = g.clone();
|
||||
i = config.getRotation().rotate(i.clone(), yf, xf, spinx, spiny, spinz).clone();
|
||||
i = config.getRotation().rotate(i.clone(), spinx, spiny, spinz).clone();
|
||||
i = config.getTranslate().translate(i.clone()).clone();
|
||||
BlockData data = blocks.get(g);
|
||||
BlockData data = blocks.get(g).clone();
|
||||
|
||||
if(placer.isPreventingDecay() && data instanceof Leaves && !((Leaves) data).isPersistent())
|
||||
{
|
||||
@ -163,6 +161,7 @@ public class IrisObject extends IrisRegistrant
|
||||
}
|
||||
}
|
||||
|
||||
data = config.getRotation().rotate(data, spinx, spiny, spinz);
|
||||
int xx = x + (int) Math.round(i.getX());
|
||||
int yy = y + (int) Math.round(i.getY());
|
||||
int zz = z + (int) Math.round(i.getZ());
|
||||
|
@ -1,9 +1,17 @@
|
||||
package com.volmit.iris.object;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.Directional;
|
||||
import org.bukkit.block.data.MultipleFacing;
|
||||
import org.bukkit.block.data.Rotatable;
|
||||
import org.bukkit.util.BlockVector;
|
||||
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.KList;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@ -14,7 +22,7 @@ public class IrisObjectRotation
|
||||
@DontObfuscate
|
||||
@Desc("If this rotator is enabled or not")
|
||||
private boolean enabled = true;
|
||||
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("The x axis rotation")
|
||||
private IrisAxisRotationClamp xAxis = new IrisAxisRotationClamp();
|
||||
@ -62,7 +70,117 @@ public class IrisObjectRotation
|
||||
return clamp.getRadians(spin);
|
||||
}
|
||||
|
||||
public BlockVector rotate(BlockVector b, boolean yf, boolean xf, int spinx, int spiny, int spinz)
|
||||
public BlockFace getFace(BlockVector v)
|
||||
{
|
||||
int x = (int) Math.round(v.getX());
|
||||
int y = (int) Math.round(v.getY());
|
||||
int z = (int) Math.round(v.getZ());
|
||||
|
||||
if(x == 0 && z == -1)
|
||||
{
|
||||
return BlockFace.NORTH;
|
||||
}
|
||||
|
||||
if(x == 0 && z == 1)
|
||||
{
|
||||
return BlockFace.SOUTH;
|
||||
}
|
||||
|
||||
if(x == 1 && z == 0)
|
||||
{
|
||||
return BlockFace.EAST;
|
||||
}
|
||||
|
||||
if(x == -1 && z == 0)
|
||||
{
|
||||
return BlockFace.WEST;
|
||||
}
|
||||
|
||||
if(y > 0)
|
||||
{
|
||||
return BlockFace.UP;
|
||||
}
|
||||
|
||||
if(y < 0)
|
||||
{
|
||||
return BlockFace.DOWN;
|
||||
}
|
||||
|
||||
return BlockFace.SOUTH;
|
||||
}
|
||||
|
||||
public BlockData rotate(BlockData d, int spinxx, int spinyy, int spinzz)
|
||||
{
|
||||
int spinx = (int) (90D * (Math.ceil(Math.abs((spinxx % 360D) / 90D))));
|
||||
int spiny = (int) (90D * (Math.ceil(Math.abs((spinyy % 360D) / 90D))));
|
||||
int spinz = (int) (90D * (Math.ceil(Math.abs((spinzz % 360D) / 90D))));
|
||||
|
||||
if(!canRotate())
|
||||
{
|
||||
return d;
|
||||
}
|
||||
|
||||
if(d instanceof Directional)
|
||||
{
|
||||
Directional g = ((Directional) d);
|
||||
BlockFace f = g.getFacing();
|
||||
BlockVector bv = new BlockVector(f.getModX(), f.getModY(), f.getModZ());
|
||||
bv = rotate(bv.clone(), spinx, spiny, spinz);
|
||||
BlockFace t = getFace(bv);
|
||||
|
||||
if(g.getFaces().contains(t))
|
||||
{
|
||||
g.setFacing(t);
|
||||
}
|
||||
|
||||
else if(!g.getMaterial().isSolid())
|
||||
{
|
||||
d = null;
|
||||
}
|
||||
}
|
||||
|
||||
else if(d instanceof Rotatable)
|
||||
{
|
||||
Rotatable g = ((Rotatable) d);
|
||||
BlockFace f = g.getRotation();
|
||||
BlockVector bv = new BlockVector(f.getModX(), f.getModY(), f.getModZ());
|
||||
bv = rotate(bv.clone(), spinx, spiny, spinz);
|
||||
BlockFace t = getFace(bv);
|
||||
g.setRotation(t);
|
||||
}
|
||||
|
||||
else if(d instanceof MultipleFacing)
|
||||
{
|
||||
List<BlockFace> faces = new KList<>();
|
||||
MultipleFacing g = (MultipleFacing) d;
|
||||
|
||||
for(BlockFace i : g.getFaces())
|
||||
{
|
||||
BlockVector bv = new BlockVector(i.getModX(), i.getModY(), i.getModZ());
|
||||
bv = rotate(bv.clone(), spinx, spiny, spinz);
|
||||
BlockFace r = getFace(bv);
|
||||
|
||||
if(g.getAllowedFaces().contains(r))
|
||||
{
|
||||
faces.add(r);
|
||||
}
|
||||
}
|
||||
|
||||
for(BlockFace i : g.getFaces())
|
||||
{
|
||||
g.setFace(i, false);
|
||||
}
|
||||
|
||||
for(BlockFace i : faces)
|
||||
{
|
||||
g.setFace(i, true);
|
||||
}
|
||||
}
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
public BlockVector rotate(BlockVector b, int spinx, int spiny, int spinz)
|
||||
{
|
||||
if(!canRotate())
|
||||
{
|
||||
@ -71,12 +189,7 @@ public class IrisObjectRotation
|
||||
|
||||
BlockVector v = b.clone();
|
||||
|
||||
if(yf && canRotateY())
|
||||
{
|
||||
v.rotateAroundY(getYRotation(spiny));
|
||||
}
|
||||
|
||||
if(xf && canRotateX())
|
||||
if(canRotateX())
|
||||
{
|
||||
v.rotateAroundX(getXRotation(spinx));
|
||||
}
|
||||
@ -86,12 +199,7 @@ public class IrisObjectRotation
|
||||
v.rotateAroundZ(getZRotation(spinz));
|
||||
}
|
||||
|
||||
if(!xf && canRotateX())
|
||||
{
|
||||
v.rotateAroundX(getXRotation(spinx));
|
||||
}
|
||||
|
||||
if(!yf && canRotateY())
|
||||
if(canRotateY())
|
||||
{
|
||||
v.rotateAroundY(getYRotation(spiny));
|
||||
}
|
||||
|
@ -1,44 +0,0 @@
|
||||
package com.volmit.iris.tetris;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TetrisGenerator
|
||||
{
|
||||
private int gridSize;
|
||||
|
||||
public int getGrid(int block)
|
||||
{
|
||||
return (int) Math.floor((double) block / (double) gridSize);
|
||||
}
|
||||
|
||||
public int getCenterFromGrid(int grid)
|
||||
{
|
||||
return (grid * gridSize) + (gridSize / 2);
|
||||
}
|
||||
|
||||
public int getCenterFromBlock(int block)
|
||||
{
|
||||
return getCenterFromGrid(getGrid(block));
|
||||
}
|
||||
|
||||
public int getMinFromGrid(int grid)
|
||||
{
|
||||
return (grid * gridSize);
|
||||
}
|
||||
|
||||
public int getMinFromBlock(int block)
|
||||
{
|
||||
return getMinFromGrid(getGrid(block));
|
||||
}
|
||||
|
||||
public int getMaxFromGrid(int grid)
|
||||
{
|
||||
return ((grid + 1) * gridSize) - 1;
|
||||
}
|
||||
|
||||
public int getMaxFromBlock(int block)
|
||||
{
|
||||
return getMaxFromGrid(getGrid(block));
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
package com.volmit.iris.tetris;
|
||||
|
||||
import com.volmit.iris.util.BlockPosition;
|
||||
import com.volmit.iris.util.KMap;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TetrisObject
|
||||
{
|
||||
private int x;
|
||||
private int y;
|
||||
private int z;
|
||||
private KMap<BlockPosition, BlockPosition> holes;
|
||||
|
||||
public TetrisObject(int x, int y, int z)
|
||||
{
|
||||
holes = new KMap<>();
|
||||
}
|
||||
}
|
@ -77,4 +77,38 @@ public class BlockDataTools
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean canPlaceOnto(Material mat, Material onto)
|
||||
{
|
||||
if(onto.equals(Material.GRASS_BLOCK) && mat.equals(Material.DEAD_BUSH))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(onto.equals(Material.GRASS_PATH))
|
||||
{
|
||||
if(!mat.isSolid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(onto.equals(Material.STONE) || onto.equals(Material.GRAVEL) || onto.equals(Material.GRAVEL) || onto.equals(Material.ANDESITE) || onto.equals(Material.GRANITE) || onto.equals(Material.DIORITE) || onto.equals(Material.BLACKSTONE) || onto.equals(Material.BASALT))
|
||||
{
|
||||
if(mat.equals(Material.POPPY) || mat.equals(Material.DANDELION) || mat.equals(Material.CORNFLOWER) || mat.equals(Material.ORANGE_TULIP) || mat.equals(Material.PINK_TULIP) || mat.equals(Material.RED_TULIP) || mat.equals(Material.WHITE_TULIP) || mat.equals(Material.FERN) || mat.equals(Material.LARGE_FERN) || mat.equals(Material.GRASS) || mat.equals(Material.TALL_GRASS))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(onto.equals(Material.ACACIA_LEAVES) || onto.equals(Material.BIRCH_LEAVES) || onto.equals(Material.DARK_OAK_LEAVES) || onto.equals(Material.JUNGLE_LEAVES) || onto.equals(Material.OAK_LEAVES) || onto.equals(Material.SPRUCE_LEAVES))
|
||||
{
|
||||
if(!mat.isSolid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import com.volmit.iris.generator.DimensionChunkGenerator;
|
||||
import com.volmit.iris.gen.DimensionChunkGenerator;
|
||||
|
||||
public abstract class GenLayer
|
||||
{
|
||||
|
@ -6,8 +6,8 @@ import org.bukkit.block.data.Levelled;
|
||||
import org.bukkit.block.data.Waterlogged;
|
||||
import org.bukkit.block.data.type.Slab;
|
||||
|
||||
import com.volmit.iris.generator.PostBlockChunkGenerator;
|
||||
import com.volmit.iris.layer.post.Post;
|
||||
import com.volmit.iris.gen.PostBlockChunkGenerator;
|
||||
import com.volmit.iris.gen.post.Post;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user