Skip to content

Commit

Permalink
convert vegetation features
Browse files Browse the repository at this point in the history
  • Loading branch information
MBatt1 committed Aug 11, 2024
1 parent ea22b1f commit d97f9cc
Show file tree
Hide file tree
Showing 28 changed files with 637 additions and 228 deletions.
1 change: 0 additions & 1 deletion src/main/java/net/id/paradiselost/ParadiseLost.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ public void onInitializeClient() {
ParadiseLostTextures.initClient();
ParadiseLostItemRenderers.initClient();
ParadiseLostScreens.initClient();
ParadiseLostScreens.clientInit();
}

@Environment(EnvType.CLIENT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void grow(ServerWorld world, Random random, BlockPos pos, BlockState stat
}
placedFeature = ((RandomPatchFeatureConfig) list.get(0).config()).feature();
} else {
placedFeature = ParadiseLostVegetationPlacedFeatures.GRASS_BONEMEAL;
placedFeature = ParadiseLostVegetationPlacedFeatures.GRASS;
}
placedFeature.value().generateUnregistered(world, world.getChunkManager().getChunkGenerator(), random, blockPos2);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class FruitingLeavesBlock extends ParadiseLostLeavesBlock {
private final Supplier<Item> fruit;

public FruitingLeavesBlock(Settings settings, Supplier<Item> fruit) {
super(settings, true);
super(settings);
this.fruit = fruit;
setDefaultState(getDefaultState().with(GROWTH, 0).with(CAPPED, false).with(NATURAL, false));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ public class ParadiseLostFeatures {
public static final GroundcoverFeature GROUNDCOVER_FEATURE = register("groundcover_feature", new GroundcoverFeature(GroundcoverFeatureConfig.CODEC));
public static final ParadiseLostBoulderFeature BOULDER = register("boulder", new ParadiseLostBoulderFeature(BoulderFeatureConfig.CODEC));
public static final VitrouliteSpireFeature VITROULITE_SPIRE_FEATURE = register("vitroulite_spire", new VitrouliteSpireFeature(DefaultFeatureConfig.CODEC));
public static final FreezeParadiseLostTopLayerFeature FREEZE_TOP_LAYER_FEATURE_FEATURE = register("freeze_top_layer_feature", new FreezeParadiseLostTopLayerFeature(DefaultFeatureConfig.CODEC));

public static final ProjectedOrganicCoverFeature ORGANIC_GROUNDCOVER_FEATURE = register("organic_groundcover_feature", new ProjectedOrganicCoverFeature(ProjectedOrganicCoverConfig.CODEC));

public static final HoneyNettleFeature HONEY_NETTLE_FEATURE = register("honey_nettle_feature", new HoneyNettleFeature(DefaultFeatureConfig.CODEC));
public static final HoneyNettleFeature HONEY_NETTLE_FEATURE = register("honey_nettle", new HoneyNettleFeature(DefaultFeatureConfig.CODEC));

public static final PillarFeature PILLAR_FEATURE = register("pillar_feature", new PillarFeature(LongFeatureConfig.CODEC));
public static final FallenPillarFeature FALLEN_PILLAR_FEATURE = register("fallen_pillar_feature", new FallenPillarFeature(LongFeatureConfig.CODEC));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
package net.id.paradiselost.world.feature.configured_features;

import net.id.paradiselost.world.feature.placed_features.ParadiseLostPlacedFeatures;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.Identifier;
import net.minecraft.world.gen.feature.*;
import net.minecraft.world.gen.placementmodifier.PlacementModifier;
import net.minecraft.world.gen.root.MangroveRootPlacer;
import net.minecraft.world.gen.stateprovider.BlockStateProvider;

import java.util.List;

import static net.id.paradiselost.ParadiseLost.locate;
import static net.id.paradiselost.blocks.ParadiseLostBlocks.*;

/**
* Folks extend this class to get the ooey-gooey goodness of shared Config stuff.
Expand All @@ -26,55 +16,9 @@ public class ParadiseLostConfiguredFeatures {
return RegistryKey.of(RegistryKeys.CONFIGURED_FEATURE, locate(id));
}

// protected static <FC extends FeatureConfig, F extends Feature<FC>> RegistryEntry<ConfiguredFeature<FC, ?>> register(String id, F feature, FC featureConfig) {
// return register(BuiltinRegistries.CONFIGURED_FEATURE, id, new ConfiguredFeature<>(feature, featureConfig));
// }
//
// private static <V extends T, T> RegistryEntry<V> register(Registry<T> registry, String id, V value) {
// return (RegistryEntry<V>) BuiltinRegistries.<T>add(registry, locate(id), value);
// }

public static void init() {
ParadiseLostTreeConfiguredFeatures.init();
ParadiseLostVegetationConfiguredFeatures.init();
ParadiseLostMiscConfiguredFeatures.init();
}

public static class Configs {
static RandomPatchFeatureConfig blockPatch(int tries, int hSpread, int ySpread, BlockState state) {
return blockPatch(tries, hSpread, ySpread, BlockStateProvider.of(state));
}
static RandomPatchFeatureConfig blockPatch(int tries, int hSpread, int ySpread, Block block) {
return blockPatch(tries, hSpread, ySpread, BlockStateProvider.of(block));
}
static RandomPatchFeatureConfig blockPatch(int tries, int hSpread, int ySpread, BlockStateProvider provider) {
return new RandomPatchFeatureConfig(
tries, hSpread, ySpread,
singleBlock(provider, ParadiseLostPlacedFeatures.ON_SOLID_GROUND)
);
}
static SimpleBlockFeatureConfig singleBlockConfig(BlockStateProvider provider) {
return new SimpleBlockFeatureConfig(provider);
}
static SimpleBlockFeatureConfig singleBlockConfig(Block block) {
return singleBlockConfig(BlockStateProvider.of(block));
}
static RegistryEntry<PlacedFeature> singleBlock(BlockStateProvider provider) {
return PlacedFeatures.createEntry(Feature.SIMPLE_BLOCK, singleBlockConfig(provider));
}
static RegistryEntry<PlacedFeature> singleBlock(Block block) {
return singleBlock(BlockStateProvider.of(block));
}

static RegistryEntry<PlacedFeature> singleBlock(BlockStateProvider provider, PlacementModifier... modifiers) {
return PlacedFeatures.createEntry(Feature.SIMPLE_BLOCK, new SimpleBlockFeatureConfig(provider), modifiers);
}
static RegistryEntry<PlacedFeature> singleBlock(Block block, PlacementModifier... modifiers) {
return singleBlock(BlockStateProvider.of(block), modifiers);
}

protected static <C extends FeatureConfig, F extends Feature<C>> F register(String name, F feature) {
return Registry.register(Registry.FEATURE, locate(name), feature);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,33 +1,7 @@
package net.id.paradiselost.world.feature.configured_features;

import net.id.paradiselost.world.feature.ParadiseLostFeatures;
import net.id.paradiselost.world.feature.configs.BoulderFeatureConfig;
import net.id.paradiselost.world.feature.configs.GroundcoverFeatureConfig;
import net.id.paradiselost.world.feature.configs.JaggedOreConfig;
import net.id.paradiselost.world.feature.placed_features.ParadiseLostPlacedFeatures;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.SlabBlock;
import net.minecraft.block.enums.SlabType;
import net.minecraft.fluid.Fluids;
import net.minecraft.registry.RegistryKey;
import net.minecraft.state.property.Properties;
import net.minecraft.structure.rule.BlockMatchRuleTest;
import net.minecraft.util.collection.DataPool;
import net.minecraft.util.math.intprovider.ConstantIntProvider;
import net.minecraft.util.math.intprovider.IntProvider;
import net.minecraft.util.math.intprovider.UniformIntProvider;
import net.minecraft.util.registry.RegistryEntry;
import net.minecraft.util.registry.RegistryEntryList;
import net.minecraft.world.gen.feature.*;
import net.minecraft.world.gen.placementmodifier.BlockFilterPlacementModifier;
import net.minecraft.world.gen.stateprovider.BlockStateProvider;
import net.minecraft.world.gen.stateprovider.WeightedBlockStateProvider;

import java.util.List;

import static net.id.paradiselost.blocks.ParadiseLostBlocks.*;

public class ParadiseLostMiscConfiguredFeatures extends ParadiseLostConfiguredFeatures {
/*
Expand Down
Loading

0 comments on commit d97f9cc

Please sign in to comment.