Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/main/java/crispytwig/heftycrops/HeftyCrops.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,14 @@ private void doClientStuff(final FMLClientSetupEvent event) {

@SubscribeEvent
public void onCropGrow(BlockEvent.CropGrowEvent.Post event) {
if(Config.HEFTY_CROP_WEIGHT.get() == 0) return;

BlockPos pos = event.getPos();
LevelAccessor level = event.getWorld();
BlockState postState = event.getState();

if(Config.HEFTY_CROP_REQUIRES_UNOBSTRUCTED_SKYVIEW.get() && !level.canSeeSky(pos)) return;


// Vanilla Crop Blocks
if (postState.is(Blocks.BEETROOTS) && postState.getValue(BeetrootBlock.AGE) == BeetrootBlock.MAX_AGE) {
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/crispytwig/heftycrops/registry/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
@Mod.EventBusSubscriber(modid = HeftyCrops.MOD_ID)
public class Config {
public static final ForgeConfigSpec.IntValue HEFTY_CROP_WEIGHT;
public static final ForgeConfigSpec.BooleanValue HEFTY_CROP_REQUIRES_UNOBSTRUCTED_SKYVIEW;
public static ForgeConfigSpec COMMON_CONFIG;

static {
ForgeConfigSpec.Builder COMMON_BUILDER = new ForgeConfigSpec.Builder();
HEFTY_CROP_WEIGHT = COMMON_BUILDER.comment("Chance of hefty crop spawning. Larger number = rarer. A value of 1 will guarantee a hefty crop spawns.").defineInRange("weight", 25, 1, 100);
HEFTY_CROP_WEIGHT = COMMON_BUILDER.comment("Chance of hefty crop spawning. Larger number = rarer. A value of 1 will guarantee a hefty crop spawns. A value of 0 will disable hefty crop spawns.").defineInRange("weight", 25, 0, 100);
HEFTY_CROP_REQUIRES_UNOBSTRUCTED_SKYVIEW = COMMON_BUILDER.comment("If true, hefty crops may only spawn if the sky is visible (F3 Sky Light Level == 15)").define("requiresUnobstructedSkyView", false);
Config.COMMON_CONFIG = COMMON_BUILDER.build();
}

Expand Down