Merge branch 'pr/385'

This commit is contained in:
DanLT 2021-06-22 09:02:28 -08:00
commit b00faf3930
11 changed files with 124 additions and 114 deletions

View File

@ -10,23 +10,12 @@ def apiVersion = '1.14'
def name = '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('ArcaneArts', 'C://Users/arcane/Documents/development/server/plugins');
// ==============================================================
def registerCustomOutputTask(name, path) {
tasks.register('build' + name, Copy) {
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")
}
}
configurations {
provided
}
processResources {
@ -41,11 +30,12 @@ processResources {
}
repositories {
mavenCentral()
gradlePluginPortal()
maven {
allowInsecureProtocol true
url "http://archive.arcane.art/repository/arcane"
url "http://archive.arcane.art/repository/arcane/"
}
mavenLocal()
}
shadowJar
@ -66,14 +56,11 @@ dependencies {
implementation 'com.github.ben-manes.caffeine:caffeine:3.0.2'
implementation 'org.zeroturnaround:zt-zip:1.14'
implementation 'io.papermc:paperlib:1.0.5'
// Provided
implementation 'org.spigotmc:spigot-api:1.17-R0.1-SNAPSHOT'
implementation 'org.bukkit.craftbukkit:1.16.3:1.16.3'
implementation 'org.bukkit.craftbukkit:1.16.4:1.16.4'
implementation 'org.bukkit.craftbukkit:1.17:1.17'
implementation 'com.bergerkiller.bukkit:BKCommonLib:1.16.4-v2'
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'
compileClasspath 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT'
compileClasspath 'org.bukkit.craftbukkit:1.16.3:1.16.3'
compileClasspath 'org.bukkit.craftbukkit:1.16.4:1.16.4'
compileClasspath 'com.bergerkiller.bukkit:BKCommonLib:1.16.4-v2'
compileClasspath 'com.sk89q.worldedit:worldedit-bukkit:7.2.0-SNAPSHOT'
compileClasspath 'io.lumine.xikage:MythicMobs:4.9.1'
compileClasspath 'com.google.code.gson:gson:2.8.5'
}

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
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
zipStorePath=wrapper/dists

View File

@ -53,8 +53,11 @@ public class CommandIrisJigsawEdit extends MortarCommand
{
File dest = piece.getLoadFile();
new JigsawEditor(sender.player(), piece, IrisDataManager.loadAnyObject(piece.getObject()), dest);
return true;
}
sender.sendMessage("Failed to find existing jigsaw piece: " + args[0]);
return true;
}

View File

@ -48,6 +48,12 @@ public class CommandIrisJigsawNew extends MortarCommand
}
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");
new JigsawEditor(sender.player(), null, object, dest);
sender.sendMessage("* Right Click blocks to make them connectors");

View File

@ -42,6 +42,9 @@ public class CommandIrisStudio extends MortarCommand
@Command
private CommandIrisStudioExplorer exp;
@Command
private CommandIrisStudioExplorerGenerator generator;
@Command
private CommandIrisStudioLoot loot;

View File

@ -2,6 +2,7 @@ package com.volmit.iris.manager.command.studio;
import com.volmit.iris.Iris;
import com.volmit.iris.IrisSettings;
import com.volmit.iris.manager.IrisDataManager;
import com.volmit.iris.manager.gui.NoiseExplorer;
import com.volmit.iris.object.IrisGenerator;
import com.volmit.iris.util.KList;
@ -14,7 +15,7 @@ public class CommandIrisStudioExplorerGenerator extends MortarCommand
public CommandIrisStudioExplorerGenerator()
{
super("generator", "gen", "g");
setDescription("Explore different generators");
setDescription("Preview created noise noises generators");
requiresPermission(Iris.perm.studio);
setCategory("World");
}
@ -39,39 +40,38 @@ public class CommandIrisStudioExplorerGenerator extends MortarCommand
return true;
}
if(!Iris.proj.isProjectOpen())
if (args.length == 0)
{
sender.sendMessage("No project is open");
sender.sendMessage("Specify a generator to preview");
return true;
}
if(args.length == 0)
{
sender.sendMessage("Provide a generator name");
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
{
String g = 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;
generator = IrisDataManager.loadAnyGenerator(args[0]);
}
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
{
sender.sendMessage("Invalid Generator");
}
}
return true;
}
@ -79,6 +79,6 @@ public class CommandIrisStudioExplorerGenerator extends MortarCommand
@Override
protected String getArgsUsage()
{
return "";
return "[generator]";
}
}

View File

@ -55,25 +55,24 @@ public class NoiseExplorer extends JPanel implements MouseWheelListener
int[][] co;
int w = 0;
int h = 0;
static Function2<Double, Double, Double> generator;
Function2<Double, Double, Double> generator;
static double oxp = 0;
static double ozp = 0;
double ox = 0;
double oz = 0;
double ox = 0; //Offset X
double oz = 0; //Offset Y
double mx = 0;
double mz = 0;
static double mxx = 0;
static double mzz = 0;
static boolean down = false;
double lx = Double.MAX_VALUE;
double lz = Double.MAX_VALUE;
double tz = 1D;
double t = 1D;
double lx = Double.MAX_VALUE; //MouseX
double lz = Double.MAX_VALUE; //MouseY
double t;
double tz;
public NoiseExplorer()
{
addMouseWheelListener((MouseWheelListener) this);
addMouseWheelListener(this);
addMouseMotionListener(new MouseMotionListener()
{
@Override
@ -110,7 +109,7 @@ public class NoiseExplorer extends JPanel implements MouseWheelListener
}
scale = scale + ((0.044 * scale) * notches);
scale = scale < 0.00001 ? 0.00001 : scale;
scale = Math.max(scale, 0.00001);
}
@Override
@ -206,7 +205,7 @@ public class NoiseExplorer extends JPanel implements MouseWheelListener
int zz = z;
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)
{
@ -272,7 +271,7 @@ public class NoiseExplorer extends JPanel implements MouseWheelListener
JLayeredPane pane = new JLayeredPane();
nv.setSize(new Dimension(1440, 820));
pane.add(nv, 1, 0);
NoiseExplorer.generator = gen;
nv.generator = gen;
frame.add(pane);
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));
}
catch(IOException e)
{
}
catch(IOException ignored) { }
}
frame.setSize(1440, 820);
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.setSelectedItem("STATIC");
combo.setFocusable(false);
combo.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
combo.addActionListener(e -> {
@SuppressWarnings("unchecked")
String b = (String) (((JComboBox<String>) e.getSource()).getSelectedItem());
NoiseStyle s = NoiseStyle.valueOf(b);
nv.cng = s.create(RNG.r.nextParallelRNG(RNG.r.imax()));
}
});
combo.setSize(500, 30);
@ -326,11 +317,7 @@ public class NoiseExplorer extends JPanel implements MouseWheelListener
{
frame.setIconImage(ImageIO.read(file));
}
catch(IOException e)
{
}
catch(IOException ignored) { }
}
frame.setSize(1440, 820);
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)
{
EventQueue.invokeLater(new Runnable()
{
public void run()
{
createAndShowGUI(gen, genName);
}
});
EventQueue.invokeLater(() -> createAndShowGUI(gen, genName));
}
public static void launch()
{
EventQueue.invokeLater(new Runnable()
{
public void run()
{
createAndShowGUI();
}
});
EventQueue.invokeLater(() -> createAndShowGUI());
}
static class HandScrollListener extends MouseAdapter

View File

@ -80,6 +80,6 @@ public class IrisEntityInitialSpawn
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)));
}
}

View File

@ -157,6 +157,42 @@ public class IrisObjectRotation
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)
{
switch(axis)
@ -242,10 +278,13 @@ public class IrisObjectRotation
{
Rotatable g = ((Rotatable) d);
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);
BlockFace t = getFace(bv);
g.setRotation(t);
BlockFace face = getHexFace(bv);
g.setRotation(face);
}
else if(d instanceof Orientable)

View File

@ -9,6 +9,7 @@ import com.volmit.iris.util.KList;
import com.volmit.iris.util.RNG;
import lombok.Data;
import org.bukkit.World;
import org.bukkit.block.BlockState;
import org.bukkit.block.TileState;
import org.bukkit.block.data.BlockData;
import org.bukkit.util.BlockVector;
@ -20,7 +21,7 @@ public class PlannedPiece {
private IrisJigsawPiece piece;
private IrisObjectRotation rotation;
private IrisDataManager data;
private KList<IrisPosition> connected;
private KList<IrisJigsawPieceConnector> connected;
private boolean dead = false;
private int rotationKey;
private AxisAlignedBB box;
@ -94,7 +95,7 @@ public class PlannedPiece {
for(IrisJigsawPieceConnector i : piece.getConnectors())
{
if(!connected.contains(i.getPosition()))
if(!connected.contains(i))
{
c.add(i);
}
@ -107,17 +108,12 @@ public class PlannedPiece {
{
if(piece.getConnectors().contains(c))
{
return connect(c.getPosition());
return connected.addIfMissing(c);
}
return false;
}
private boolean connect(IrisPosition p)
{
return connected.addIfMissing(p);
}
public IrisPosition getWorldPosition(IrisJigsawPieceConnector c)
{
return getWorldPosition(c.getPosition());
@ -163,7 +159,7 @@ public class PlannedPiece {
@Override
public boolean isSolid(int x, int y, int z) {
return false;
return world.getBlockAt(x,y,z).getType().isSolid();
}
@Override
@ -183,7 +179,9 @@ public class PlannedPiece {
@Override
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());
}

View File

@ -179,7 +179,7 @@ public class PlannedStructure {
}
private void generateOutwards() {
for(PlannedPiece i : getPiecesWithAvailableConnectors().shuffleCopy(rng))
for(PlannedPiece i : getPiecesWithAvailableConnectors().shuffle(rng))
{
if(!generatePieceOutwards(i))
{
@ -317,7 +317,7 @@ public class PlannedStructure {
{
IrisJigsawPiece pi = getData().getJigsawPieceLoader().load(j);
if(terminating && !pi.isTerminal())
if (pi == null || (terminating && !pi.isTerminal()))
{
continue;
}
@ -325,8 +325,7 @@ public class PlannedStructure {
p.addIfMissing(pi);
}
}
return p.shuffleCopy(rng);
return p.shuffle(rng);
}
private void generateStartPiece() {