Skip to content

Commit

Permalink
1.1.0 backport, part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
lumiscosity committed Aug 14, 2024
1 parent 2bf1dfe commit 2abe07f
Show file tree
Hide file tree
Showing 50 changed files with 890 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/client/java/com/lumiscosity/rounded/RoundedClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ public class RoundedClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
BlockRenderLayerMap.INSTANCE.putBlock(RegisterBlocks.LUSTERSHROOM_PLANT, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(RegisterBlocks.PRISMARINE_LANTERN, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(RegisterBlocks.BLADDERWRACK, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(RegisterBlocks.DEAD_BLADDERWRACK, RenderLayer.getCutout());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package com.lumiscosity.rounded.worldgen;

import com.mojang.serialization.Codec;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.registry.tag.BlockTags;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.random.Random;
import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.SimpleBlockFeatureConfig;
import net.minecraft.world.gen.feature.util.FeatureContext;

public class OceanRockFeature extends Feature<SimpleBlockFeatureConfig> {
public OceanRockFeature(Codec<SimpleBlockFeatureConfig> codec) {
super(codec);
}

@Override
public boolean generate(FeatureContext<SimpleBlockFeatureConfig> context) {
BlockPos origin = context.getOrigin();
StructureWorldAccess structureWorldAccess = context.getWorld();
Random random = context.getRandom();

SimpleBlockFeatureConfig SimpleBlockFeatureConfig;
for (SimpleBlockFeatureConfig = context.getConfig(); origin.getY() > structureWorldAccess.getBottomY() + 3; origin = origin.down()) {
if (!structureWorldAccess.isAir(origin.down())) {
BlockState blockState = structureWorldAccess.getBlockState(origin.down());
if (isSoil(blockState) || isStone(blockState) || blockState.isIn(BlockTags.BASE_STONE_NETHER)) {
break;
}
}
}

if (origin.getY() <= structureWorldAccess.getBottomY() + 3) {
return false;
} else {
int[] heights = {
random.nextInt(7), random.nextInt(8), random.nextInt(7),
random.nextInt(8), random.nextInt(9), random.nextInt(8),
random.nextInt(7), random.nextInt(8), random.nextInt(7)
};

BlockPos.Mutable pos = new BlockPos.Mutable();
for (int i = 0; i < 9; i++) {
pos.set(origin.getX() + i % 3,origin.getY() - random.nextInt(3),origin.getZ() + i / 3);
for (int j = 0; j < heights[i]; j++) {
structureWorldAccess.setBlockState(pos, SimpleBlockFeatureConfig.toPlace().get(random, pos), Block.NOTIFY_ALL);
pos.move(Direction.UP);
}
}

return true;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.FeatureConfig;
import net.minecraft.world.gen.feature.HugeMushroomFeatureConfig;
import net.minecraft.world.gen.feature.SimpleBlockFeatureConfig;

import static com.lumiscosity.rounded.Rounded.MOD_ID;

Expand All @@ -37,10 +38,31 @@ public static void initFeatures() {
RegistryKey.of(RegistryKeys.PLACED_FEATURE, Identifier.of(MOD_ID, "bladderwrack"))
);

// Ocean floor rocks
// Ocean rocks
register_feature("ocean_rock", new OceanRockFeature(SimpleBlockFeatureConfig.CODEC));
BiomeModifications.addFeature(
BiomeSelectors.tag(TagKey.of(RegistryKeys.BIOME, Identifier.of(MOD_ID, "has_andesite_ocean_rocks"))),
GenerationStep.Feature.LOCAL_MODIFICATIONS,
RegistryKey.of(RegistryKeys.PLACED_FEATURE, Identifier.of(MOD_ID, "andesite_ocean_rock"))
);
BiomeModifications.addFeature(
BiomeSelectors.tag(TagKey.of(RegistryKeys.BIOME, Identifier.of(MOD_ID, "has_diorite_ocean_rocks"))),
GenerationStep.Feature.LOCAL_MODIFICATIONS,
RegistryKey.of(RegistryKeys.PLACED_FEATURE, Identifier.of(MOD_ID, "diorite_ocean_rock"))
);
BiomeModifications.addFeature(
BiomeSelectors.tag(TagKey.of(RegistryKeys.BIOME, Identifier.of(MOD_ID, "has_smooth_basalt_ocean_rocks"))),
GenerationStep.Feature.LOCAL_MODIFICATIONS,
RegistryKey.of(RegistryKeys.PLACED_FEATURE, Identifier.of(MOD_ID, "smooth_basalt_ocean_rock"))
);
BiomeModifications.addFeature(
BiomeSelectors.tag(TagKey.of(RegistryKeys.BIOME, Identifier.of(MOD_ID, "has_lava_ocean_rocks"))),
GenerationStep.Feature.LOCAL_MODIFICATIONS,
RegistryKey.of(RegistryKeys.PLACED_FEATURE, Identifier.of(MOD_ID, "lava_ocean_rock"))
);
}

private static <C extends FeatureConfig, F extends Feature<C>> F register_feature(String name, F feature) {
return Registry.register(Registries.FEATURE, Identifier.of(MOD_ID, name), feature);
private static <C extends FeatureConfig, F extends Feature<C>> void register_feature(String name, F feature) {
Registry.register(Registries.FEATURE, Identifier.of(MOD_ID, name), feature);
}
}
6 changes: 6 additions & 0 deletions src/main/resources/data/c/tags/worldgen/biome/is_nether.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"#minecraft:is_nether"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"rounded:lustershroom"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"rounded:lustershroom"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_log": {
"conditions": {
"items": [
{
"items": ["rounded:bladderwrack"]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "rounded:bladderwrack_block"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_log"
]
],
"rewards": {
"recipes": [
"rounded:bladderwrack_block"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_log": {
"conditions": {
"items": [
{
"items": ["minecraft:prismarine_bricks"]
}
]
},
"trigger": "minecraft:inventory_changed"
}
},
"requirements": [
[
"has_log"
]
],
"rewards": {
"recipes": [
"rounded:chiseled_prismarine_bricks",
"rounded:stonecutter/chiseled_prismarine_bricks"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_log": {
"conditions": {
"items": [
{
"items": ["rounded:dead_bladderwrack"]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "rounded:dead_bladderwrack_block"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_log"
]
],
"rewards": {
"recipes": [
"rounded:dead_bladderwrack_block"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_log": {
"conditions": {
"items": [
{
"items": ["minecraft:prismarine"]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "rounded:furnace/smooth_prismarine"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_log"
]
],
"rewards": {
"recipes": [
"rounded:furnace/smooth_prismarine"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_log": {
"conditions": {
"items": [
{
"items": ["rounded:smooth_prismarine"]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "rounded:moisture_detector"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_log"
]
],
"rewards": {
"recipes": [
"rounded:moisture_detector"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_log": {
"conditions": {
"items": [
{
"items": ["minecraft:prismarine_crystals"]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "rounded:prismarine_lantern"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_log"
]
],
"rewards": {
"recipes": [
"rounded:prismarine_lantern"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_log": {
"conditions": {
"items": [
{
"items": ["rounded:smooth_prismarine"]
}
]
},
"trigger": "minecraft:inventory_changed"
}
},
"requirements": [
[
"has_log"
]
],
"rewards": {
"recipes": [
"rounded:smooth_prismarine_slab",
"rounded:stonecutter/smooth_prismarine_slab"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:match_tool",
"predicate": {
"predicates": {
"minecraft:enchantments": [
{
"enchantments": "minecraft:silk_touch",
"levels": {
"min": 1
}
}
]
}
}
}
],
"entries": [
{
"type": "minecraft:item",
"name": "rounded:bladderwrack"
}
],
"rolls": 1.0
}
],
"random_sequence": "rounded:blocks/bladderwrack"
}
Loading

0 comments on commit 2abe07f

Please sign in to comment.