Skip to content

Commit

Permalink
improvements for giant structure spheres
Browse files Browse the repository at this point in the history
  • Loading branch information
DaFuqs committed Sep 25, 2021
1 parent 6df6f3b commit 3945776
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,18 @@ public void generate(Chunk chunk) {
@Override
public void decorate(StructureWorldAccess world, Random random, BlockPos origin) {
for (BlockPos interiorDecoratorPosition : interiorDecoratorPositions) {
int randomStructure = random.nextInt(8);
switch (randomStructure) {
case 0 -> placeSolid(world, interiorDecoratorPosition);
case 1 -> placeEmpty(world, interiorDecoratorPosition);
case 2 -> placeElytra(world, interiorDecoratorPosition);
case 3 -> placeTreasure(world, interiorDecoratorPosition);
case 4 -> placeBrewingStand(world, interiorDecoratorPosition);
case 5 -> placeDragonHead(world, interiorDecoratorPosition);
// double chance
default -> placeShulkerSpawner(world, interiorDecoratorPosition);
if(Support.inSameChunk(origin, interiorDecoratorPosition)) {
int randomStructure = random.nextInt(8);
switch (randomStructure) {
case 0 -> placeSolid(world, interiorDecoratorPosition);
case 1 -> placeEmpty(world, interiorDecoratorPosition);
case 2 -> placeElytra(world, interiorDecoratorPosition);
case 3 -> placeTreasure(world, interiorDecoratorPosition);
case 4 -> placeBrewingStand(world, interiorDecoratorPosition);
case 5 -> placeDragonHead(world, interiorDecoratorPosition);
// double chance
default -> placeShulkerSpawner(world, interiorDecoratorPosition);
}
}
}
}
Expand Down Expand Up @@ -224,8 +226,7 @@ private void placeElytra(WorldAccess worldAccess, BlockPos blockPos) {
ItemStack elytraItemStack = new ItemStack(Items.ELYTRA, 1);

BlockEntity blockEntity = worldAccess.getBlockEntity(blockPos.up());
if(blockEntity instanceof ChestBlockEntity) {
ChestBlockEntity chestBlockEntity = (ChestBlockEntity) blockEntity;
if(blockEntity instanceof ChestBlockEntity chestBlockEntity) {
chestBlockEntity.setStack(0, elytraItemStack);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,17 @@ public void generate(Chunk chunk) {
@Override
public void decorate(StructureWorldAccess world, Random random, BlockPos origin) {
for (BlockPos interiorDecoratorPosition : interiorDecoratorPositions) {
int randomStructure = random.nextInt(7);
switch (randomStructure) {
case 0 -> placeBlazeSpawnerRoom(world, interiorDecoratorPosition);
case 1 -> placeWitherSkeletonRoom(world, interiorDecoratorPosition);
case 2 -> placeNetherWartRoom(world, interiorDecoratorPosition);
case 3 -> placeSolid(world, interiorDecoratorPosition);
case 4 -> placeEmpty(world, interiorDecoratorPosition);
case 5 -> placeLava(world, interiorDecoratorPosition);
default -> placeChestRoom(world, interiorDecoratorPosition);
if(Support.inSameChunk(origin, interiorDecoratorPosition)) {
int randomStructure = random.nextInt(7);
switch (randomStructure) {
case 0 -> placeBlazeSpawnerRoom(world, interiorDecoratorPosition);
case 1 -> placeWitherSkeletonRoom(world, interiorDecoratorPosition);
case 2 -> placeNetherWartRoom(world, interiorDecoratorPosition);
case 3 -> placeSolid(world, interiorDecoratorPosition);
case 4 -> placeEmpty(world, interiorDecoratorPosition);
case 5 -> placeLava(world, interiorDecoratorPosition);
default -> placeChestRoom(world, interiorDecoratorPosition);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,19 +125,23 @@ public void generate(Chunk chunk) {
@Override
public void decorate(StructureWorldAccess world, Random random, BlockPos origin) {
if(portalPosition != null) {
placeEndPortal(world, portalPosition.up());
if(Support.inSameChunk(origin, portalPosition)) {
placeEndPortal(world, portalPosition.up());
}
} else {
StarrySkyCommon.log(WARN, "Generating a Stronghold Spheroid at " + position.getX() + " " + position.getY() + " " + position.getZ() + " without an end portal?");
}

for (BlockPos interiorDecoratorPosition : interiorDecoratorPositions) {
int randomStructure = random.nextInt(5);
switch (randomStructure) {
case 0 -> placeLibrary(world, interiorDecoratorPosition);
case 1 -> placeCorridor(world, interiorDecoratorPosition);
case 2 -> placeCrossing(world, interiorDecoratorPosition);
case 3 -> placePrison(world, interiorDecoratorPosition);
default -> placeFullCube(world, interiorDecoratorPosition);
if(Support.inSameChunk(origin, interiorDecoratorPosition)) {
int randomStructure = random.nextInt(5);
switch (randomStructure) {
case 0 -> placeLibrary(world, interiorDecoratorPosition);
case 1 -> placeCorridor(world, interiorDecoratorPosition);
case 2 -> placeCrossing(world, interiorDecoratorPosition);
case 3 -> placePrison(world, interiorDecoratorPosition);
default -> placeFullCube(world, interiorDecoratorPosition);
}
}
}
}
Expand Down

0 comments on commit 3945776

Please sign in to comment.