mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-03 08:26:11 +00:00
Merge branch 'VolmitSoftware:master' into master
This commit is contained in:
commit
2a9b0a54d9
@ -24,7 +24,7 @@ plugins {
|
||||
id "de.undercouch.download" version "5.0.1"
|
||||
}
|
||||
|
||||
version '2.7.6-1.20.1'
|
||||
version '2.7.7-1.20.1'
|
||||
def nmsVersion = '1.20.1' //[NMS]
|
||||
def apiVersion = '1.20'
|
||||
def specialSourceVersion = '1.11.0' //[NMS]
|
||||
|
@ -36,6 +36,9 @@ import com.volmit.iris.util.context.ChunkContext;
|
||||
import com.volmit.iris.util.context.IrisContext;
|
||||
import com.volmit.iris.util.data.B;
|
||||
import com.volmit.iris.util.data.DataProvider;
|
||||
import com.volmit.iris.util.decree.handlers.JigsawPieceHandler;
|
||||
import com.volmit.iris.util.decree.handlers.JigsawPoolHandler;
|
||||
import com.volmit.iris.util.decree.handlers.JigsawStructureHandler;
|
||||
import com.volmit.iris.util.documentation.BlockCoordinates;
|
||||
import com.volmit.iris.util.documentation.ChunkCoordinates;
|
||||
import com.volmit.iris.util.format.C;
|
||||
@ -54,6 +57,7 @@ import com.volmit.iris.util.parallel.MultiBurst;
|
||||
import com.volmit.iris.util.scheduling.ChronoLatch;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
||||
import com.volmit.iris.util.scheduling.S;
|
||||
import com.volmit.iris.util.stream.ProceduralStream;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import net.minecraft.core.BlockPos;
|
||||
@ -73,9 +77,8 @@ import org.bukkit.inventory.ItemStack;
|
||||
import oshi.util.tuples.Pair;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
@ -774,9 +777,54 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
|
||||
}
|
||||
}
|
||||
|
||||
KList<String> pieces = new KList<>();
|
||||
KList<String> pools = new KList<>();
|
||||
int r = 2;
|
||||
for (int xX = -r; xX <= r; xX++) {
|
||||
for (int zZ = -r; zZ <= r; zZ++) {
|
||||
IrisJigsawStructure structure = getStructureAt((x >> 4) + xX, (z >> 4) + zZ);
|
||||
if (structure != null) {
|
||||
for (String pieceID : structure.getPieces()) {
|
||||
IrisJigsawPiece result = searchAllPieces(pieceID, object, pieces, pools);
|
||||
if (result != null) {
|
||||
pieces.clear();
|
||||
pools.clear();
|
||||
return new PlacedObject(result.getPlacementOptions(), getData().getObjectLoader().load(object), id, x, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
pieces.clear();
|
||||
pools.clear();
|
||||
|
||||
return new PlacedObject(null, getData().getObjectLoader().load(object), id, x, z);
|
||||
}
|
||||
|
||||
private IrisJigsawPiece searchAllPieces(String pieceID, String target, KList<String> pieces, KList<String> pools) {
|
||||
IrisJigsawPiece piece = getData().getJigsawPieceLoader().load(pieceID);
|
||||
if (piece.getObject().equals(target))
|
||||
return piece;
|
||||
|
||||
pieces.add(pieceID);
|
||||
for (IrisJigsawPieceConnector connector : piece.getConnectors()) {
|
||||
for (String poolID : connector.getPools()) {
|
||||
if (pools.contains(poolID))
|
||||
continue;
|
||||
pools.add(poolID);
|
||||
|
||||
for (String pieceId : getData().getJigsawPoolLoader().load(poolID).getPieces()) {
|
||||
if (pieces.contains(pieceId))
|
||||
continue;
|
||||
|
||||
IrisJigsawPiece piece1 = searchAllPieces(pieceId, target, pieces, pools);
|
||||
if (piece1 != null)
|
||||
return piece1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
int getCacheID();
|
||||
|
||||
|
@ -256,7 +256,7 @@ public class PlannedStructure {
|
||||
}
|
||||
|
||||
private void generateStartPiece() {
|
||||
pieces.add(new PlannedPiece(this, position, getData().getJigsawPieceLoader().load(rng.pick(getStructure().getPieces())), 0, rng.nextInt(4), 0));
|
||||
pieces.add(new PlannedPiece(this, position, getData().getJigsawPieceLoader().load(rng.pick(getStructure().getPieces())), 0, getStructure().isDisableInitialRotation() ? 0 : rng.nextInt(4), 0));
|
||||
}
|
||||
|
||||
private void generateTerminators() {
|
||||
|
@ -62,6 +62,9 @@ public class IrisJigsawStructure extends IrisRegistrant {
|
||||
@Desc("Force Y to a specific value")
|
||||
private int lockY = -1;
|
||||
|
||||
@Desc("Set to true to prevent rotating the initial structure piece")
|
||||
private boolean disableInitialRotation = false;
|
||||
|
||||
private transient AtomicCache<Integer> maxDimension = new AtomicCache<>();
|
||||
|
||||
private void loadPool(String p, KList<String> pools, KList<String> pieces) {
|
||||
|
@ -255,7 +255,7 @@ public class IrisObjectPlacement {
|
||||
|
||||
if (B.isStorageChest(data)) {
|
||||
IrisLootTable picked = null;
|
||||
if (cache.exact.containsKey(data.getMaterial()) && cache.exact.containsKey(data)) {
|
||||
if (cache.exact.containsKey(data.getMaterial()) && cache.exact.get(data.getMaterial()).containsKey(data)) {
|
||||
picked = cache.exact.get(data.getMaterial()).get(data).pullRandom();
|
||||
} else if (cache.basic.containsKey(data.getMaterial())) {
|
||||
picked = cache.basic.get(data.getMaterial()).pullRandom();
|
||||
|
Loading…
x
Reference in New Issue
Block a user