2015-08-29 14:33:25 +02:00
|
|
|
/*
|
2016-05-16 22:52:27 +02:00
|
|
|
* This file ("ActuallyAdditions.java") is part of the Actually Additions mod for Minecraft.
|
2015-08-29 14:33:25 +02:00
|
|
|
* It is created and owned by Ellpeck and distributed
|
|
|
|
* under the Actually Additions License to be found at
|
2016-05-16 22:52:27 +02:00
|
|
|
* http://ellpeck.de/actaddlicense
|
2015-08-29 14:33:25 +02:00
|
|
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
|
|
*
|
2017-01-01 16:23:26 +01:00
|
|
|
* © 2015-2017 Ellpeck
|
2015-08-29 14:33:25 +02:00
|
|
|
*/
|
|
|
|
|
2016-01-05 04:47:35 +01:00
|
|
|
package de.ellpeck.actuallyadditions.mod;
|
2014-11-10 16:47:04 +01:00
|
|
|
|
2019-11-12 04:18:54 +01:00
|
|
|
import org.apache.logging.log4j.LogManager;
|
|
|
|
import org.apache.logging.log4j.Logger;
|
|
|
|
|
2019-11-12 04:50:40 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.block.AABlocks;
|
2019-11-12 03:13:59 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.item.AAItems;
|
2019-11-12 04:50:40 +01:00
|
|
|
import net.minecraft.block.Blocks;
|
2019-11-12 03:13:59 +01:00
|
|
|
import net.minecraft.item.ItemGroup;
|
|
|
|
import net.minecraft.item.ItemStack;
|
2019-11-12 04:50:40 +01:00
|
|
|
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;
|
2019-11-12 00:52:54 +01:00
|
|
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
2016-01-07 18:20:59 +01:00
|
|
|
import net.minecraftforge.fml.common.Mod;
|
2019-11-12 00:52:54 +01:00
|
|
|
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
|
|
|
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
2019-11-12 04:50:40 +01:00
|
|
|
import net.minecraftforge.registries.ForgeRegistries;
|
2015-10-02 16:48:01 +02:00
|
|
|
|
2019-11-12 00:52:54 +01:00
|
|
|
@Mod(ActuallyAdditions.MODID)
|
2018-03-23 03:53:13 +01:00
|
|
|
public class ActuallyAdditions {
|
2014-11-10 16:47:04 +01:00
|
|
|
|
2019-11-12 00:52:54 +01:00
|
|
|
public static final String MODID = "actuallyadditions";
|
|
|
|
public static final Logger LOGGER = LogManager.getLogger(MODID);
|
2019-11-12 04:18:54 +01:00
|
|
|
public static final ItemGroup GROUP = new ItemGroup("actuallyadditions") {
|
|
|
|
@Override
|
|
|
|
public ItemStack createIcon() {
|
|
|
|
return new ItemStack(AAItems.BLACK_QUARTZ);
|
|
|
|
}
|
|
|
|
};
|
2014-11-10 16:47:04 +01:00
|
|
|
|
2019-11-12 00:52:54 +01:00
|
|
|
public ActuallyAdditions() {
|
|
|
|
FMLJavaModLoadingContext ctx = FMLJavaModLoadingContext.get();
|
|
|
|
ctx.getModEventBus().register(this);
|
|
|
|
}
|
2014-12-03 21:55:53 +01:00
|
|
|
|
2019-11-12 00:52:54 +01:00
|
|
|
@SubscribeEvent
|
|
|
|
public void setup(FMLCommonSetupEvent e) {
|
2019-11-12 04:50:40 +01:00
|
|
|
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)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-11-12 04:18:54 +01:00
|
|
|
|
2019-11-12 04:50:40 +01:00
|
|
|
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;
|
2019-11-12 00:52:54 +01:00
|
|
|
}
|
2014-11-10 16:47:04 +01:00
|
|
|
}
|