mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Merge branch 'pr/385'
This commit is contained in:
commit
b00faf3930
37
build.gradle
37
build.gradle
@ -10,23 +10,12 @@ def apiVersion = '1.14'
|
|||||||
def name = 'Iris'
|
def name = 'Iris'
|
||||||
def main = 'com.volmit.iris.Iris'
|
def main = 'com.volmit.iris.Iris'
|
||||||
|
|
||||||
// ADD YOURSELF AS A NEW LINE IF YOU WANT YOUR OWN BUILD TASK GENERATED
|
|
||||||
// ==============================================================
|
// ==============================================================
|
||||||
registerCustomOutputTask('Cyberpwn', 'C://Users/cyberpwn/Documents/development/server/plugins');
|
registerCustomOutputTask('Cyberpwn', 'C://Users/cyberpwn/Documents/development/server/plugins');
|
||||||
registerCustomOutputTask('ArcaneArts', 'C://Users/arcane/Documents/development/server/plugins');
|
|
||||||
// ==============================================================
|
// ==============================================================
|
||||||
|
|
||||||
def registerCustomOutputTask(name, path) {
|
configurations {
|
||||||
tasks.register('build' + name, Copy) {
|
provided
|
||||||
group('development')
|
|
||||||
outputs.upToDateWhen{false}
|
|
||||||
dependsOn ':shadowJar'
|
|
||||||
from(file('build/libs/Iris-' + version + '-all.jar'))
|
|
||||||
into(file(path))
|
|
||||||
rename { String fileName ->
|
|
||||||
fileName.replace('Iris-' + version + '-all.jar', "Iris.jar")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
@ -41,11 +30,12 @@ processResources {
|
|||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
maven {
|
maven {
|
||||||
allowInsecureProtocol true
|
allowInsecureProtocol true
|
||||||
url "http://archive.arcane.art/repository/arcane"
|
url "http://archive.arcane.art/repository/arcane/"
|
||||||
}
|
}
|
||||||
mavenLocal()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
shadowJar
|
shadowJar
|
||||||
@ -66,14 +56,11 @@ dependencies {
|
|||||||
implementation 'com.github.ben-manes.caffeine:caffeine:3.0.2'
|
implementation 'com.github.ben-manes.caffeine:caffeine:3.0.2'
|
||||||
implementation 'org.zeroturnaround:zt-zip:1.14'
|
implementation 'org.zeroturnaround:zt-zip:1.14'
|
||||||
implementation 'io.papermc:paperlib:1.0.5'
|
implementation 'io.papermc:paperlib:1.0.5'
|
||||||
|
compileClasspath 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT'
|
||||||
// Provided
|
compileClasspath 'org.bukkit.craftbukkit:1.16.3:1.16.3'
|
||||||
implementation 'org.spigotmc:spigot-api:1.17-R0.1-SNAPSHOT'
|
compileClasspath 'org.bukkit.craftbukkit:1.16.4:1.16.4'
|
||||||
implementation 'org.bukkit.craftbukkit:1.16.3:1.16.3'
|
compileClasspath 'com.bergerkiller.bukkit:BKCommonLib:1.16.4-v2'
|
||||||
implementation 'org.bukkit.craftbukkit:1.16.4:1.16.4'
|
compileClasspath 'com.sk89q.worldedit:worldedit-bukkit:7.2.0-SNAPSHOT'
|
||||||
implementation 'org.bukkit.craftbukkit:1.17:1.17'
|
compileClasspath 'io.lumine.xikage:MythicMobs:4.9.1'
|
||||||
implementation 'com.bergerkiller.bukkit:BKCommonLib:1.16.4-v2'
|
compileClasspath 'com.google.code.gson:gson:2.8.5'
|
||||||
implementation 'com.sk89q.worldedit:worldedit-bukkit:7.2.0-SNAPSHOT'
|
|
||||||
implementation 'io.lumine.xikage:MythicMobs:4.9.1'
|
|
||||||
implementation 'com.google.code.gson:gson:2.8.5'
|
|
||||||
}
|
}
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
@ -53,8 +53,11 @@ public class CommandIrisJigsawEdit extends MortarCommand
|
|||||||
{
|
{
|
||||||
File dest = piece.getLoadFile();
|
File dest = piece.getLoadFile();
|
||||||
new JigsawEditor(sender.player(), piece, IrisDataManager.loadAnyObject(piece.getObject()), dest);
|
new JigsawEditor(sender.player(), piece, IrisDataManager.loadAnyObject(piece.getObject()), dest);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sender.sendMessage("Failed to find existing jigsaw piece: " + args[0]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +48,12 @@ public class CommandIrisJigsawNew extends MortarCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
IrisObject object = IrisDataManager.loadAnyObject(args[2]);
|
IrisObject object = IrisDataManager.loadAnyObject(args[2]);
|
||||||
|
|
||||||
|
if (object == null) {
|
||||||
|
sender.sendMessage("Failed to find existing object: " + args[2]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
File dest = Iris.instance.getDataFile("packs", args[1], "jigsaw-pieces", args[0] + ".json");
|
File dest = Iris.instance.getDataFile("packs", args[1], "jigsaw-pieces", args[0] + ".json");
|
||||||
new JigsawEditor(sender.player(), null, object, dest);
|
new JigsawEditor(sender.player(), null, object, dest);
|
||||||
sender.sendMessage("* Right Click blocks to make them connectors");
|
sender.sendMessage("* Right Click blocks to make them connectors");
|
||||||
|
@ -42,6 +42,9 @@ public class CommandIrisStudio extends MortarCommand
|
|||||||
@Command
|
@Command
|
||||||
private CommandIrisStudioExplorer exp;
|
private CommandIrisStudioExplorer exp;
|
||||||
|
|
||||||
|
@Command
|
||||||
|
private CommandIrisStudioExplorerGenerator generator;
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
private CommandIrisStudioLoot loot;
|
private CommandIrisStudioLoot loot;
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package com.volmit.iris.manager.command.studio;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.IrisSettings;
|
import com.volmit.iris.IrisSettings;
|
||||||
|
import com.volmit.iris.manager.IrisDataManager;
|
||||||
import com.volmit.iris.manager.gui.NoiseExplorer;
|
import com.volmit.iris.manager.gui.NoiseExplorer;
|
||||||
import com.volmit.iris.object.IrisGenerator;
|
import com.volmit.iris.object.IrisGenerator;
|
||||||
import com.volmit.iris.util.KList;
|
import com.volmit.iris.util.KList;
|
||||||
@ -14,7 +15,7 @@ public class CommandIrisStudioExplorerGenerator extends MortarCommand
|
|||||||
public CommandIrisStudioExplorerGenerator()
|
public CommandIrisStudioExplorerGenerator()
|
||||||
{
|
{
|
||||||
super("generator", "gen", "g");
|
super("generator", "gen", "g");
|
||||||
setDescription("Explore different generators");
|
setDescription("Preview created noise noises generators");
|
||||||
requiresPermission(Iris.perm.studio);
|
requiresPermission(Iris.perm.studio);
|
||||||
setCategory("World");
|
setCategory("World");
|
||||||
}
|
}
|
||||||
@ -39,39 +40,38 @@ public class CommandIrisStudioExplorerGenerator extends MortarCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!Iris.proj.isProjectOpen())
|
|
||||||
{
|
|
||||||
sender.sendMessage("No project is open");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
sender.sendMessage("Provide a generator name");
|
sender.sendMessage("Specify a generator to preview");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IrisGenerator generator;
|
||||||
|
long seed = 12345;
|
||||||
|
|
||||||
|
if (Iris.proj.isProjectOpen())
|
||||||
|
{
|
||||||
|
generator = Iris.proj.getActiveProject().getActiveProvider().getData().getGeneratorLoader().load(args[0]);
|
||||||
|
seed = Iris.proj.getActiveProject().getActiveProvider().getTarget().getWorld().getSeed();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
String g = args[0];
|
generator = IrisDataManager.loadAnyGenerator(args[0]);
|
||||||
IrisGenerator b = Iris.proj.getActiveProject().getActiveProvider().getData().getGeneratorLoader().load(g);
|
|
||||||
|
|
||||||
if(b != null)
|
|
||||||
{
|
|
||||||
NoiseExplorer.launch((x, z) ->
|
|
||||||
{
|
|
||||||
return b.getHeight(x, z, new RNG(Iris.proj.getActiveProject().getActiveProvider().getTarget().getWorld().getSeed()).nextParallelRNG(3245).lmax());
|
|
||||||
}, "Gen: " + b.getLoadKey());
|
|
||||||
|
|
||||||
sender.sendMessage("Opening Noise Explorer for gen " + b.getLoadKey());
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (generator != null)
|
||||||
|
{
|
||||||
|
long finalSeed = seed;
|
||||||
|
NoiseExplorer.launch((x, z) ->
|
||||||
|
generator.getHeight(x, z, new RNG(finalSeed).nextParallelRNG(3245).lmax()), "Gen: " + generator.getLoadKey());
|
||||||
|
|
||||||
|
sender.sendMessage("Opening Noise Explorer for gen " + generator.getLoadKey() + " (" + generator.getLoader().getDataFolder().getName() + ")");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sender.sendMessage("Invalid Generator");
|
sender.sendMessage("Invalid Generator");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -79,6 +79,6 @@ public class CommandIrisStudioExplorerGenerator extends MortarCommand
|
|||||||
@Override
|
@Override
|
||||||
protected String getArgsUsage()
|
protected String getArgsUsage()
|
||||||
{
|
{
|
||||||
return "";
|
return "[generator]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,25 +55,24 @@ public class NoiseExplorer extends JPanel implements MouseWheelListener
|
|||||||
int[][] co;
|
int[][] co;
|
||||||
int w = 0;
|
int w = 0;
|
||||||
int h = 0;
|
int h = 0;
|
||||||
static Function2<Double, Double, Double> generator;
|
Function2<Double, Double, Double> generator;
|
||||||
static double oxp = 0;
|
static double oxp = 0;
|
||||||
static double ozp = 0;
|
static double ozp = 0;
|
||||||
double ox = 0;
|
double ox = 0; //Offset X
|
||||||
double oz = 0;
|
double oz = 0; //Offset Y
|
||||||
double mx = 0;
|
double mx = 0;
|
||||||
double mz = 0;
|
double mz = 0;
|
||||||
static double mxx = 0;
|
static double mxx = 0;
|
||||||
static double mzz = 0;
|
static double mzz = 0;
|
||||||
static boolean down = false;
|
static boolean down = false;
|
||||||
|
double lx = Double.MAX_VALUE; //MouseX
|
||||||
double lx = Double.MAX_VALUE;
|
double lz = Double.MAX_VALUE; //MouseY
|
||||||
double lz = Double.MAX_VALUE;
|
double t;
|
||||||
double tz = 1D;
|
double tz;
|
||||||
double t = 1D;
|
|
||||||
|
|
||||||
public NoiseExplorer()
|
public NoiseExplorer()
|
||||||
{
|
{
|
||||||
addMouseWheelListener((MouseWheelListener) this);
|
addMouseWheelListener(this);
|
||||||
addMouseMotionListener(new MouseMotionListener()
|
addMouseMotionListener(new MouseMotionListener()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@ -110,7 +109,7 @@ public class NoiseExplorer extends JPanel implements MouseWheelListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
scale = scale + ((0.044 * scale) * notches);
|
scale = scale + ((0.044 * scale) * notches);
|
||||||
scale = scale < 0.00001 ? 0.00001 : scale;
|
scale = Math.max(scale, 0.00001);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -206,7 +205,7 @@ public class NoiseExplorer extends JPanel implements MouseWheelListener
|
|||||||
int zz = z;
|
int zz = z;
|
||||||
gx.queue("a", () ->
|
gx.queue("a", () ->
|
||||||
{
|
{
|
||||||
double n = generator != null ? generator.apply(Double.valueOf((xx * ascale) + oxp), Double.valueOf((zz * ascale) + ozp)) : cng.noise((xx * ascale) + oxp, tz, (zz * ascale) + ozp);
|
double n = generator != null ? generator.apply((xx * ascale) + oxp, (zz * ascale) + ozp) : cng.noise((xx * ascale) + oxp, tz, (zz * ascale) + ozp);
|
||||||
|
|
||||||
if(n > 1 || n < 0)
|
if(n > 1 || n < 0)
|
||||||
{
|
{
|
||||||
@ -272,7 +271,7 @@ public class NoiseExplorer extends JPanel implements MouseWheelListener
|
|||||||
JLayeredPane pane = new JLayeredPane();
|
JLayeredPane pane = new JLayeredPane();
|
||||||
nv.setSize(new Dimension(1440, 820));
|
nv.setSize(new Dimension(1440, 820));
|
||||||
pane.add(nv, 1, 0);
|
pane.add(nv, 1, 0);
|
||||||
NoiseExplorer.generator = gen;
|
nv.generator = gen;
|
||||||
frame.add(pane);
|
frame.add(pane);
|
||||||
File file = Iris.getCached("Iris Icon", "https://raw.githubusercontent.com/VolmitSoftware/Iris/master/icon.png");
|
File file = Iris.getCached("Iris Icon", "https://raw.githubusercontent.com/VolmitSoftware/Iris/master/icon.png");
|
||||||
|
|
||||||
@ -282,11 +281,7 @@ public class NoiseExplorer extends JPanel implements MouseWheelListener
|
|||||||
{
|
{
|
||||||
frame.setIconImage(ImageIO.read(file));
|
frame.setIconImage(ImageIO.read(file));
|
||||||
}
|
}
|
||||||
|
catch(IOException ignored) { }
|
||||||
catch(IOException e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
frame.setSize(1440, 820);
|
frame.setSize(1440, 820);
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
@ -301,15 +296,11 @@ public class NoiseExplorer extends JPanel implements MouseWheelListener
|
|||||||
combo = new JComboBox<String>(li.toArray(new String[li.size()]));
|
combo = new JComboBox<String>(li.toArray(new String[li.size()]));
|
||||||
combo.setSelectedItem("STATIC");
|
combo.setSelectedItem("STATIC");
|
||||||
combo.setFocusable(false);
|
combo.setFocusable(false);
|
||||||
combo.addActionListener(new ActionListener()
|
combo.addActionListener(e -> {
|
||||||
{
|
|
||||||
public void actionPerformed(ActionEvent e)
|
|
||||||
{
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
String b = (String) (((JComboBox<String>) e.getSource()).getSelectedItem());
|
String b = (String) (((JComboBox<String>) e.getSource()).getSelectedItem());
|
||||||
NoiseStyle s = NoiseStyle.valueOf(b);
|
NoiseStyle s = NoiseStyle.valueOf(b);
|
||||||
nv.cng = s.create(RNG.r.nextParallelRNG(RNG.r.imax()));
|
nv.cng = s.create(RNG.r.nextParallelRNG(RNG.r.imax()));
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
combo.setSize(500, 30);
|
combo.setSize(500, 30);
|
||||||
@ -326,11 +317,7 @@ public class NoiseExplorer extends JPanel implements MouseWheelListener
|
|||||||
{
|
{
|
||||||
frame.setIconImage(ImageIO.read(file));
|
frame.setIconImage(ImageIO.read(file));
|
||||||
}
|
}
|
||||||
|
catch(IOException ignored) { }
|
||||||
catch(IOException e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
frame.setSize(1440, 820);
|
frame.setSize(1440, 820);
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
@ -338,24 +325,12 @@ public class NoiseExplorer extends JPanel implements MouseWheelListener
|
|||||||
|
|
||||||
public static void launch(Function2<Double, Double, Double> gen, String genName)
|
public static void launch(Function2<Double, Double, Double> gen, String genName)
|
||||||
{
|
{
|
||||||
EventQueue.invokeLater(new Runnable()
|
EventQueue.invokeLater(() -> createAndShowGUI(gen, genName));
|
||||||
{
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
createAndShowGUI(gen, genName);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void launch()
|
public static void launch()
|
||||||
{
|
{
|
||||||
EventQueue.invokeLater(new Runnable()
|
EventQueue.invokeLater(() -> createAndShowGUI());
|
||||||
{
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
createAndShowGUI();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static class HandScrollListener extends MouseAdapter
|
static class HandScrollListener extends MouseAdapter
|
||||||
|
@ -80,6 +80,6 @@ public class IrisEntityInitialSpawn
|
|||||||
|
|
||||||
private Entity spawn100(Engine g, Location at)
|
private Entity spawn100(Engine g, Location at)
|
||||||
{
|
{
|
||||||
return getRealEntity(g).spawn(g, at.clone().add(0, 1, 0), rng.aquire(() -> new RNG(g.getTarget().getWorld().getSeed() + 4)));
|
return getRealEntity(g).spawn(g, at.clone().add(0.5, 1, 0.5), rng.aquire(() -> new RNG(g.getTarget().getWorld().getSeed() + 4)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,6 +157,42 @@ public class IrisObjectRotation
|
|||||||
return BlockFace.SOUTH;
|
return BlockFace.SOUTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BlockFace getHexFace(BlockVector v)
|
||||||
|
{
|
||||||
|
int x = v.getBlockX();
|
||||||
|
int y = v.getBlockY();
|
||||||
|
int z = v.getBlockZ();
|
||||||
|
|
||||||
|
if(x == 0 && z == -1) return BlockFace.NORTH;
|
||||||
|
if(x == 1 && z == -2) return BlockFace.NORTH_NORTH_EAST;
|
||||||
|
if(x == 1 && z == -1) return BlockFace.NORTH_EAST;
|
||||||
|
if(x == 2 && z == -1) return BlockFace.EAST_NORTH_EAST;
|
||||||
|
if(x == 1 && z == 0) return BlockFace.EAST;
|
||||||
|
if(x == 2 && z == 1) return BlockFace.EAST_SOUTH_EAST;
|
||||||
|
if(x == 1 && z == 1) return BlockFace.SOUTH_EAST;
|
||||||
|
if(x == 1 && z == 2) return BlockFace.SOUTH_SOUTH_EAST;
|
||||||
|
if(x == 0 && z == 1) return BlockFace.SOUTH;
|
||||||
|
if(x == -1 && z == 2) return BlockFace.SOUTH_SOUTH_WEST;
|
||||||
|
if(x == -1 && z == 1) return BlockFace.SOUTH_WEST;
|
||||||
|
if(x == -2 && z == 1) return BlockFace.WEST_SOUTH_WEST;
|
||||||
|
if(x == -1 && z == 0) return BlockFace.WEST;
|
||||||
|
if(x == -2 && z == -1) return BlockFace.WEST_NORTH_WEST;
|
||||||
|
if(x == -1 && z == -1) return BlockFace.NORTH_WEST;
|
||||||
|
if(x == -1 && z == -2) return BlockFace.NORTH_NORTH_WEST;
|
||||||
|
|
||||||
|
if(y > 0)
|
||||||
|
{
|
||||||
|
return BlockFace.UP;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(y < 0)
|
||||||
|
{
|
||||||
|
return BlockFace.DOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return BlockFace.SOUTH;
|
||||||
|
}
|
||||||
|
|
||||||
public BlockFace faceForAxis(Axis axis)
|
public BlockFace faceForAxis(Axis axis)
|
||||||
{
|
{
|
||||||
switch(axis)
|
switch(axis)
|
||||||
@ -242,10 +278,13 @@ public class IrisObjectRotation
|
|||||||
{
|
{
|
||||||
Rotatable g = ((Rotatable) d);
|
Rotatable g = ((Rotatable) d);
|
||||||
BlockFace f = g.getRotation();
|
BlockFace f = g.getRotation();
|
||||||
BlockVector bv = new BlockVector(f.getModX(), f.getModY(), f.getModZ());
|
|
||||||
|
BlockVector bv = new BlockVector(f.getModX(), 0, f.getModZ());
|
||||||
bv = rotate(bv.clone(), spinx, spiny, spinz);
|
bv = rotate(bv.clone(), spinx, spiny, spinz);
|
||||||
BlockFace t = getFace(bv);
|
BlockFace face = getHexFace(bv);
|
||||||
g.setRotation(t);
|
|
||||||
|
g.setRotation(face);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(d instanceof Orientable)
|
else if(d instanceof Orientable)
|
||||||
|
@ -9,6 +9,7 @@ import com.volmit.iris.util.KList;
|
|||||||
import com.volmit.iris.util.RNG;
|
import com.volmit.iris.util.RNG;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.TileState;
|
import org.bukkit.block.TileState;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.util.BlockVector;
|
import org.bukkit.util.BlockVector;
|
||||||
@ -20,7 +21,7 @@ public class PlannedPiece {
|
|||||||
private IrisJigsawPiece piece;
|
private IrisJigsawPiece piece;
|
||||||
private IrisObjectRotation rotation;
|
private IrisObjectRotation rotation;
|
||||||
private IrisDataManager data;
|
private IrisDataManager data;
|
||||||
private KList<IrisPosition> connected;
|
private KList<IrisJigsawPieceConnector> connected;
|
||||||
private boolean dead = false;
|
private boolean dead = false;
|
||||||
private int rotationKey;
|
private int rotationKey;
|
||||||
private AxisAlignedBB box;
|
private AxisAlignedBB box;
|
||||||
@ -94,7 +95,7 @@ public class PlannedPiece {
|
|||||||
|
|
||||||
for(IrisJigsawPieceConnector i : piece.getConnectors())
|
for(IrisJigsawPieceConnector i : piece.getConnectors())
|
||||||
{
|
{
|
||||||
if(!connected.contains(i.getPosition()))
|
if(!connected.contains(i))
|
||||||
{
|
{
|
||||||
c.add(i);
|
c.add(i);
|
||||||
}
|
}
|
||||||
@ -107,17 +108,12 @@ public class PlannedPiece {
|
|||||||
{
|
{
|
||||||
if(piece.getConnectors().contains(c))
|
if(piece.getConnectors().contains(c))
|
||||||
{
|
{
|
||||||
return connect(c.getPosition());
|
return connected.addIfMissing(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean connect(IrisPosition p)
|
|
||||||
{
|
|
||||||
return connected.addIfMissing(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
public IrisPosition getWorldPosition(IrisJigsawPieceConnector c)
|
public IrisPosition getWorldPosition(IrisJigsawPieceConnector c)
|
||||||
{
|
{
|
||||||
return getWorldPosition(c.getPosition());
|
return getWorldPosition(c.getPosition());
|
||||||
@ -163,7 +159,7 @@ public class PlannedPiece {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSolid(int x, int y, int z) {
|
public boolean isSolid(int x, int y, int z) {
|
||||||
return false;
|
return world.getBlockAt(x,y,z).getType().isSolid();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -183,7 +179,9 @@ public class PlannedPiece {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTile(int xx, int yy, int zz, TileData<? extends TileState> tile) {
|
public void setTile(int xx, int yy, int zz, TileData<? extends TileState> tile) {
|
||||||
|
BlockState state = world.getBlockAt(xx,yy,zz).getState();
|
||||||
|
tile.toBukkitTry(state);
|
||||||
|
state.update();
|
||||||
}
|
}
|
||||||
}, piece.getPlacementOptions(), new RNG(), getData());
|
}, piece.getPlacementOptions(), new RNG(), getData());
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ public class PlannedStructure {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void generateOutwards() {
|
private void generateOutwards() {
|
||||||
for(PlannedPiece i : getPiecesWithAvailableConnectors().shuffleCopy(rng))
|
for(PlannedPiece i : getPiecesWithAvailableConnectors().shuffle(rng))
|
||||||
{
|
{
|
||||||
if(!generatePieceOutwards(i))
|
if(!generatePieceOutwards(i))
|
||||||
{
|
{
|
||||||
@ -317,7 +317,7 @@ public class PlannedStructure {
|
|||||||
{
|
{
|
||||||
IrisJigsawPiece pi = getData().getJigsawPieceLoader().load(j);
|
IrisJigsawPiece pi = getData().getJigsawPieceLoader().load(j);
|
||||||
|
|
||||||
if(terminating && !pi.isTerminal())
|
if (pi == null || (terminating && !pi.isTerminal()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -325,8 +325,7 @@ public class PlannedStructure {
|
|||||||
p.addIfMissing(pi);
|
p.addIfMissing(pi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return p.shuffle(rng);
|
||||||
return p.shuffleCopy(rng);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateStartPiece() {
|
private void generateStartPiece() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user