mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-06-18 06:41:08 +00:00
Merge branch 'fix_jigsaw' of https://github.com/VolmitDev/Iris into PixelatedDev
This commit is contained in:
@@ -34,6 +34,7 @@ import com.volmit.iris.util.decree.specialhandlers.ObjectHandler;
|
|||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import com.volmit.iris.util.format.Form;
|
import com.volmit.iris.util.format.Form;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -56,8 +57,9 @@ public class CommandJigsaw implements DecreeExecutor {
|
|||||||
) {
|
) {
|
||||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||||
PlannedStructure ps = new PlannedStructure(structure, new IrisPosition(player().getLocation()), new RNG());
|
PlannedStructure ps = new PlannedStructure(structure, new IrisPosition(player().getLocation()), new RNG());
|
||||||
sender().sendMessage(C.GREEN + "Generated " + ps.getPieces().size() + " pieces in " + Form.duration(p.getMilliseconds(), 2));
|
VolmitSender sender = sender();
|
||||||
ps.place(world(), failed -> sender().sendMessage(failed == 0 ? C.GREEN + "Placed the structure!" : C.RED + "Failed to place " + failed + " pieces!"));
|
sender.sendMessage(C.GREEN + "Generated " + ps.getPieces().size() + " pieces in " + Form.duration(p.getMilliseconds(), 2));
|
||||||
|
ps.place(world(), failed -> sender.sendMessage(failed == 0 ? C.GREEN + "Placed the structure!" : C.RED + "Failed to place " + failed + " pieces!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Decree(description = "Create a jigsaw piece")
|
@Decree(description = "Create a jigsaw piece")
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import com.volmit.iris.util.math.AxisAlignedBB;
|
|||||||
import com.volmit.iris.util.math.BlockPosition;
|
import com.volmit.iris.util.math.BlockPosition;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@@ -50,10 +51,12 @@ public class PlannedPiece {
|
|||||||
private IrisObject ogObject;
|
private IrisObject ogObject;
|
||||||
private IrisJigsawPiece piece;
|
private IrisJigsawPiece piece;
|
||||||
private IrisObjectRotation rotation;
|
private IrisObjectRotation rotation;
|
||||||
|
@EqualsAndHashCode.Exclude
|
||||||
private IrisData data;
|
private IrisData data;
|
||||||
private KList<IrisJigsawPieceConnector> connected;
|
private KList<IrisJigsawPieceConnector> connected;
|
||||||
private boolean dead = false;
|
private boolean dead = false;
|
||||||
private AxisAlignedBB box;
|
private AxisAlignedBB box;
|
||||||
|
@EqualsAndHashCode.Exclude
|
||||||
private PlannedStructure structure;
|
private PlannedStructure structure;
|
||||||
|
|
||||||
public PlannedPiece(PlannedStructure structure, IrisPosition position, IrisJigsawPiece piece) {
|
public PlannedPiece(PlannedStructure structure, IrisPosition position, IrisJigsawPiece piece) {
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import com.volmit.iris.util.math.RNG;
|
|||||||
import com.volmit.iris.util.matter.slices.container.JigsawPieceContainer;
|
import com.volmit.iris.util.matter.slices.container.JigsawPieceContainer;
|
||||||
import com.volmit.iris.util.matter.slices.container.JigsawStructuresContainer;
|
import com.volmit.iris.util.matter.slices.container.JigsawStructuresContainer;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import org.bukkit.Axis;
|
import org.bukkit.Axis;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
|
||||||
@@ -319,6 +320,10 @@ public class PlannedStructure {
|
|||||||
|
|
||||||
public boolean collidesWith(PlannedPiece piece, PlannedPiece ignore) {
|
public boolean collidesWith(PlannedPiece piece, PlannedPiece ignore) {
|
||||||
for (PlannedPiece i : pieces) {
|
for (PlannedPiece i : pieces) {
|
||||||
|
if (i.equals(ignore)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (i.collidesWith(piece)) {
|
if (i.collidesWith(piece)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -279,6 +279,8 @@ public class IrisObject extends IrisRegistrant {
|
|||||||
public synchronized IrisObject copy() {
|
public synchronized IrisObject copy() {
|
||||||
IrisObject o = new IrisObject(w, h, d);
|
IrisObject o = new IrisObject(w, h, d);
|
||||||
o.setLoadKey(o.getLoadKey());
|
o.setLoadKey(o.getLoadKey());
|
||||||
|
o.setLoader(getLoader());
|
||||||
|
o.setLoadFile(getLoadFile());
|
||||||
o.setCenter(getCenter().clone());
|
o.setCenter(getCenter().clone());
|
||||||
|
|
||||||
for (BlockVector i : getBlocks().keySet()) {
|
for (BlockVector i : getBlocks().keySet()) {
|
||||||
@@ -898,6 +900,7 @@ public class IrisObject extends IrisRegistrant {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
Iris.reportError(e);
|
Iris.reportError(e);
|
||||||
}
|
}
|
||||||
readLock.unlock();
|
readLock.unlock();
|
||||||
|
|||||||
Reference in New Issue
Block a user