-
Notifications
You must be signed in to change notification settings - Fork 267
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Started on Dead Coral generation, improvements to Anomaly generation
- Loading branch information
Showing
20 changed files
with
511 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
common/src/generated/resources/data/biomesoplenty/worldgen/configured_feature/barnacles.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"type": "biomesoplenty:barnacles", | ||
"config": {} | ||
} |
28 changes: 28 additions & 0 deletions
28
...on/src/generated/resources/data/biomesoplenty/worldgen/configured_feature/dead_coral.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"type": "minecraft:simple_random_selector", | ||
"config": { | ||
"features": [ | ||
{ | ||
"feature": { | ||
"type": "biomesoplenty:dead_coral_tree", | ||
"config": {} | ||
}, | ||
"placement": [] | ||
}, | ||
{ | ||
"feature": { | ||
"type": "biomesoplenty:dead_coral_claw", | ||
"config": {} | ||
}, | ||
"placement": [] | ||
}, | ||
{ | ||
"feature": { | ||
"type": "biomesoplenty:dead_coral_mushroom", | ||
"config": {} | ||
}, | ||
"placement": [] | ||
} | ||
] | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
common/src/generated/resources/data/biomesoplenty/worldgen/placed_feature/barnacles.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"feature": "biomesoplenty:barnacles", | ||
"placement": [ | ||
{ | ||
"type": "minecraft:count", | ||
"count": 4 | ||
}, | ||
{ | ||
"type": "minecraft:in_square" | ||
}, | ||
{ | ||
"type": "minecraft:heightmap", | ||
"heightmap": "MOTION_BLOCKING" | ||
}, | ||
{ | ||
"type": "minecraft:biome" | ||
} | ||
] | ||
} |
21 changes: 21 additions & 0 deletions
21
common/src/generated/resources/data/biomesoplenty/worldgen/placed_feature/dead_coral.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"feature": "biomesoplenty:dead_coral", | ||
"placement": [ | ||
{ | ||
"type": "minecraft:noise_based_count", | ||
"noise_factor": 400.0, | ||
"noise_offset": 0.0, | ||
"noise_to_count_ratio": 20 | ||
}, | ||
{ | ||
"type": "minecraft:in_square" | ||
}, | ||
{ | ||
"type": "minecraft:heightmap", | ||
"heightmap": "OCEAN_FLOOR_WG" | ||
}, | ||
{ | ||
"type": "minecraft:biome" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
common/src/main/java/biomesoplenty/worldgen/feature/misc/BarnacleFeature.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/******************************************************************************* | ||
* Copyright 2022, the Glitchfiend Team. | ||
* All rights reserved. | ||
******************************************************************************/ | ||
package biomesoplenty.worldgen.feature.misc; | ||
|
||
import biomesoplenty.api.block.BOPBlocks; | ||
import biomesoplenty.init.ModTags; | ||
import com.mojang.serialization.Codec; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.core.Direction; | ||
import net.minecraft.util.RandomSource; | ||
import net.minecraft.world.level.WorldGenLevel; | ||
import net.minecraft.world.level.block.Blocks; | ||
import net.minecraft.world.level.block.MultifaceBlock; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import net.minecraft.world.level.chunk.ChunkGenerator; | ||
import net.minecraft.world.level.levelgen.feature.Feature; | ||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext; | ||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; | ||
|
||
public class BarnacleFeature extends Feature<NoneFeatureConfiguration> | ||
{ | ||
public BarnacleFeature(Codec<NoneFeatureConfiguration> deserializer) | ||
{ | ||
super(deserializer); | ||
} | ||
|
||
@Override | ||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featurePlaceContext) | ||
{ | ||
WorldGenLevel worldIn = featurePlaceContext.level(); | ||
ChunkGenerator chunkGenerator = featurePlaceContext.chunkGenerator(); | ||
RandomSource rand = featurePlaceContext.random(); | ||
BlockPos pos = featurePlaceContext.origin(); | ||
NoneFeatureConfiguration config = featurePlaceContext.config(); | ||
int i = 0; | ||
int j = rand.nextInt(8 - 2) + 2; | ||
|
||
for (int k = pos.getX() - j; k <= pos.getX() + j; ++k) | ||
{ | ||
for (int l = pos.getZ() - j; l <= pos.getZ() + j; ++l) | ||
{ | ||
int i1 = k - pos.getX(); | ||
int j1 = l - pos.getZ(); | ||
if (i1 * i1 + j1 * j1 <= j * j) | ||
{ | ||
for (int k1 = pos.getY() - j; k1 <= pos.getY() + j; ++k1) | ||
{ | ||
BlockPos blockpos = new BlockPos(k, k1, l); | ||
BlockState blockstate = worldIn.getBlockState(blockpos); | ||
BlockState barnaclestate = BOPBlocks.BARNACLES.defaultBlockState(); | ||
|
||
int faces = 0; | ||
|
||
for (Direction direction : Direction.values()) | ||
{ | ||
BlockState blockstate1 = worldIn.getBlockState(blockpos.relative(direction)); | ||
if (blockstate1 == Blocks.END_STONE.defaultBlockState() || blockstate1 == BOPBlocks.ALGAL_END_STONE.defaultBlockState() || blockstate1.is(ModTags.Blocks.DEAD_CORAL_BLOCKS)) | ||
{ | ||
barnaclestate = barnaclestate.setValue(MultifaceBlock.getFaceProperty(direction), true); | ||
faces++; | ||
} | ||
} | ||
|
||
if (blockstate.isAir() && faces > 0) | ||
{ | ||
worldIn.setBlock(blockpos, barnaclestate, 2); | ||
|
||
++i; | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
return i > 0; | ||
} | ||
} |
Oops, something went wrong.