mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-24 08:08:34 +01:00
Add ore gen
This commit is contained in:
parent
f7dd5d11e1
commit
00c25a2638
1 changed files with 24 additions and 0 deletions
|
@ -13,13 +13,24 @@ package de.ellpeck.actuallyadditions.mod;
|
|||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.block.AABlocks;
|
||||
import de.ellpeck.actuallyadditions.mod.item.AAItems;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.gen.GenerationStage.Decoration;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.gen.feature.DecoratedFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
import net.minecraft.world.gen.feature.OreFeatureConfig;
|
||||
import net.minecraft.world.gen.placement.CountRangeConfig;
|
||||
import net.minecraft.world.gen.placement.Placement;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
@Mod(ActuallyAdditions.MODID)
|
||||
public class ActuallyAdditions {
|
||||
|
@ -40,6 +51,19 @@ public class ActuallyAdditions {
|
|||
|
||||
@SubscribeEvent
|
||||
public void setup(FMLCommonSetupEvent e) {
|
||||
for (Biome b : ForgeRegistries.BIOMES) {
|
||||
if (b.getFeatures(Decoration.UNDERGROUND_ORES).stream().anyMatch(ActuallyAdditions::isIronOreFeature)) {
|
||||
b.addFeature(Decoration.UNDERGROUND_ORES, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, AABlocks.BLACK_QUARTZ_ORE.getDefaultState(), 8), Placement.COUNT_RANGE, new CountRangeConfig(10, 0, 0, 64)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isIronOreFeature(ConfiguredFeature<?> f) {
|
||||
if (f.feature == Feature.DECORATED) {
|
||||
DecoratedFeatureConfig cfg = (DecoratedFeatureConfig) f.config;
|
||||
if (cfg.feature.feature == Feature.ORE) return ((OreFeatureConfig) cfg.feature.config).state == Blocks.IRON_ORE.getDefaultState();
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue