Skip to content

Commit

Permalink
Added Stronghold, Nether Fortress and End Cities
Browse files Browse the repository at this point in the history
  • Loading branch information
DaFuqs committed Dec 11, 2020
1 parent c42d54a commit 1eb5684
Show file tree
Hide file tree
Showing 38 changed files with 1,058 additions and 93 deletions.
6 changes: 3 additions & 3 deletions src/main/java/de/dafuqs/starrysky/Support.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ public static int getRandomBetween(Random random, int lowest, int highest) {
return random.nextInt(highest - lowest + 1) + lowest;
}

public static double squaredDistance(double x1, double y1, double z1, double x2, double y2, double z2) {
public static double getDistance(double x1, double y1, double z1, double x2, double y2, double z2) {
return Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) + (z1 - z2) * (z1 - z2));
}

public static double squaredDistance(BlockPos blockPos1, BlockPos blockpos2) {
return squaredDistance(blockPos1.getX(), blockPos1.getY(), blockPos1.getZ(), blockpos2.getX(), blockpos2.getY(), blockpos2.getZ());
public static double getDistance(BlockPos blockPos1, BlockPos blockpos2) {
return getDistance(blockPos1.getX(), blockPos1.getY(), blockPos1.getZ(), blockpos2.getX(), blockpos2.getY(), blockpos2.getZ());
}

public static boolean isBlockPosInChunkPos(ChunkPos chunkPos, BlockPos blockPos) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,10 @@ public enum SpheroidAdvancementIdentifier {
stone_hollow,
the_sun,
tnt,
ocean_monument, beach, water
ocean_monument,
beach,
stronghold,
end_city,
nether_fortress,
water
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,28 @@ public SpheroidAdvancementIdentifierGroups() {
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.tnt, SpheroidAdvancementGroup.RARE);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.water, SpheroidAdvancementGroup.COMMON);

spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.ancient_debris, SpheroidAdvancementGroup.NETHER);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.crying_obsidian, SpheroidAdvancementGroup.NETHER);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.nether_dungeon, SpheroidAdvancementGroup.NETHER);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.nether_gold_ore, SpheroidAdvancementGroup.NETHER);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.nether_quartz, SpheroidAdvancementGroup.NETHER);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.netherrack, SpheroidAdvancementGroup.NETHER);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.soul_sand, SpheroidAdvancementGroup.NETHER);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.crimson_nylium, SpheroidAdvancementGroup.NETHER);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.warped_nylium, SpheroidAdvancementGroup.NETHER);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.soul_soil, SpheroidAdvancementGroup.NETHER);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.basalt, SpheroidAdvancementGroup.NETHER);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.blackstone, SpheroidAdvancementGroup.NETHER);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.crimson_wood, SpheroidAdvancementGroup.NETHER);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.warped_wood, SpheroidAdvancementGroup.NETHER);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.ancient_debris, SpheroidAdvancementGroup.NETHER);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.crying_obsidian, SpheroidAdvancementGroup.NETHER);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.nether_dungeon, SpheroidAdvancementGroup.NETHER);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.nether_gold_ore, SpheroidAdvancementGroup.NETHER);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.nether_quartz, SpheroidAdvancementGroup.NETHER);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.netherrack, SpheroidAdvancementGroup.NETHER);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.soul_sand, SpheroidAdvancementGroup.NETHER);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.crimson_nylium, SpheroidAdvancementGroup.NETHER);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.warped_nylium, SpheroidAdvancementGroup.NETHER);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.soul_soil, SpheroidAdvancementGroup.NETHER);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.basalt, SpheroidAdvancementGroup.NETHER);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.blackstone, SpheroidAdvancementGroup.NETHER);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.crimson_wood, SpheroidAdvancementGroup.NETHER);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.warped_wood, SpheroidAdvancementGroup.NETHER);

spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.end_dungeon, SpheroidAdvancementGroup.END);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.end_gateway, SpheroidAdvancementGroup.END);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.end_stone, SpheroidAdvancementGroup.END);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.end_dungeon, SpheroidAdvancementGroup.END);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.end_gateway, SpheroidAdvancementGroup.END);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.end_stone, SpheroidAdvancementGroup.END);

spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.stronghold, SpheroidAdvancementGroup.RARE);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.nether_fortress, SpheroidAdvancementGroup.NETHER);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.end_city, SpheroidAdvancementGroup.END);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public class StarrySkyConfig implements ConfigData {
@Comment(value = "\nHow much empty blocks should be enforced between individual spheres.\n"
+ "If the distance is too low generation of that one sphere will be cancelled.\n"
+ "Default: 10\n")
public int minDistanceBetweenSpheresNether = 10;
public int minDistanceBetweenSpheresNether = 7;

@ConfigEntry.Gui.Tooltip()
@ConfigEntry.Category("SYSTEM GENERATION")
Expand All @@ -121,7 +121,7 @@ public class StarrySkyConfig implements ConfigData {
@Comment(value = "\nHow much empty blocks should be enforced between individual spheres.\n"
+ "If the distance is too low generation of that one sphere will be cancelled.\n"
+ "Default: 10\n")
public int minDistanceBetweenSpheresEnd = 10;
public int minDistanceBetweenSpheresEnd = 8;

@ConfigEntry.Gui.PrefixText
@ConfigEntry.Category("WORLD FLOOR GENERATION")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void decorateSpheroid(StructureWorldAccess world, Spheroid spheroid, Arra
if (currentBlockPos.getY() > waterLevelY) {
blockState = Blocks.AIR.getDefaultState();
} else {
double distance = Support.squaredDistance(currentBlockPos, spheroidTop);
double distance = Support.getDistance(currentBlockPos, spheroidTop);
double pondDistance = distance / pondRadius;
if (pondDistance < 1.1) {
if(hasLootChest && x == 0 && z == 0 && lootChestPosition == null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +0,0 @@
package de.dafuqs.starrysky.dimension.decorators.end;

import de.dafuqs.starrysky.dimension.SpheroidDecorator;
import de.dafuqs.starrysky.spheroid.spheroids.Spheroid;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.StructureWorldAccess;

import java.util.ArrayList;
import java.util.Random;

// TODO
public class EndCrystalDecorator extends SpheroidDecorator {
@Override
public void decorateSpheroid(StructureWorldAccess world, Spheroid spheroid, ArrayList<BlockPos> decorationBlockPositions, Random random) {

}

/*private static final float ironCageChance = 0.33F;
private static final BlockState crystal = Blocks.END_C
@Override
public void decorateSpheroid(StructureWorldAccess world, Spheroid spheroid, ArrayList<BlockPos> decorationBlockPositions, Random random) {
for(int x = -2; x < 3; x++) {
for (int y = -2; y < 3; y++) {
for (int z = -2; z < 3; z++) {
}
}
}
}*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
import de.dafuqs.starrysky.dimension.decorators.*;
import de.dafuqs.starrysky.spheroid.SpheroidEntitySpawnDefinitions;
import de.dafuqs.starrysky.spheroid.types.*;
import de.dafuqs.starrysky.spheroid.types.unique.BeeHiveSpheroidType;
import de.dafuqs.starrysky.spheroid.types.unique.OceanMonumentSpheroidType;
import de.dafuqs.starrysky.spheroid.types.unique.StrongholdSpheroidType;
import net.minecraft.block.Blocks;
import net.minecraft.entity.EntityType;
import net.minecraft.loot.LootTables;
Expand Down Expand Up @@ -142,7 +145,6 @@ public static class SpheroidDecorators {
public static final SpheroidType BEDROCK = new ModularSpheroidType(SpheroidAdvancementIdentifier.bedrock, 3, 5, Blocks.BEDROCK.getDefaultState());
public static final SpheroidType STONE_HOLLOW = (ShellSpheroidType) new ShellSpheroidType(SpheroidAdvancementIdentifier.cave, 5, 20, Blocks.CAVE_AIR.getDefaultState(), MAP_STONES, 3, 8)
.addDecorator(SpheroidDecorators.MUSHROOMS, 0.3F);
public static final SpheroidType OCEAN_MONUMENT = new OceanMonumentSpheroidType(SpheroidAdvancementIdentifier.ocean_monument, 25, 35, 3, 5, 2, 3);

// ORES
public static final SpheroidType COAL = new CoreSpheroidType(SpheroidAdvancementIdentifier.coal, 5, 15, Blocks.COAL_ORE.getDefaultState(), MAP_STONES, 4, 8);
Expand Down Expand Up @@ -240,8 +242,11 @@ public static class SpheroidDecorators {
public static final SpheroidType DUNGEON_SILVERFISH = new DungeonSpheroidType(SpheroidAdvancementIdentifier.dungeon, 6, 12, EntityType.SILVERFISH, MAP_DUNGEON_STONES, 2, 4);
public static final SpheroidType DUNGEON_ENDERMAN = new DungeonSpheroidType(SpheroidAdvancementIdentifier.dungeon, 6, 12, EntityType.ENDERMAN, MAP_DUNGEON_STONES, 2, 4);

// BEES
// UNIQUE
public static final SpheroidType BEE_HIVE = new BeeHiveSpheroidType(SpheroidAdvancementIdentifier.bee_hive,10, 16, 2, 4, 1, 2, 2, 3);
public static final SpheroidType OCEAN_MONUMENT = new OceanMonumentSpheroidType(SpheroidAdvancementIdentifier.ocean_monument, 25, 35, 3, 5, 2, 3);
public static final SpheroidType STRONGHOLD = new StrongholdSpheroidType(SpheroidAdvancementIdentifier.stronghold,25, 30);


public static void setup(SpheroidLoader spheroidLoader) {
StarrySkyCommon.LOGGER.info("Loading Vanilla Spheroids...");
Expand Down Expand Up @@ -297,7 +302,6 @@ public static void setup(SpheroidLoader spheroidLoader) {
spheroidLoader.registerSpheroidType(OVERWORLD, SpheroidDistributionType.DECORATIVE, 0.02F, WHITE_STAINED_GLASS);
spheroidLoader.registerSpheroidType(OVERWORLD, SpheroidDistributionType.DECORATIVE, 0.02F, YELLOW_STAINED_GLASS);

spheroidLoader.registerSpheroidType(OVERWORLD, SpheroidDistributionType.TREASURE, 4.0F, BEE_HIVE);
spheroidLoader.registerSpheroidType(OVERWORLD, SpheroidDistributionType.TREASURE, 1.0F, CORALS_GLASS);
spheroidLoader.registerSpheroidType(OVERWORLD, SpheroidDistributionType.TREASURE, 1.0F, CORALS_STONE);
spheroidLoader.registerSpheroidType(OVERWORLD, SpheroidDistributionType.TREASURE, 1.0F, BROWN_MUSHROOM);
Expand All @@ -306,7 +310,6 @@ public static void setup(SpheroidLoader spheroidLoader) {
spheroidLoader.registerSpheroidType(OVERWORLD, SpheroidDistributionType.TREASURE, 1.0F, MYCELIUM);
spheroidLoader.registerSpheroidType(OVERWORLD, SpheroidDistributionType.TREASURE, 0.1F, BEDROCK);
spheroidLoader.registerSpheroidType(OVERWORLD, SpheroidDistributionType.TREASURE, 0.05F, THE_SUN);
spheroidLoader.registerSpheroidType(OVERWORLD, SpheroidDistributionType.TREASURE, 0.5F, OCEAN_MONUMENT);

//RAINBOW
spheroidLoader.registerSpheroidType(OVERWORLD, SpheroidDistributionType.TREASURE, 1.0F, RAINBOW_WOOL);
Expand Down Expand Up @@ -365,5 +368,10 @@ public static void setup(SpheroidLoader spheroidLoader) {
spheroidLoader.registerSpheroidType(OVERWORLD, SpheroidDistributionType.DUNGEON, 0.1F, DUNGEON_STRAY);
spheroidLoader.registerSpheroidType(OVERWORLD, SpheroidDistributionType.DUNGEON, 0.1F, DUNGEON_SILVERFISH);
spheroidLoader.registerSpheroidType(OVERWORLD, SpheroidDistributionType.DUNGEON, 0.05F, DUNGEON_ENDERMAN);

// UNIQUE
spheroidLoader.registerSpheroidType(OVERWORLD, SpheroidDistributionType.TREASURE, 4.0F, BEE_HIVE);
spheroidLoader.registerSpheroidType(OVERWORLD, SpheroidDistributionType.TREASURE, 0.5F, OCEAN_MONUMENT);
spheroidLoader.registerSpheroidType(OVERWORLD, SpheroidDistributionType.TREASURE, 1.0F, STRONGHOLD);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
import de.dafuqs.starrysky.dimension.SpheroidDecorator;
import de.dafuqs.starrysky.dimension.SpheroidDistributionType;
import de.dafuqs.starrysky.dimension.SpheroidLoader;
import de.dafuqs.starrysky.dimension.decorators.end.EndCrystalDecorator;
import de.dafuqs.starrysky.dimension.decorators.end.EndPortalDecorator;
import de.dafuqs.starrysky.spheroid.SpheroidEntitySpawnDefinitions;
import de.dafuqs.starrysky.spheroid.types.*;
import de.dafuqs.starrysky.spheroid.types.unique.EndCitySpheroidType;
import de.dafuqs.starrysky.spheroid.types.unique.EndGatewaySpheroidType;
import net.minecraft.block.Blocks;
import net.minecraft.entity.EntityType;
import net.minecraft.loot.LootTables;
Expand All @@ -18,7 +19,6 @@
public class SpheroidListVanillaEnd extends SpheroidList {

public static class SpheroidDecorators {
public static SpheroidDecorator END_CRYSTAL = new EndCrystalDecorator();
public static SpheroidDecorator END_PORTAL = new EndPortalDecorator();
}

Expand All @@ -29,8 +29,6 @@ public static class SpheroidDecorators {
.addSpawn(SpheroidEntitySpawnDefinitions.ENDER_DRAGON, 1.0F);
public static final SpheroidType END_SPAWN_WITH_PORTAL = new ModularSpheroidType(SpheroidAdvancementIdentifier.end_stone, 34, 34, Blocks.END_STONE.getDefaultState())
.addDecorator(SpheroidDecorators.END_PORTAL, 1.0F);
public static final SpheroidType END_CRYSTAL = new ModularSpheroidType(SpheroidAdvancementIdentifier.end_stone, 7, 14, Blocks.END_STONE.getDefaultState())
.addDecorator(SpheroidDecorators.END_CRYSTAL, 1.0F);

// SIMPLE
public static final SpheroidType END_STONE_SMALL = new ModularSpheroidType(SpheroidAdvancementIdentifier.end_stone, 4, 7, Blocks.END_STONE.getDefaultState());
Expand All @@ -50,6 +48,9 @@ public static class SpheroidDecorators {
public static final SpheroidType DUNGEON_SHULKER = new DungeonSpheroidType(SpheroidAdvancementIdentifier.end_dungeon, 6, 12, EntityType.SHULKER, MAP_END_DUNGEON_STONES, 2, 4);
public static final SpheroidType DUNGEON_PHANTOM = new DungeonSpheroidType(SpheroidAdvancementIdentifier.end_dungeon, 6, 12, EntityType.PHANTOM, MAP_END_DUNGEON_STONES, 2, 4);

// UNIQUE
public static final SpheroidType END_CITY = new EndCitySpheroidType(SpheroidAdvancementIdentifier.end_city, 20, 40);

public static void setup(SpheroidLoader spheroidLoader) {
StarrySkyCommon.LOGGER.info("Loading Vanilla End Spheroids...");

Expand All @@ -61,6 +62,7 @@ public static void setup(SpheroidLoader spheroidLoader) {
spheroidLoader.registerSpheroidType(END, SpheroidDistributionType.TREASURE, 8.0F, MONSTER_CAVE);
spheroidLoader.registerSpheroidType(END, SpheroidDistributionType.TREASURE, 1.0F, HUGE_MONSTER_CAVE);
spheroidLoader.registerSpheroidType(END, SpheroidDistributionType.TREASURE, 1.0F, END_GATEWAY);
spheroidLoader.registerSpheroidType(END, SpheroidDistributionType.TREASURE, 3.0F, END_CITY);

spheroidLoader.registerSpheroidType(END, SpheroidDistributionType.DUNGEON, 10.0F, DUNGEON_ENDERMAN);
spheroidLoader.registerSpheroidType(END, SpheroidDistributionType.DUNGEON, 1.0F, DUNGEON_ENDERMITE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import de.dafuqs.starrysky.dimension.decorators.UnderPlantDecorator;
import de.dafuqs.starrysky.spheroid.SpheroidEntitySpawnDefinitions;
import de.dafuqs.starrysky.spheroid.types.*;
import de.dafuqs.starrysky.spheroid.types.unique.NetherFortressSpheroidType;
import net.minecraft.block.Blocks;
import net.minecraft.entity.EntityType;
import net.minecraft.loot.LootTables;
Expand Down Expand Up @@ -119,7 +120,11 @@ public static class SpheroidDecorators {
public static final SpheroidType DUNGEON_ENDERMAN = new DungeonSpheroidType(SpheroidAdvancementIdentifier.nether_dungeon, 6, 12, EntityType.STRIDER, MAP_NETHER_DUNGEON_STONES, 2, 4);
public static final SpheroidType DUNGEON_HOGLIN = new DungeonSpheroidType(SpheroidAdvancementIdentifier.nether_dungeon, 6, 12, EntityType.HOGLIN, MAP_NETHER_DUNGEON_STONES, 2, 4);

public static void setup(SpheroidLoader spheroidLoader) {
// UNIQUE
public static final SpheroidType NETHER_FORTRESS = new NetherFortressSpheroidType(SpheroidAdvancementIdentifier.nether_fortress, 25, 35);


public static void setup(SpheroidLoader spheroidLoader) {
StarrySkyCommon.LOGGER.info("Loading Vanilla Nether Spheroids...");

spheroidLoader.registerSpheroidType(NETHER, SpheroidDistributionType.ESSENTIAL, 10.0F, NETHERRACK);
Expand Down Expand Up @@ -159,6 +164,7 @@ public static void setup(SpheroidLoader spheroidLoader) {
spheroidLoader.registerSpheroidType(NETHER, SpheroidDistributionType.TREASURE, 5.0F, MONSTER_CAVE);
spheroidLoader.registerSpheroidType(NETHER, SpheroidDistributionType.TREASURE, 1.0F, HUGE_MONSTER_CAVE);
spheroidLoader.registerSpheroidType(NETHER, SpheroidDistributionType.TREASURE, 1.0F, BEDROCK);
spheroidLoader.registerSpheroidType(NETHER, SpheroidDistributionType.TREASURE, 5.0F, NETHER_FORTRESS);

spheroidLoader.registerSpheroidType(NETHER, SpheroidDistributionType.DUNGEON, 10.0F, DUNGEON_BLAZE);
spheroidLoader.registerSpheroidType(NETHER, SpheroidDistributionType.DUNGEON, 5.0F, DUNGEON_WITHER_SKELETON);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void generate(Chunk chunk) {
for (int y2 = y - this.radius; y2 <= y + this.radius; y2++) {
for (int z2 = Math.max(chunkZ * 16, z - this.radius); z2 <= Math.min(chunkZ * 16 + 15, z + this.radius); z2++) {
BlockPos currBlockPos = new BlockPos(x2, y2, z2);
long d = Math.round(Support.squaredDistance(x, y, z, x2, y2, z2));
long d = Math.round(Support.getDistance(x, y, z, x2, y2, z2));
if (d == this.radius) {
if (isBottomBlock(d, x2, y2, z2)) {
chunk.setBlockState(currBlockPos, this.bottomBlock, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void generate(Chunk chunk) {
for (int y2 = y - this.radius; y2 <= y + this.radius; y2++) {
for (int z2 = Math.max(chunkZ * 16, z - this.radius); z2 <= Math.min(chunkZ * 16 + 15, z + this.radius); z2++) {
BlockPos currBlockPos = new BlockPos(x2, y2, z2);
long d = Math.round(Support.squaredDistance(x, y, z, x2, y2, z2));
long d = Math.round(Support.getDistance(x, y, z, x2, y2, z2));
if(d == 0 && hasChest) {
placeCenterChestWithLootTable(chunk, currBlockPos, this.centerChestLootTable, random, true);
} else if (d <= (this.radius - this.shellRadius - 1)) {
Expand Down
Loading

0 comments on commit 1eb5684

Please sign in to comment.