From 4ff7b1528718adfcf609415e4be052ce31c3c587 Mon Sep 17 00:00:00 2001 From: Paul Schifferer Date: Sun, 20 Mar 2022 11:39:45 -0700 Subject: [PATCH] Fix catnip generation in the wild. --- .../java/com/sweetrpg/catherder/CatHerder.java | 2 +- .../catherder/common/event/EventHandler.java | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/sweetrpg/catherder/CatHerder.java b/src/main/java/com/sweetrpg/catherder/CatHerder.java index 5741ba3c..7a706cef 100644 --- a/src/main/java/com/sweetrpg/catherder/CatHerder.java +++ b/src/main/java/com/sweetrpg/catherder/CatHerder.java @@ -115,7 +115,7 @@ public CatHerder() { forgeEventBus.addListener(this::serverStarting); forgeEventBus.addListener(this::registerCommands); - forgeEventBus.register(new EventHandler()); +// forgeEventBus.register(new EventHandler()); // forgeEventBus.register(new BackwardsComp()); // Client Events diff --git a/src/main/java/com/sweetrpg/catherder/common/event/EventHandler.java b/src/main/java/com/sweetrpg/catherder/common/event/EventHandler.java index c4af0e92..8fbd04ae 100644 --- a/src/main/java/com/sweetrpg/catherder/common/event/EventHandler.java +++ b/src/main/java/com/sweetrpg/catherder/common/event/EventHandler.java @@ -2,6 +2,7 @@ import com.sweetrpg.catherder.common.config.ConfigHandler; import com.sweetrpg.catherder.common.entity.CatEntity; +import com.sweetrpg.catherder.common.lib.Constants; import com.sweetrpg.catherder.common.registry.ModEntityTypes; import com.sweetrpg.catherder.common.registry.ModItems; import com.sweetrpg.catherder.common.talent.BirdCatcherTalent; @@ -25,14 +26,25 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.world.BiomeLoadingEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod; +@Mod.EventBusSubscriber(modid = Constants.MOD_ID) public class EventHandler { @SubscribeEvent public static void onBiomeLoad(BiomeLoadingEvent event) { BiomeGenerationSettingsBuilder builder = event.getGeneration(); Biome.ClimateSettings climate = event.getClimate(); - if((event.getCategory().equals(Biome.BiomeCategory.PLAINS) || event.getCategory().equals(Biome.BiomeCategory.TAIGA) || event.getCategory().equals(Biome.BiomeCategory.MOUNTAIN) || event.getCategory().equals(Biome.BiomeCategory.JUNGLE)) && (climate.temperature > 0.3F && climate.temperature < 1.0F)) { + + if((event.getCategory().equals(Biome.BiomeCategory.PLAINS) || + event.getCategory().equals(Biome.BiomeCategory.EXTREME_HILLS) || + event.getCategory().equals(Biome.BiomeCategory.FOREST) || + event.getCategory().equals(Biome.BiomeCategory.SAVANNA) || + event.getCategory().equals(Biome.BiomeCategory.MUSHROOM) || + event.getCategory().equals(Biome.BiomeCategory.TAIGA) || + event.getCategory().equals(Biome.BiomeCategory.MOUNTAIN) || + event.getCategory().equals(Biome.BiomeCategory.JUNGLE)) && + (climate.temperature >= 0.2F && climate.temperature < 1.5F)) { builder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, WildCropGeneration.PATCH_WILD_CATNIP); } }