fixed search positions overhead
This commit is contained in:
@@ -14,6 +14,13 @@ import java.util.Map;
|
|||||||
|
|
||||||
public abstract class AbstractTempleFinder extends Finder {
|
public abstract class AbstractTempleFinder extends Finder {
|
||||||
|
|
||||||
|
protected static List<BlockPos> SEARCH_POSITIONS = buildSearchPositions(CHUNK_POSITIONS, pos -> {
|
||||||
|
if(pos.getX() != 0)return true;
|
||||||
|
if(pos.getY() < 63)return true;
|
||||||
|
if(pos.getZ() != 0)return true;
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
protected List<PieceFinder> finders = new ArrayList<>();
|
protected List<PieceFinder> finders = new ArrayList<>();
|
||||||
protected final Vec3i size;
|
protected final Vec3i size;
|
||||||
|
|
||||||
@@ -23,12 +30,7 @@ public abstract class AbstractTempleFinder extends Finder {
|
|||||||
Direction.Type.HORIZONTAL.forEach(direction -> {
|
Direction.Type.HORIZONTAL.forEach(direction -> {
|
||||||
PieceFinder finder = new PieceFinder(world, chunkPos, direction, size);
|
PieceFinder finder = new PieceFinder(world, chunkPos, direction, size);
|
||||||
|
|
||||||
finder.searchPositions.removeIf(pos -> {
|
finder.searchPositions = SEARCH_POSITIONS;
|
||||||
if(pos.getX() != 0)return true;
|
|
||||||
if(pos.getY() < 63)return true;
|
|
||||||
if(pos.getZ() != 0)return true;
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
buildStructure(finder);
|
buildStructure(finder);
|
||||||
this.finders.add(finder);
|
this.finders.add(finder);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import kaptainwutax.seedcracker.cracker.StructureData;
|
|||||||
import kaptainwutax.seedcracker.render.Cube;
|
import kaptainwutax.seedcracker.render.Cube;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
|
import net.minecraft.block.ChestBlock;
|
||||||
import net.minecraft.client.util.math.Vector4f;
|
import net.minecraft.client.util.math.Vector4f;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.ChunkPos;
|
import net.minecraft.util.math.ChunkPos;
|
||||||
@@ -18,6 +19,15 @@ import java.util.List;
|
|||||||
|
|
||||||
public class BuriedTreasureFinder extends BlockFinder {
|
public class BuriedTreasureFinder extends BlockFinder {
|
||||||
|
|
||||||
|
protected static List<BlockPos> SEARCH_POSITIONS = buildSearchPositions(CHUNK_POSITIONS, pos -> {
|
||||||
|
//Buried treasure chests always generate at (9, 9) within a chunk.
|
||||||
|
int localX = pos.getX() & 15;
|
||||||
|
int localZ = pos.getZ() & 15;
|
||||||
|
if(localX != 9 || localZ != 9)return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
protected static final List<BlockState> CHEST_HOLDERS = new ArrayList<>();
|
protected static final List<BlockState> CHEST_HOLDERS = new ArrayList<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@@ -26,19 +36,16 @@ public class BuriedTreasureFinder extends BlockFinder {
|
|||||||
CHEST_HOLDERS.add(Blocks.ANDESITE.getDefaultState());
|
CHEST_HOLDERS.add(Blocks.ANDESITE.getDefaultState());
|
||||||
CHEST_HOLDERS.add(Blocks.GRANITE.getDefaultState());
|
CHEST_HOLDERS.add(Blocks.GRANITE.getDefaultState());
|
||||||
CHEST_HOLDERS.add(Blocks.DIORITE.getDefaultState());
|
CHEST_HOLDERS.add(Blocks.DIORITE.getDefaultState());
|
||||||
|
|
||||||
|
//Population can turn stone, andesite, granite and diorite into ores...
|
||||||
|
CHEST_HOLDERS.add(Blocks.COAL_ORE.getDefaultState());
|
||||||
|
CHEST_HOLDERS.add(Blocks.IRON_ORE.getDefaultState());
|
||||||
|
CHEST_HOLDERS.add(Blocks.GOLD_ORE.getDefaultState());
|
||||||
}
|
}
|
||||||
|
|
||||||
public BuriedTreasureFinder(World world, ChunkPos chunkPos) {
|
public BuriedTreasureFinder(World world, ChunkPos chunkPos) {
|
||||||
super(world, chunkPos, Blocks.CHEST);
|
super(world, chunkPos, Blocks.CHEST);
|
||||||
|
this.searchPositions = SEARCH_POSITIONS;
|
||||||
this.searchPositions.removeIf(pos -> {
|
|
||||||
//Buried treasure chests always generate at (9, 9) within a chunk.
|
|
||||||
int localX = pos.getX() & 15;
|
|
||||||
int localZ = pos.getZ() & 15;
|
|
||||||
if(localX != 9 || localZ != 9)return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -47,6 +54,10 @@ public class BuriedTreasureFinder extends BlockFinder {
|
|||||||
List<BlockPos> result = super.findInChunk();
|
List<BlockPos> result = super.findInChunk();
|
||||||
|
|
||||||
result.removeIf(pos -> {
|
result.removeIf(pos -> {
|
||||||
|
//Chest can't be waterlogged!
|
||||||
|
BlockState chest = world.getBlockState(pos);
|
||||||
|
if(chest.get(ChestBlock.WATERLOGGED))return true;
|
||||||
|
|
||||||
//Only so many blocks can hold a treasure chest.
|
//Only so many blocks can hold a treasure chest.
|
||||||
BlockState chestHolder = world.getBlockState(pos.down());
|
BlockState chestHolder = world.getBlockState(pos.down());
|
||||||
if(!CHEST_HOLDERS.contains(chestHolder))return true;
|
if(!CHEST_HOLDERS.contains(chestHolder))return true;
|
||||||
@@ -60,8 +71,9 @@ public class BuriedTreasureFinder extends BlockFinder {
|
|||||||
});
|
});
|
||||||
|
|
||||||
result.forEach(pos -> {
|
result.forEach(pos -> {
|
||||||
this.renderers.add(new Cube(pos, new Vector4f(1.0f, 1.0f, 0.0f, 1.0f)));
|
if(SeedCracker.get().onStructureData(new StructureData(this.chunkPos, StructureData.BURIED_TREASURE))) {
|
||||||
SeedCracker.get().onStructureData(new StructureData(this.chunkPos, StructureData.BURIED_TREASURE));
|
this.renderers.add(new Cube(pos, new Vector4f(1.0f, 1.0f, 0.0f, 1.0f)));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -41,8 +41,9 @@ public class DesertTempleFinder extends AbstractTempleFinder {
|
|||||||
combinedResult.addAll(positions);
|
combinedResult.addAll(positions);
|
||||||
|
|
||||||
positions.forEach(pos -> {
|
positions.forEach(pos -> {
|
||||||
this.renderers.add(new Cuboid(pos, pieceFinder.getLayout(), new Vector4f(1.0f, 0.0f, 1.0f, 1.0f)));
|
if( SeedCracker.get().onStructureData(new StructureData(this.chunkPos, StructureData.DESERT_PYRAMID))) {
|
||||||
SeedCracker.get().onStructureData(new StructureData(this.chunkPos, StructureData.DESERT_PYRAMID));
|
this.renderers.add(new Cuboid(pos, pieceFinder.getLayout(), new Vector4f(1.0f, 0.0f, 1.0f, 1.0f)));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,121 @@
|
|||||||
|
package kaptainwutax.seedcracker.finder;
|
||||||
|
|
||||||
|
import kaptainwutax.seedcracker.SeedCracker;
|
||||||
|
import kaptainwutax.seedcracker.cracker.StructureData;
|
||||||
|
import kaptainwutax.seedcracker.render.Cube;
|
||||||
|
import kaptainwutax.seedcracker.render.Cuboid;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.Blocks;
|
||||||
|
import net.minecraft.client.util.math.Vector4f;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.ChunkPos;
|
||||||
|
import net.minecraft.util.math.Direction;
|
||||||
|
import net.minecraft.util.math.Vec3i;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.dimension.DimensionType;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class EndCityFinder extends Finder {
|
||||||
|
|
||||||
|
protected static List<BlockPos> SEARCH_POSITIONS = buildSearchPositions(CHUNK_POSITIONS, pos -> {
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
protected List<PieceFinder> finders = new ArrayList<>();
|
||||||
|
protected final Vec3i size = new Vec3i(8, 4, 8);
|
||||||
|
|
||||||
|
public EndCityFinder(World world, ChunkPos chunkPos) {
|
||||||
|
super(world, chunkPos);
|
||||||
|
|
||||||
|
Direction.Type.HORIZONTAL.forEach(direction -> {
|
||||||
|
PieceFinder finder = new PieceFinder(world, chunkPos, direction, size);
|
||||||
|
|
||||||
|
finder.searchPositions = SEARCH_POSITIONS;
|
||||||
|
|
||||||
|
buildStructure(finder);
|
||||||
|
this.finders.add(finder);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buildStructure(PieceFinder finder) {
|
||||||
|
BlockState air = Blocks.AIR.getDefaultState();
|
||||||
|
BlockState endstoneBricks = Blocks.END_STONE_BRICKS.getDefaultState();
|
||||||
|
BlockState purpur = Blocks.PURPUR_BLOCK.getDefaultState();
|
||||||
|
BlockState purpurPillar = Blocks.PURPUR_PILLAR.getDefaultState();
|
||||||
|
BlockState purpleGlass = Blocks.MAGENTA_STAINED_GLASS.getDefaultState();
|
||||||
|
|
||||||
|
//Walls
|
||||||
|
finder.fillWithOutline(0, 0, 0, 7, 4, 7, endstoneBricks, null, false);
|
||||||
|
|
||||||
|
//Wall sides
|
||||||
|
finder.fillWithOutline(0, 0, 0, 0, 3, 0, purpurPillar, purpurPillar, false);
|
||||||
|
finder.fillWithOutline(7, 0, 0, 7, 3, 0, purpurPillar, purpurPillar, false);
|
||||||
|
finder.fillWithOutline(0, 0, 7, 0, 3, 7, purpurPillar, purpurPillar, false);
|
||||||
|
finder.fillWithOutline(7, 0, 7, 7, 3, 7, purpurPillar, purpurPillar, false);
|
||||||
|
|
||||||
|
//Floor
|
||||||
|
finder.fillWithOutline(0, 0, 0, 7, 0, 7, purpur, purpur, false);
|
||||||
|
|
||||||
|
//Doorway
|
||||||
|
finder.fillWithOutline(3, 1, 0, 4, 3, 0, air, air, false);
|
||||||
|
|
||||||
|
//Windows
|
||||||
|
finder.fillWithOutline(0, 2, 2, 0, 3, 2, purpleGlass, purpleGlass, false);
|
||||||
|
finder.fillWithOutline(0, 2, 5, 0, 3, 5, purpleGlass, purpleGlass, false);
|
||||||
|
finder.fillWithOutline(7, 2, 2, 7, 3, 2, purpleGlass, purpleGlass, false);
|
||||||
|
finder.fillWithOutline(7, 2, 5, 7, 3, 5, purpleGlass, purpleGlass, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BlockPos> findInChunk() {
|
||||||
|
Map<PieceFinder, List<BlockPos>> result = this.findInChunkPieces();
|
||||||
|
List<BlockPos> combinedResult = new ArrayList<>();
|
||||||
|
|
||||||
|
result.forEach((pieceFinder, positions) -> {
|
||||||
|
positions.removeIf(pos -> {
|
||||||
|
//Figure this out, it's not a trivial task.
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
combinedResult.addAll(positions);
|
||||||
|
|
||||||
|
positions.forEach(pos -> {
|
||||||
|
if(SeedCracker.get().onStructureData(new StructureData(this.chunkPos, StructureData.END_CITY))) {
|
||||||
|
this.renderers.add(new Cuboid(pos, pieceFinder.getLayout(), new Vector4f(0.6f, 0.0f, 0.6f, 1.0f)));
|
||||||
|
this.renderers.add(new Cube(pos, new Vector4f(0.6f, 0.0f, 0.6f, 1.0f)));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return combinedResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<PieceFinder, List<BlockPos>> findInChunkPieces() {
|
||||||
|
Map<PieceFinder, List<BlockPos>> result = new HashMap<>();
|
||||||
|
|
||||||
|
this.finders.forEach(pieceFinder -> {
|
||||||
|
result.put(pieceFinder, pieceFinder.findInChunk());
|
||||||
|
});
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValidDimension(DimensionType dimension) {
|
||||||
|
return dimension == DimensionType.THE_END;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Finder> create(World world, ChunkPos chunkPos) {
|
||||||
|
List<Finder> finders = new ArrayList<>();
|
||||||
|
finders.add(new EndCityFinder(world, chunkPos));
|
||||||
|
finders.add(new EndCityFinder(world, new ChunkPos(chunkPos.x - 1, chunkPos.z)));
|
||||||
|
finders.add(new EndCityFinder(world, new ChunkPos(chunkPos.x, chunkPos.z - 1)));
|
||||||
|
finders.add(new EndCityFinder(world, new ChunkPos(chunkPos.x - 1, chunkPos.z - 1)));
|
||||||
|
return finders;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -18,11 +18,15 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
public class EndPillarsFinder extends Finder {
|
public class EndPillarsFinder extends Finder {
|
||||||
|
|
||||||
|
private boolean alreadyFound;
|
||||||
protected BedrockMarkerFinder[] bedrockMarkers = new BedrockMarkerFinder[10];
|
protected BedrockMarkerFinder[] bedrockMarkers = new BedrockMarkerFinder[10];
|
||||||
|
|
||||||
public EndPillarsFinder(World world, ChunkPos chunkPos) {
|
public EndPillarsFinder(World world, ChunkPos chunkPos) {
|
||||||
super(world, chunkPos);
|
super(world, chunkPos);
|
||||||
|
|
||||||
|
this.alreadyFound = SeedCracker.get().onPillarData(null);
|
||||||
|
if(this.alreadyFound)return;
|
||||||
|
|
||||||
for(int i = 0; i < this.bedrockMarkers.length; i++) {
|
for(int i = 0; i < this.bedrockMarkers.length; i++) {
|
||||||
int x = MathHelper.floor(42.0D * Math.cos(2.0D * (-Math.PI + (Math.PI / 10.0D) * (double)i)));
|
int x = MathHelper.floor(42.0D * Math.cos(2.0D * (-Math.PI + (Math.PI / 10.0D) * (double)i)));
|
||||||
int z = MathHelper.floor(42.0D * Math.sin(2.0D * (-Math.PI + (Math.PI / 10.0D) * (double)i)));
|
int z = MathHelper.floor(42.0D * Math.sin(2.0D * (-Math.PI + (Math.PI / 10.0D) * (double)i)));
|
||||||
@@ -35,12 +39,14 @@ public class EndPillarsFinder extends Finder {
|
|||||||
List<BlockPos> result = new ArrayList<>();
|
List<BlockPos> result = new ArrayList<>();
|
||||||
|
|
||||||
for(BedrockMarkerFinder bedrockMarker: this.bedrockMarkers) {
|
for(BedrockMarkerFinder bedrockMarker: this.bedrockMarkers) {
|
||||||
|
if(bedrockMarker == null)continue;
|
||||||
result.addAll(bedrockMarker.findInChunk());
|
result.addAll(bedrockMarker.findInChunk());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(result.size() == this.bedrockMarkers.length) {
|
if(result.size() == this.bedrockMarkers.length) {
|
||||||
|
PillarData pillarData = new PillarData(result.stream().map(Vec3i::getY).collect(Collectors.toList()));
|
||||||
|
SeedCracker.get().onPillarData(pillarData);
|
||||||
result.forEach(pos -> this.renderers.add(new Cube(pos, new Vector4f(0.5f, 0.0f, 0.5f, 1.0f))));
|
result.forEach(pos -> this.renderers.add(new Cube(pos, new Vector4f(0.5f, 0.0f, 0.5f, 1.0f))));
|
||||||
SeedCracker.get().onPillarData(new PillarData(result.stream().map(Vec3i::getY).collect(Collectors.toList())));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -57,21 +63,17 @@ public class EndPillarsFinder extends Finder {
|
|||||||
return finders;
|
return finders;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BedrockMarkerFinder extends BlockFinder {
|
public static class BedrockMarkerFinder extends BlockFinder {
|
||||||
|
|
||||||
|
protected static List<BlockPos> SEARCH_POSITIONS = buildSearchPositions(CHUNK_POSITIONS, pos -> {
|
||||||
|
if(pos.getY() < 76)return true;
|
||||||
|
if(pos.getY() > 76 + 3 * 10)return true;
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
public BedrockMarkerFinder(World world, ChunkPos chunkPos, BlockPos xz) {
|
public BedrockMarkerFinder(World world, ChunkPos chunkPos, BlockPos xz) {
|
||||||
super(world, chunkPos, Blocks.BEDROCK);
|
super(world, chunkPos, Blocks.BEDROCK);
|
||||||
|
this.searchPositions = SEARCH_POSITIONS;
|
||||||
int localX = xz.getX() & 15;
|
|
||||||
int localZ = xz.getZ() & 15;
|
|
||||||
|
|
||||||
this.searchPositions.removeIf(pos -> {
|
|
||||||
if(pos.getX() != localX)return true;
|
|
||||||
if(pos.getY() < 76)return true;
|
|
||||||
if(pos.getY() > 76 + 3 * 10)return true;
|
|
||||||
if(pos.getZ() != localZ)return true;
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,119 @@
|
|||||||
|
package kaptainwutax.seedcracker.finder;
|
||||||
|
|
||||||
|
import kaptainwutax.seedcracker.SeedCracker;
|
||||||
|
import kaptainwutax.seedcracker.cracker.StructureData;
|
||||||
|
import kaptainwutax.seedcracker.render.Cube;
|
||||||
|
import kaptainwutax.seedcracker.render.Cuboid;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.Blocks;
|
||||||
|
import net.minecraft.client.util.math.Vector4f;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.ChunkPos;
|
||||||
|
import net.minecraft.util.math.Direction;
|
||||||
|
import net.minecraft.util.math.Vec3i;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.dimension.DimensionType;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class IglooFinder extends Finder {
|
||||||
|
|
||||||
|
protected static List<BlockPos> SEARCH_POSITIONS = buildSearchPositions(CHUNK_POSITIONS, pos -> {
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
protected List<PieceFinder> finders = new ArrayList<>();
|
||||||
|
protected final Vec3i size = new Vec3i(7, 5, 8);
|
||||||
|
|
||||||
|
public IglooFinder(World world, ChunkPos chunkPos) {
|
||||||
|
super(world, chunkPos);
|
||||||
|
|
||||||
|
Direction.Type.HORIZONTAL.forEach(direction -> {
|
||||||
|
PieceFinder finder = new PieceFinder(world, chunkPos, direction, size);
|
||||||
|
|
||||||
|
finder.searchPositions = SEARCH_POSITIONS;
|
||||||
|
|
||||||
|
buildStructure(finder);
|
||||||
|
this.finders.add(finder);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buildStructure(PieceFinder finder) {
|
||||||
|
BlockState air = Blocks.AIR.getDefaultState();
|
||||||
|
BlockState snow = Blocks.SNOW_BLOCK.getDefaultState();
|
||||||
|
BlockState ice = Blocks.ICE.getDefaultState();
|
||||||
|
|
||||||
|
for(int y = 0; y < 3; y++) {
|
||||||
|
finder.addBlock(snow, 2, y, 0);
|
||||||
|
finder.addBlock(snow, 2, y, 1);
|
||||||
|
finder.addBlock(snow, 1, y, 2);
|
||||||
|
finder.addBlock(snow, 0, y, 3);
|
||||||
|
finder.addBlock(snow, 0, y, 4);
|
||||||
|
finder.addBlock(ice, 0, 1, 4);
|
||||||
|
finder.addBlock(snow, 0, y, 5);
|
||||||
|
finder.addBlock(snow, 1, y, 6);
|
||||||
|
finder.addBlock(snow, 2, y, 7);
|
||||||
|
|
||||||
|
finder.addBlock(snow, 3, y, 7);
|
||||||
|
|
||||||
|
finder.addBlock(snow, 4, y, 0);
|
||||||
|
finder.addBlock(snow, 4, y, 1);
|
||||||
|
finder.addBlock(snow, 5, y, 2);
|
||||||
|
finder.addBlock(snow, 6, y, 3);
|
||||||
|
finder.addBlock(snow, 6, y, 4);
|
||||||
|
finder.addBlock(ice, 6, 1, 4);
|
||||||
|
finder.addBlock(snow, 6, y, 5);
|
||||||
|
finder.addBlock(snow, 5, y, 6);
|
||||||
|
finder.addBlock(snow, 4, y, 7);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BlockPos> findInChunk() {
|
||||||
|
Map<PieceFinder, List<BlockPos>> result = this.findInChunkPieces();
|
||||||
|
List<BlockPos> combinedResult = new ArrayList<>();
|
||||||
|
|
||||||
|
result.forEach((pieceFinder, positions) -> {
|
||||||
|
positions.removeIf(pos -> {
|
||||||
|
//Figure this out, it's not a trivial task.
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
combinedResult.addAll(positions);
|
||||||
|
|
||||||
|
positions.forEach(pos -> {
|
||||||
|
if(SeedCracker.get().onStructureData(new StructureData(this.chunkPos, StructureData.IGLOO))) {
|
||||||
|
this.renderers.add(new Cuboid(pos, pieceFinder.getLayout(), new Vector4f(0.0f, 1.0f, 1.0f, 1.0f)));
|
||||||
|
this.renderers.add(new Cube(pos, new Vector4f(0.0f, 1.0f, 1.0f, 1.0f)));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return combinedResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<PieceFinder, List<BlockPos>> findInChunkPieces() {
|
||||||
|
Map<PieceFinder, List<BlockPos>> result = new HashMap<>();
|
||||||
|
|
||||||
|
this.finders.forEach(pieceFinder -> {
|
||||||
|
result.put(pieceFinder, pieceFinder.findInChunk());
|
||||||
|
});
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValidDimension(DimensionType dimension) {
|
||||||
|
return dimension == DimensionType.OVERWORLD;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Finder> create(World world, ChunkPos chunkPos) {
|
||||||
|
List<Finder> finders = new ArrayList<>();
|
||||||
|
finders.add(new IglooFinder(world, chunkPos));
|
||||||
|
return finders;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -41,8 +41,9 @@ public class JungleTempleFinder extends AbstractTempleFinder {
|
|||||||
combinedResult.addAll(positions);
|
combinedResult.addAll(positions);
|
||||||
|
|
||||||
positions.forEach(pos -> {
|
positions.forEach(pos -> {
|
||||||
this.renderers.add(new Cuboid(pos, pieceFinder.getLayout(), new Vector4f(1.0f, 0.0f, 1.0f, 1.0f)));
|
if(SeedCracker.get().onStructureData(new StructureData(this.chunkPos, StructureData.JUNGLE_TEMPLE))) {
|
||||||
SeedCracker.get().onStructureData(new StructureData(this.chunkPos, StructureData.JUNGLE_TEMPLE));
|
this.renderers.add(new Cuboid(pos, pieceFinder.getLayout(), new Vector4f(1.0f, 0.0f, 1.0f, 1.0f)));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,11 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class OceanMonumentFinder extends Finder {
|
public class OceanMonumentFinder extends Finder {
|
||||||
|
|
||||||
|
protected static List<BlockPos> SEARCH_POSITIONS = buildSearchPositions(CHUNK_POSITIONS, pos -> {
|
||||||
|
if(pos.getY() != 56)return true;
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
protected List<PieceFinder> finders = new ArrayList<>();
|
protected List<PieceFinder> finders = new ArrayList<>();
|
||||||
protected final Vec3i size = new Vec3i(8, 5, 8);
|
protected final Vec3i size = new Vec3i(8, 5, 8);
|
||||||
|
|
||||||
@@ -29,10 +34,7 @@ public class OceanMonumentFinder extends Finder {
|
|||||||
|
|
||||||
PieceFinder finder = new PieceFinder(world, chunkPos, Direction.NORTH, size);
|
PieceFinder finder = new PieceFinder(world, chunkPos, Direction.NORTH, size);
|
||||||
|
|
||||||
finder.searchPositions.removeIf(pos -> {
|
finder.searchPositions = SEARCH_POSITIONS;
|
||||||
if(pos.getY() != 56)return true;
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
buildStructure(finder);
|
buildStructure(finder);
|
||||||
this.finders.add(finder);
|
this.finders.add(finder);
|
||||||
@@ -52,10 +54,12 @@ public class OceanMonumentFinder extends Finder {
|
|||||||
combinedResult.addAll(positions);
|
combinedResult.addAll(positions);
|
||||||
|
|
||||||
positions.forEach(pos -> {
|
positions.forEach(pos -> {
|
||||||
this.renderers.add(new Cuboid(pos, pieceFinder.getLayout(), new Vector4f(0.0f, 0.0f, 1.0f, 1.0f)));
|
|
||||||
ChunkPos monumentStart = new ChunkPos(this.chunkPos.x + 1, this.chunkPos.z + 1);
|
ChunkPos monumentStart = new ChunkPos(this.chunkPos.x + 1, this.chunkPos.z + 1);
|
||||||
this.renderers.add(new Cube(monumentStart.getCenterBlockPos().add(0, pos.getY(), 0), new Vector4f(0.0f, 0.0f, 1.0f, 1.0f)));
|
|
||||||
SeedCracker.get().onStructureData(new StructureData(monumentStart, StructureData.OCEAN_MONUMENT));
|
if(SeedCracker.get().onStructureData(new StructureData(monumentStart, StructureData.OCEAN_MONUMENT))) {
|
||||||
|
this.renderers.add(new Cuboid(pos, pieceFinder.getLayout(), new Vector4f(0.0f, 0.0f, 1.0f, 1.0f)));
|
||||||
|
this.renderers.add(new Cube(monumentStart.getCenterBlockPos().add(0, pos.getY(), 0), new Vector4f(0.0f, 0.0f, 1.0f, 1.0f)));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -42,8 +42,9 @@ public class SwampHutFinder extends AbstractTempleFinder {
|
|||||||
combinedResult.addAll(positions);
|
combinedResult.addAll(positions);
|
||||||
|
|
||||||
positions.forEach(pos -> {
|
positions.forEach(pos -> {
|
||||||
this.renderers.add(new Cuboid(pos, pieceFinder.getLayout(), new Vector4f(1.0f, 0.0f, 1.0f, 1.0f)));
|
if(SeedCracker.get().onStructureData(new StructureData(this.chunkPos, StructureData.SWAMP_HUT))) {
|
||||||
SeedCracker.get().onStructureData(new StructureData(this.chunkPos, StructureData.SWAMP_HUT));
|
this.renderers.add(new Cuboid(pos, pieceFinder.getLayout(), new Vector4f(1.0f, 0.0f, 1.0f, 1.0f)));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user