mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-12-22 14:59:22 +01:00
register configured features as well so that the features know that they're actually very truly extremely registered now
Closes #163
This commit is contained in:
parent
c56df947fb
commit
bb851dc228
3 changed files with 30 additions and 16 deletions
|
@ -21,13 +21,7 @@ import net.minecraft.util.ResourceLocation;
|
|||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.gen.GenerationStage;
|
||||
import net.minecraft.world.gen.GenerationStage.Decoration;
|
||||
import net.minecraft.world.gen.feature.IFeatureConfig;
|
||||
import net.minecraft.world.gen.placement.ConfiguredPlacement;
|
||||
import net.minecraft.world.gen.placement.IPlacementConfig;
|
||||
import net.minecraft.world.gen.placement.NoPlacementConfig;
|
||||
import net.minecraft.world.gen.placement.Placement;
|
||||
import net.minecraft.world.server.ChunkHolder;
|
||||
import net.minecraft.world.server.ChunkManager;
|
||||
import net.minecraft.world.server.ServerChunkProvider;
|
||||
|
@ -53,18 +47,17 @@ public class CommonEvents {
|
|||
@SubscribeEvent
|
||||
public void onBiomeLoad(BiomeLoadingEvent event) {
|
||||
if (ModConfig.instance.auraBlooms.get()) {
|
||||
ConfiguredPlacement<NoPlacementConfig> placement = Placement.NOPE.configure(IPlacementConfig.NO_PLACEMENT_CONFIG);
|
||||
event.getGeneration().func_242513_a(Decoration.VEGETAL_DECORATION, ModFeatures.AURA_BLOOM.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG).withPlacement(placement));
|
||||
event.getGeneration().func_242513_a(Decoration.VEGETAL_DECORATION, ModFeatures.Configured.AURA_BLOOM);
|
||||
switch (event.getCategory()) {
|
||||
case DESERT:
|
||||
event.getGeneration().func_242513_a(Decoration.VEGETAL_DECORATION, ModFeatures.AURA_CACTUS.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG).withPlacement(placement));
|
||||
event.getGeneration().func_242513_a(Decoration.VEGETAL_DECORATION, ModFeatures.Configured.AURA_CACTUS);
|
||||
break;
|
||||
case NETHER:
|
||||
event.getGeneration().func_242513_a(Decoration.VEGETAL_DECORATION, ModFeatures.CRIMSON_AURA_MUSHROOM.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG).withPlacement(placement));
|
||||
event.getGeneration().func_242513_a(Decoration.VEGETAL_DECORATION, ModFeatures.WARPED_AURA_MUSHROOM.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG).withPlacement(placement));
|
||||
event.getGeneration().func_242513_a(Decoration.VEGETAL_DECORATION, ModFeatures.Configured.CRIMSON_AURA_MUSHROOM);
|
||||
event.getGeneration().func_242513_a(Decoration.VEGETAL_DECORATION, ModFeatures.Configured.WARPED_AURA_MUSHROOM);
|
||||
break;
|
||||
case MUSHROOM:
|
||||
event.getGeneration().func_242513_a(Decoration.VEGETAL_DECORATION, ModFeatures.AURA_MUSHROOM.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG).withPlacement(placement));
|
||||
event.getGeneration().func_242513_a(Decoration.VEGETAL_DECORATION, ModFeatures.Configured.AURA_MUSHROOM);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
package de.ellpeck.naturesaura.gen;
|
||||
|
||||
import net.minecraft.world.gen.feature.BaseTreeFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
import net.minecraft.world.gen.feature.NoFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.TreeFeature;
|
||||
import net.minecraft.world.gen.feature.*;
|
||||
import net.minecraft.world.gen.placement.IPlacementConfig;
|
||||
import net.minecraft.world.gen.placement.Placement;
|
||||
|
||||
@SuppressWarnings("FieldNamingConvention")
|
||||
public final class ModFeatures {
|
||||
|
@ -16,4 +15,13 @@ public final class ModFeatures {
|
|||
public static Feature<NoFeatureConfig> CRIMSON_AURA_MUSHROOM;
|
||||
public static Feature<NoFeatureConfig> AURA_MUSHROOM;
|
||||
|
||||
public static final class Configured {
|
||||
|
||||
public static final ConfiguredFeature AURA_BLOOM = ModFeatures.AURA_BLOOM.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG).withPlacement(Placement.NOPE.configure(IPlacementConfig.NO_PLACEMENT_CONFIG));
|
||||
public static final ConfiguredFeature AURA_CACTUS = ModFeatures.AURA_CACTUS.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG).withPlacement(Placement.NOPE.configure(IPlacementConfig.NO_PLACEMENT_CONFIG));
|
||||
public static final ConfiguredFeature CRIMSON_AURA_MUSHROOM = ModFeatures.CRIMSON_AURA_MUSHROOM.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG).withPlacement(Placement.NOPE.configure(IPlacementConfig.NO_PLACEMENT_CONFIG));
|
||||
public static final ConfiguredFeature WARPED_AURA_MUSHROOM = ModFeatures.WARPED_AURA_MUSHROOM.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG).withPlacement(Placement.NOPE.configure(IPlacementConfig.NO_PLACEMENT_CONFIG));
|
||||
public static final ConfiguredFeature AURA_MUSHROOM = ModFeatures.AURA_MUSHROOM.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG).withPlacement(Placement.NOPE.configure(IPlacementConfig.NO_PLACEMENT_CONFIG));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,10 @@ import net.minecraft.item.crafting.IRecipeSerializer;
|
|||
import net.minecraft.potion.Effect;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.WorldGenRegistries;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
import net.minecraft.world.gen.feature.structure.Structure;
|
||||
import net.minecraftforge.common.extensions.IForgeContainerType;
|
||||
|
@ -55,6 +58,7 @@ import net.minecraftforge.fml.client.registry.IRenderFactory;
|
|||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -337,6 +341,15 @@ public final class ModRegistry {
|
|||
if (item instanceof ITESRProvider)
|
||||
NaturesAura.proxy.registerTESR((ITESRProvider) item);
|
||||
}
|
||||
|
||||
for (Field entry : ModFeatures.Configured.class.getFields()) {
|
||||
try {
|
||||
ConfiguredFeature feature = (ConfiguredFeature) entry.get(null);
|
||||
Registry.register(WorldGenRegistries.field_243653_e, feature.feature.getRegistryName(), feature);
|
||||
} catch (IllegalAccessException e) {
|
||||
NaturesAura.LOGGER.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Block createFlowerPot(Block block) {
|
||||
|
|
Loading…
Reference in a new issue