Skip to content

Commit

Permalink
Finished most of 1.17s new blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
DaFuqs committed Jun 25, 2021
1 parent bd3bb79 commit f1b6504
Show file tree
Hide file tree
Showing 21 changed files with 623 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,15 @@ public enum SpheroidAdvancementIdentifier {
stronghold,
end_city,
nether_fortress,
water
water,
dripstone,
powder_snow,
amethyst,
rooted_dirt,
copper,
cobbled_deepslate,
deepslate,
tuff,
azalea_wood,
tinted_glass
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,17 @@ public SpheroidAdvancementIdentifierGroups() {
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.stronghold, SpheroidAdvancementGroup.RARE);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.nether_fortress, SpheroidAdvancementGroup.NETHER);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.end_city, SpheroidAdvancementGroup.END);

spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.dripstone, SpheroidAdvancementGroup.UNCOMMON);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.powder_snow, SpheroidAdvancementGroup.UNCOMMON);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.amethyst, SpheroidAdvancementGroup.RARE);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.rooted_dirt, SpheroidAdvancementGroup.UNCOMMON);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.copper, SpheroidAdvancementGroup.ORES);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.cobbled_deepslate, SpheroidAdvancementGroup.COMMON);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.deepslate, SpheroidAdvancementGroup.COMMON);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.tuff, SpheroidAdvancementGroup.UNCOMMON);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.azalea_wood, SpheroidAdvancementGroup.WOOD);
spheroidAdvancementIdentifierGroups.put(SpheroidAdvancementIdentifier.tinted_glass, SpheroidAdvancementGroup.RARE);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
public class BambooDecorator extends SpheroidDecorator {

private static final Block bambooBlock = Blocks.BAMBOO;
private static final int BAMBOO_CHANCE = 11;
private static final int BAMBOO_CHANCE = 13;
private static BlockState bambooBlockState;
private static BlockState bambooSaplingBlockState;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package de.dafuqs.starrysky.dimension.decorators;

import com.google.common.collect.ImmutableList;
import de.dafuqs.starrysky.dimension.SpheroidDecorator;
import de.dafuqs.starrysky.spheroid.spheroids.Spheroid;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.gen.feature.GlowLichenFeature;
import net.minecraft.world.gen.feature.GlowLichenFeatureConfig;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;

public class GlowLichenDecorator extends SpheroidDecorator {

// TODO: TEST
private final List<BlockState> placeableOn = ImmutableList.of(Blocks.STONE.getDefaultState(), Blocks.ANDESITE.getDefaultState(), Blocks.DIORITE.getDefaultState(), Blocks.GRANITE.getDefaultState(), Blocks.DRIPSTONE_BLOCK.getDefaultState(), Blocks.CALCITE.getDefaultState(), Blocks.TUFF.getDefaultState(), Blocks.DEEPSLATE.getDefaultState());
private final GlowLichenFeatureConfig glowLichenFeatureConfig = new GlowLichenFeatureConfig(5, true, true, true, 0.5F, placeableOn);
private final float chance;

public GlowLichenDecorator(float chance) {
this.chance = chance;
}

@Override
public void decorateSpheroid(StructureWorldAccess world, Spheroid spheroid, ArrayList<BlockPos> decorationBlockPositions, Random random) {
for(BlockPos bp : decorationBlockPositions) {
if(random.nextFloat() < chance) {
GlowLichenFeature.generate(world, bp, world.getBlockState(bp), glowLichenFeatureConfig, random, Arrays.asList(Direction.values()));
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package de.dafuqs.starrysky.dimension.decorators;

import de.dafuqs.starrysky.dimension.SpheroidDecorator;
import de.dafuqs.starrysky.spheroid.spheroids.Spheroid;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.tag.BlockTags;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.StructureWorldAccess;

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

public class PointedDripstoneDecorator extends SpheroidDecorator {

private final float chance;
private final PointedDripstoneDecoratorMode mode;

public enum PointedDripstoneDecoratorMode {
UP,
DOWN,
CAVE
}

public PointedDripstoneDecorator(float chance, PointedDripstoneDecoratorMode mode) {
this.chance = chance;
this.mode = mode;
}

@Override
public void decorateSpheroid(StructureWorldAccess world, Spheroid spheroid, ArrayList<BlockPos> decorationBlockPositions, Random random) {
for(BlockPos bp : decorationBlockPositions) {
if(random.nextFloat() < chance) {
int height = random.nextInt(5);
switch (this.mode) {
case UP -> {
placeDripstoneBlocks(world, bp, height, Direction.UP);
}
case DOWN -> {
placeDripstoneBlocks(world, bp, height, Direction.DOWN);
}
case CAVE -> {
if(random.nextBoolean()) {
placeDripstoneBlocks(world, bp, height, Direction.UP);
} else {
BlockPos.Mutable mutable = bp.mutableCopy();
for(int i = 0; i < spheroid.getRadius(); ++i) {
if (!world.isAir(bp)) {
placeDripstoneBlocks(world, bp, height, Direction.UP);
}
}
}
}
}

}
}
}

private void placeDripstoneBlocks(StructureWorldAccess world, BlockPos pos, int height, Direction direction) {
BlockPos.Mutable mutable = pos.mutableCopy();
for(int i = 0; i < height; ++i) {
if (!generateDripstoneBlock(world, mutable)) {
return;
}
mutable.move(direction);
}
}

protected static boolean generateDripstoneBlock(StructureWorldAccess world, BlockPos pos) {
BlockState blockState = world.getBlockState(pos);
if (blockState.isIn(BlockTags.DRIPSTONE_REPLACEABLE_BLOCKS)) {
world.setBlockState(pos, Blocks.DRIPSTONE_BLOCK.getDefaultState(), 2);
return true;
} else {
return false;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class SpheroidEntitySpawnDefinitions {
public static SpheroidEntitySpawnDefinition PANDA = new SpheroidEntitySpawnDefinition(EntityType.PANDA, 1, 3);
public static SpheroidEntitySpawnDefinition POLAR_BEAR = new SpheroidEntitySpawnDefinition(EntityType.POLAR_BEAR, 1, 2);
public static SpheroidEntitySpawnDefinition WOLF = new SpheroidEntitySpawnDefinition(EntityType.WOLF, 3, 5);
public static SpheroidEntitySpawnDefinition GOAT = new SpheroidEntitySpawnDefinition(EntityType.GOAT, 1, 3);

// aquatic
// TODO: spawn them
Expand All @@ -30,9 +31,12 @@ public class SpheroidEntitySpawnDefinitions {
public static SpheroidEntitySpawnDefinition COD = new SpheroidEntitySpawnDefinition(EntityType.COD, 2, 5);
public static SpheroidEntitySpawnDefinition TROPICAL_FISH = new SpheroidEntitySpawnDefinition(EntityType.TROPICAL_FISH, 2, 5);
public static SpheroidEntitySpawnDefinition PUFFERFISH = new SpheroidEntitySpawnDefinition(EntityType.PUFFERFISH, 2, 5);
public static SpheroidEntitySpawnDefinition GLOW_SQUID = new SpheroidEntitySpawnDefinition(EntityType.GLOW_SQUID, 2, 4);
public static SpheroidEntitySpawnDefinition AXOLOTL = new SpheroidEntitySpawnDefinition(EntityType.AXOLOTL, 2, 3);

// flying
//public static SpheroidEntitySpawnDefinition BAT = new SpheroidEntitySpawnDefinition(EntityType.BAT, 2, 5);
// TODO: spawn them
public static SpheroidEntitySpawnDefinition BAT = new SpheroidEntitySpawnDefinition(EntityType.BAT, 2, 5);

// NETHER
public static SpheroidEntitySpawnDefinition HOGLIN = new SpheroidEntitySpawnDefinition(EntityType.HOGLIN, 4, 6);
Expand Down
50 changes: 31 additions & 19 deletions src/main/java/de/dafuqs/starrysky/spheroid/lists/SpheroidList.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ protected static BlockState getDefaultBlockState(String modId, String string) {


//COMMONLY USED LISTS
public static final LinkedHashMap<BlockState, Float> MAP_STONES = new LinkedHashMap<BlockState, Float>() {{
public static final LinkedHashMap<BlockState, Float> MAP_STONES = new LinkedHashMap<>() {{
put(Blocks.STONE.getDefaultState(), 5.0F);
put(Blocks.GRANITE.getDefaultState(), 1.0F);
put(Blocks.DIORITE.getDefaultState(), 1.0F);
Expand All @@ -39,18 +39,27 @@ protected static BlockState getDefaultBlockState(String modId, String string) {
put(Blocks.INFESTED_COBBLESTONE.getDefaultState(), 0.002F);
}};

public static final LinkedHashMap<BlockState, Float> MAP_DUNGEON_STONES = new LinkedHashMap<BlockState, Float>() {{
public static final LinkedHashMap<BlockState, Float> MAP_DUNGEON_STONES = new LinkedHashMap<>() {{
put(Blocks.MOSSY_COBBLESTONE.getDefaultState(), 5.0F);
put(Blocks.INFESTED_COBBLESTONE.getDefaultState(), 0.5F);
put(Blocks.STONE.getDefaultState(), 1.0F);
put(Blocks.DEEPSLATE.getDefaultState(), 1.0F);
put(Blocks.GRANITE.getDefaultState(), 0.2F);
put(Blocks.DIORITE.getDefaultState(), 0.2F);
put(Blocks.ANDESITE.getDefaultState(), 0.2F);
put(Blocks.COBBLESTONE.getDefaultState(), 0.1F);
put(Blocks.COBBLED_DEEPSLATE.getDefaultState(), 0.1F);
put(Blocks.INFESTED_STONE.getDefaultState(), 0.1F);
put(Blocks.INFESTED_DEEPSLATE.getDefaultState(), 0.1F);
}};

public static final LinkedHashMap<BlockState, Float> MAP_GLASS = new LinkedHashMap<BlockState, Float>() {{
public static final LinkedHashMap<BlockState, Float> MAP_DEEPSLATE = new LinkedHashMap<>() {{
put(Blocks.DEEPSLATE.getDefaultState(), 5.0F);
put(Blocks.INFESTED_DEEPSLATE.getDefaultState(), 0.5F);
put(Blocks.COBBLED_DEEPSLATE.getDefaultState(), 1.0F);
}};

public static final LinkedHashMap<BlockState, Float> MAP_GLASS = new LinkedHashMap<>() {{
put(Blocks.GLASS.getDefaultState(), 100F);
put(Blocks.BLACK_STAINED_GLASS.getDefaultState(), 1.0F);
put(Blocks.BLUE_STAINED_GLASS.getDefaultState(), 1.0F);
Expand All @@ -68,23 +77,24 @@ protected static BlockState getDefaultBlockState(String modId, String string) {
put(Blocks.RED_STAINED_GLASS.getDefaultState(), 1.0F);
put(Blocks.WHITE_STAINED_GLASS.getDefaultState(), 1.0F);
put(Blocks.YELLOW_STAINED_GLASS.getDefaultState(), 1.0F);
put(Blocks.TINTED_GLASS.getDefaultState(), 1.0F);
}};

public static final LinkedHashMap<BlockState, Float> MAP_MOUNTAIN_STONES = new LinkedHashMap<BlockState, Float>() {{
public static final LinkedHashMap<BlockState, Float> MAP_MOUNTAIN_STONES = new LinkedHashMap<>() {{
put(Blocks.STONE.getDefaultState(), 1.0F);
put(Blocks.INFESTED_STONE.getDefaultState(), 1.0F);
}};
public static final LinkedHashMap<BlockState, Float> MAP_OCEAN_STONES = new LinkedHashMap<BlockState, Float>() {{
public static final LinkedHashMap<BlockState, Float> MAP_OCEAN_STONES = new LinkedHashMap<>() {{
put(Blocks.CLAY.getDefaultState(), 1.0F);
put(Blocks.PRISMARINE.getDefaultState(), 1.0F);
}};
public static final LinkedHashMap<BlockState, Float> MAP_JUNGLE_STONES = new LinkedHashMap<BlockState, Float>() {{
public static final LinkedHashMap<BlockState, Float> MAP_JUNGLE_STONES = new LinkedHashMap<>() {{
put(Blocks.COARSE_DIRT.getDefaultState(), 1.0F);
}};


// RAINBOW STUFF
public static final ArrayList<BlockState> LIST_WOOL = new ArrayList<BlockState>() {{
public static final ArrayList<BlockState> LIST_WOOL = new ArrayList<>() {{
add(Blocks.WHITE_WOOL.getDefaultState());
add(Blocks.LIGHT_GRAY_WOOL.getDefaultState());
add(Blocks.GRAY_WOOL.getDefaultState());
Expand All @@ -103,7 +113,7 @@ protected static BlockState getDefaultBlockState(String modId, String string) {
add(Blocks.PINK_WOOL.getDefaultState());
}};

public static final ArrayList<BlockState> LIST_STAINED_GLASS = new ArrayList<BlockState>() {{
public static final ArrayList<BlockState> LIST_STAINED_GLASS = new ArrayList<>() {{
add(Blocks.WHITE_STAINED_GLASS.getDefaultState());
add(Blocks.LIGHT_GRAY_STAINED_GLASS.getDefaultState());
add(Blocks.GRAY_STAINED_GLASS.getDefaultState());
Expand All @@ -122,7 +132,7 @@ protected static BlockState getDefaultBlockState(String modId, String string) {
add(Blocks.PINK_STAINED_GLASS.getDefaultState());
}};

public static final ArrayList<BlockState> LIST_CONCRETE = new ArrayList<BlockState>() {{
public static final ArrayList<BlockState> LIST_CONCRETE = new ArrayList<>() {{
add(Blocks.WHITE_CONCRETE.getDefaultState());
add(Blocks.LIGHT_GRAY_CONCRETE.getDefaultState());
add(Blocks.GRAY_CONCRETE.getDefaultState());
Expand All @@ -141,7 +151,7 @@ protected static BlockState getDefaultBlockState(String modId, String string) {
add(Blocks.PINK_CONCRETE.getDefaultState());
}};

public static final ArrayList<BlockState> LIST_TERRACOTTA = new ArrayList<BlockState>() {{
public static final ArrayList<BlockState> LIST_TERRACOTTA = new ArrayList<>() {{
add(Blocks.WHITE_TERRACOTTA.getDefaultState());
add(Blocks.LIGHT_GRAY_TERRACOTTA.getDefaultState());
add(Blocks.GRAY_TERRACOTTA.getDefaultState());
Expand All @@ -160,15 +170,15 @@ protected static BlockState getDefaultBlockState(String modId, String string) {
add(Blocks.PINK_TERRACOTTA.getDefaultState());
}};

public static final ArrayList<BlockState> LIST_FULL_CORAL_BLOCKS = new ArrayList<BlockState>() {{
public static final ArrayList<BlockState> LIST_FULL_CORAL_BLOCKS = new ArrayList<>() {{
add(Blocks.BRAIN_CORAL_BLOCK.getDefaultState());
add(Blocks.TUBE_CORAL_BLOCK.getDefaultState());
add(Blocks.BUBBLE_CORAL_BLOCK.getDefaultState());
add(Blocks.FIRE_CORAL_BLOCK.getDefaultState());
add(Blocks.HORN_CORAL_BLOCK.getDefaultState());
}};

public static final ArrayList<BlockState> LIST_WATERLOGGABLE_CORAL_BLOCKS = new ArrayList<BlockState>() {{
public static final ArrayList<BlockState> LIST_WATERLOGGABLE_CORAL_BLOCKS = new ArrayList<>() {{
add(Blocks.BRAIN_CORAL.getDefaultState().with(CoralParentBlock.WATERLOGGED, true));
add(Blocks.TUBE_CORAL.getDefaultState().with(CoralParentBlock.WATERLOGGED, true));
add(Blocks.BUBBLE_CORAL.getDefaultState().with(CoralParentBlock.WATERLOGGED, true));
Expand All @@ -187,7 +197,7 @@ protected static BlockState getDefaultBlockState(String modId, String string) {
add(Blocks.SEA_PICKLE.getDefaultState().with(SeaPickleBlock.WATERLOGGED, true).with(SeaPickleBlock.PICKLES, 4));
}};

public static ArrayList<BlockState> LIST_FLOWERS = new ArrayList<BlockState>() {{
public static ArrayList<BlockState> LIST_FLOWERS = new ArrayList<>() {{
add(Blocks.DANDELION.getDefaultState());
add(Blocks.POPPY.getDefaultState());
add(Blocks.BLUE_ORCHID.getDefaultState());
Expand All @@ -204,9 +214,11 @@ protected static BlockState getDefaultBlockState(String modId, String string) {
add(Blocks.LILAC.getDefaultState());
add(Blocks.ROSE_BUSH.getDefaultState());
add(Blocks.PEONY.getDefaultState());
add(Blocks.AZALEA.getDefaultState());
add(Blocks.FLOWERING_AZALEA.getDefaultState());
}};

public static ArrayList<BlockState> LIST_TALL_FLOWERS = new ArrayList<BlockState>() {{
public static ArrayList<BlockState> LIST_TALL_FLOWERS = new ArrayList<>() {{
add(Blocks.SUNFLOWER.getDefaultState());
add(Blocks.LILAC.getDefaultState());
add(Blocks.ROSE_BUSH.getDefaultState());
Expand All @@ -216,21 +228,21 @@ protected static BlockState getDefaultBlockState(String modId, String string) {
}};

//// NETHER
public static final LinkedHashMap<BlockState, Float> MAP_NETHER_STONES = new LinkedHashMap<BlockState, Float>() {{
public static final LinkedHashMap<BlockState, Float> MAP_NETHER_STONES = new LinkedHashMap<>() {{
put(Blocks.NETHERRACK.getDefaultState(), 5.0F);
put(Blocks.BASALT.getDefaultState(), 1.0F);
put(Blocks.MAGMA_BLOCK.getDefaultState(), 1.0F);
}};

public static final LinkedHashMap<BlockState, Float> MAP_NETHER_DUNGEON_STONES = new LinkedHashMap<BlockState, Float>() {{
public static final LinkedHashMap<BlockState, Float> MAP_NETHER_DUNGEON_STONES = new LinkedHashMap<>() {{
put(Blocks.NETHER_BRICKS.getDefaultState(), 5.0F);
put(Blocks.BLACKSTONE.getDefaultState(), 1.0F);
put(Blocks.NETHERRACK.getDefaultState(), 0.5F);
put(Blocks.MAGMA_BLOCK.getDefaultState(), 0.2F);
put(Blocks.OBSIDIAN.getDefaultState(), 0.2F);
}};

public static final LinkedHashMap<BlockState, Float> MAP_NETHER_GLASS = new LinkedHashMap<BlockState, Float>() {{
public static final LinkedHashMap<BlockState, Float> MAP_NETHER_GLASS = new LinkedHashMap<>() {{
put(Blocks.BLACK_STAINED_GLASS.getDefaultState(), 1.0F);
put(Blocks.ORANGE_STAINED_GLASS.getDefaultState(), 1.0F);
put(Blocks.RED_STAINED_GLASS.getDefaultState(), 1.0F);
Expand All @@ -239,11 +251,11 @@ protected static BlockState getDefaultBlockState(String modId, String string) {


//// END
public static final LinkedHashMap<BlockState, Float> MAP_END_STONES = new LinkedHashMap<BlockState, Float>() {{
public static final LinkedHashMap<BlockState, Float> MAP_END_STONES = new LinkedHashMap<>() {{
put(Blocks.END_STONE.getDefaultState(), 10.0F);
}};

public static final LinkedHashMap<BlockState, Float> MAP_END_DUNGEON_STONES = new LinkedHashMap<BlockState, Float>() {{
public static final LinkedHashMap<BlockState, Float> MAP_END_DUNGEON_STONES = new LinkedHashMap<>() {{
put(Blocks.END_STONE_BRICKS.getDefaultState(), 10.0F);
put(Blocks.PURPUR_BLOCK.getDefaultState(), 5.0F);
put(Blocks.END_STONE.getDefaultState(), 1.0F);
Expand Down
Loading

0 comments on commit f1b6504

Please sign in to comment.