mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-31 04:46:40 +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.Form;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
||||
|
||||
import java.io.File;
|
||||
@@ -56,8 +57,9 @@ public class CommandJigsaw implements DecreeExecutor {
|
||||
) {
|
||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||
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));
|
||||
ps.place(world(), failed -> sender().sendMessage(failed == 0 ? C.GREEN + "Placed the structure!" : C.RED + "Failed to place " + failed + " pieces!"));
|
||||
VolmitSender sender = sender();
|
||||
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")
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.volmit.iris.util.math.AxisAlignedBB;
|
||||
import com.volmit.iris.util.math.BlockPosition;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
@@ -50,10 +51,12 @@ public class PlannedPiece {
|
||||
private IrisObject ogObject;
|
||||
private IrisJigsawPiece piece;
|
||||
private IrisObjectRotation rotation;
|
||||
@EqualsAndHashCode.Exclude
|
||||
private IrisData data;
|
||||
private KList<IrisJigsawPieceConnector> connected;
|
||||
private boolean dead = false;
|
||||
private AxisAlignedBB box;
|
||||
@EqualsAndHashCode.Exclude
|
||||
private PlannedStructure structure;
|
||||
|
||||
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.JigsawStructuresContainer;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.bukkit.Axis;
|
||||
import org.bukkit.World;
|
||||
|
||||
@@ -319,6 +320,10 @@ public class PlannedStructure {
|
||||
|
||||
public boolean collidesWith(PlannedPiece piece, PlannedPiece ignore) {
|
||||
for (PlannedPiece i : pieces) {
|
||||
if (i.equals(ignore)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (i.collidesWith(piece)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -279,6 +279,8 @@ public class IrisObject extends IrisRegistrant {
|
||||
public synchronized IrisObject copy() {
|
||||
IrisObject o = new IrisObject(w, h, d);
|
||||
o.setLoadKey(o.getLoadKey());
|
||||
o.setLoader(getLoader());
|
||||
o.setLoadFile(getLoadFile());
|
||||
o.setCenter(getCenter().clone());
|
||||
|
||||
for (BlockVector i : getBlocks().keySet()) {
|
||||
@@ -898,6 +900,7 @@ public class IrisObject extends IrisRegistrant {
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
Iris.reportError(e);
|
||||
}
|
||||
readLock.unlock();
|
||||
|
||||
Reference in New Issue
Block a user