Skip to content

Commit

Permalink
config !!!
Browse files Browse the repository at this point in the history
  • Loading branch information
ianm1647 committed Mar 12, 2024
1 parent 8c4ee12 commit 1d222a9
Show file tree
Hide file tree
Showing 9 changed files with 179 additions and 93 deletions.
6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.3-SNAPSHOT'
id 'fabric-loom' version '1.5-SNAPSHOT'
id 'maven-publish'
}

Expand All @@ -14,6 +14,7 @@ repositories {
maven { url 'https://maven.shedaniel.me/' }
maven { url 'https://api.modrinth.com/maven' }
maven { url 'https://maven.terraformersmc.com/' }
maven { url "https://jitpack.io" }
}

dependencies {
Expand All @@ -24,6 +25,9 @@ dependencies {

modImplementation "maven.modrinth:farmers-delight-fabric:${project.delight_version}"

modImplementation 'com.github.draylar.omega-config:omega-config-base:1.2.3-1.18.1'
include 'com.github.draylar.omega-config:omega-config-base:1.2.3-1.18.1'

modCompileOnly "me.shedaniel:RoughlyEnoughItems-api-fabric:${project.rei_version}"
modRuntimeOnly "me.shedaniel:RoughlyEnoughItems-fabric:${project.rei_version}"

Expand Down
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ org.gradle.parallel=true
# check these on https://fabricmc.net/develop
minecraft_version=1.20.1
yarn_mappings=1.20.1+build.10
loader_version=0.14.21
loader_version=0.15.7

# Mod Properties
modid = expandeddelight
mod_version = 0.3.0.2
mod_version = 0.3.0.3
maven_group = com.ianm1647
archives_base_name = expandeddelight

# Dependencies
fabric_version=0.86.0+1.20.1
delight_version=1.4.1
rei_version=12.0.634
modmenu_version=7.2.1
fabric_version=0.92.0+1.20.1
delight_version=1.4.3
rei_version=12.0.684
modmenu_version=7.2.2
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.ianm1647.expandeddelight.registry.*;
import com.ianm1647.expandeddelight.util.UtilRegistries;
import com.ianm1647.expandeddelight.world.ModFeatureGeneration;
import draylar.omegaconfig.OmegaConfig;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
import net.minecraft.item.ItemGroup;
Expand All @@ -22,6 +23,8 @@ public class ExpandedDelight implements ModInitializer {
public static final Logger LOGGER = LoggerFactory.getLogger(MODID);
public static final RegistryKey<ItemGroup> GROUP = RegistryKey.of(RegistryKeys.ITEM_GROUP, new Identifier(MODID, "group"));

public static ExpandedDelightConfig CONFIG = OmegaConfig.register(ExpandedDelightConfig.class);

@Override
public void onInitialize() {
Registry.register(Registries.ITEM_GROUP, GROUP, FabricItemGroup.builder()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.ianm1647.expandeddelight;

import draylar.omegaconfig.api.Config;

public class ExpandedDelightConfig implements Config {
public boolean generateAsparagus = true;
public boolean generateSweetPotatoes = true;
public boolean generateChiliPeppers = true;
public boolean generatePeanuts = true;
public boolean generateCinnamonTrees = true;
public boolean generateSaltOre = true;


@Override
public String getName() {
return "expanded-delight";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;

import java.util.stream.Stream;

Expand Down Expand Up @@ -82,7 +81,6 @@ public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos po
};
}

@Nullable
@Override
public BlockState getPlacementState(ItemPlacementContext context) {
return this.getDefaultState().with(FACING, context.getHorizontalPlayerFacing().getOpposite());
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/com/ianm1647/expandeddelight/item/JuiceItem.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.ianm1647.expandeddelight.item;

import com.nhoryzon.mc.farmersdelight.item.ConsumableItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.UseAction;

public class JuiceItem extends ConsumableItem {
public JuiceItem(Item.Settings settings) {
super(settings);
}

public UseAction getUseAction(ItemStack stack) {
return UseAction.DRINK;
}
}
176 changes: 105 additions & 71 deletions src/main/java/com/ianm1647/expandeddelight/registry/ItemRegistry.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.ianm1647.expandeddelight.world;

import com.ianm1647.expandeddelight.ExpandedDelight;
import com.ianm1647.expandeddelight.world.feature.ModPlacedFeatures;
import net.fabricmc.fabric.api.biome.v1.BiomeModifications;
import net.fabricmc.fabric.api.biome.v1.BiomeSelectors;
Expand All @@ -13,20 +14,32 @@
public class ModFeatureGeneration {

public static void generateFeature() {
BiomeModifications.addFeature(BiomeSelectors.includeByKey(BiomeKeys.PLAINS),
GenerationStep.Feature.VEGETAL_DECORATION, ModPlacedFeatures.WILD_ASPARAGUS_PLACED);
BiomeModifications.addFeature(BiomeSelectors.includeByKey(BiomeKeys.JUNGLE),
GenerationStep.Feature.VEGETAL_DECORATION, ModPlacedFeatures.WILD_SWEET_POTATO_PLACED);
BiomeModifications.addFeature(BiomeSelectors.includeByKey(BiomeKeys.DESERT),
GenerationStep.Feature.VEGETAL_DECORATION, ModPlacedFeatures.WILD_CHILI_PEPPER_PLACED);
BiomeModifications.addFeature(BiomeSelectors.includeByKey(BiomeKeys.SAVANNA),
GenerationStep.Feature.VEGETAL_DECORATION, ModPlacedFeatures.WILD_PEANUTS_PLACED);
if (ExpandedDelight.CONFIG.generateAsparagus == true) {
BiomeModifications.addFeature(BiomeSelectors.includeByKey(BiomeKeys.PLAINS),
GenerationStep.Feature.VEGETAL_DECORATION, ModPlacedFeatures.WILD_ASPARAGUS_PLACED);
}
if (ExpandedDelight.CONFIG.generateSweetPotatoes == true) {
BiomeModifications.addFeature(BiomeSelectors.includeByKey(BiomeKeys.JUNGLE),
GenerationStep.Feature.VEGETAL_DECORATION, ModPlacedFeatures.WILD_SWEET_POTATO_PLACED);
}
if (ExpandedDelight.CONFIG.generateChiliPeppers == true) {
BiomeModifications.addFeature(BiomeSelectors.includeByKey(BiomeKeys.DESERT),
GenerationStep.Feature.VEGETAL_DECORATION, ModPlacedFeatures.WILD_CHILI_PEPPER_PLACED);
}
if (ExpandedDelight.CONFIG.generatePeanuts == true) {
BiomeModifications.addFeature(BiomeSelectors.includeByKey(BiomeKeys.SAVANNA),
GenerationStep.Feature.VEGETAL_DECORATION, ModPlacedFeatures.WILD_PEANUTS_PLACED);
}

BiomeModifications.addFeature(BiomeSelectors.includeByKey(BiomeKeys.JUNGLE),
GenerationStep.Feature.VEGETAL_DECORATION, ModPlacedFeatures.CINNAMON_TREE_PLACED);
if (ExpandedDelight.CONFIG.generateCinnamonTrees == true) {
BiomeModifications.addFeature(BiomeSelectors.includeByKey(BiomeKeys.JUNGLE),
GenerationStep.Feature.VEGETAL_DECORATION, ModPlacedFeatures.CINNAMON_TREE_PLACED);
}

BiomeModifications.addFeature(BiomeSelectors.includeByKey(BiomeKeys.OCEAN, BiomeKeys.COLD_OCEAN),
GenerationStep.Feature.UNDERGROUND_ORES, ModPlacedFeatures.SALT_ORE_PLACED);
if (ExpandedDelight.CONFIG.generateSaltOre == true) {
BiomeModifications.addFeature(BiomeSelectors.includeByKey(BiomeKeys.OCEAN, BiomeKeys.COLD_OCEAN),
GenerationStep.Feature.UNDERGROUND_ORES, ModPlacedFeatures.SALT_ORE_PLACED);
}
}
private static void generatePlantTemp(int lessTemp, int greatTemp, RegistryKey<PlacedFeature> feature) {
BiomeModifications.addFeature((context) -> context.getBiome().getTemperature() < lessTemp && context.getBiome().getTemperature() > greatTemp,
Expand Down

0 comments on commit 1d222a9

Please sign in to comment.