Upload fixed mod with oregen
This commit is contained in:
parent
1ce264862e
commit
4252f8281a
19 changed files with 141 additions and 30 deletions
|
@ -28,6 +28,7 @@ import org.slf4j.Logger;
|
|||
|
||||
import dev.zontreck.shapedaionresources.blocks.ModBlocks;
|
||||
import dev.zontreck.shapedaionresources.configs.SARServerConfig;
|
||||
import dev.zontreck.shapedaionresources.events.EventHandler;
|
||||
import dev.zontreck.shapedaionresources.items.ModItems;
|
||||
import dev.zontreck.shapedaionresources.ore.OreGenerator;
|
||||
|
||||
|
@ -47,6 +48,7 @@ public class ShapedAionResources
|
|||
// Register the setup method for modloading
|
||||
bus.addListener(this::setup);
|
||||
|
||||
|
||||
ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, SARServerConfig.SPEC, "aion-rss-server.toml");
|
||||
|
||||
|
||||
|
@ -56,7 +58,7 @@ public class ShapedAionResources
|
|||
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
||||
|
||||
ModBlocks.register(bus);
|
||||
ModItems.register(bus);
|
||||
|
@ -74,11 +76,6 @@ public class ShapedAionResources
|
|||
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void biomeLoadingEvent(final BiomeLoadingEvent ev){
|
||||
//OreGenerator.generateOres(ev);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onSpawn(EntityJoinWorldEvent ev){
|
||||
Level w = ev.getWorld();
|
||||
|
|
|
@ -29,11 +29,16 @@ public class ModBlocks {
|
|||
|
||||
|
||||
|
||||
public static final RegistryObject<Block> AION_ORE_BLOCK = BLOCKS.register("aion_ore_block", () -> new OreBlock(BlockBehaviour.Properties.of(Material.METAL)));
|
||||
public static final RegistryObject<Block> AION_ORE_BLOCK = BLOCKS.register("aion_ore_block", () -> new OreBlock(BlockBehaviour.Properties.of(Material.METAL).requiresCorrectToolForDrops().strength(9f).explosionResistance(10).destroyTime(10)));
|
||||
|
||||
public static final RegistryObject<Item> AION_ORE_BLOCK_I = ITEMS.register("aion_ore_block", () -> new BlockItem(AION_ORE_BLOCK.get(), new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
|
||||
|
||||
public static final RegistryObject<Block> AION_BLOCK = BLOCKS.register("aion_block", () -> new Block(BlockBehaviour.Properties.of(Material.HEAVY_METAL).explosionResistance(10000).requiresCorrectToolForDrops().strength(9f)));
|
||||
|
||||
public static final RegistryObject<Block> DEEPSLATE_AION_ORE_BLOCK = BLOCKS.register("deepslate_aion_ore_block", () -> new OreBlock(BlockBehaviour.Properties.of(Material.METAL).requiresCorrectToolForDrops().strength(9f).explosionResistance(10).destroyTime(10)));
|
||||
|
||||
public static final RegistryObject<Item> DEEPSLATE_AION_ORE_BLOCK_I = ITEMS.register("deepslate_aion_ore_block", () -> new BlockItem(DEEPSLATE_AION_ORE_BLOCK.get(), new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
|
||||
|
||||
public static final RegistryObject<Block> AION_BLOCK = BLOCKS.register("aion_block", () -> new Block(BlockBehaviour.Properties.of(Material.HEAVY_METAL).requiresCorrectToolForDrops().strength(9f).explosionResistance(10).destroyTime(10)));
|
||||
|
||||
public static final RegistryObject<Item> AION_BLOCK_I = ITEMS.register("aion_block", () -> new BlockItem(AION_BLOCK.get(), new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
|
||||
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package dev.zontreck.shapedaionresources.events;
|
||||
|
||||
import dev.zontreck.shapedaionresources.ShapedAionResources;
|
||||
import dev.zontreck.shapedaionresources.ore.OreGenerator;
|
||||
import net.minecraftforge.event.world.BiomeLoadingEvent;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
|
||||
@EventBusSubscriber(modid=ShapedAionResources.MOD_ID)
|
||||
public class EventHandler {
|
||||
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void addOresToBiomes(final BiomeLoadingEvent ev){
|
||||
ShapedAionResources.LOGGER.info("Biome loading event called. Registering aion ores");
|
||||
OreGenerator.generateOres(ev);
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@ package dev.zontreck.shapedaionresources.ore;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import dev.zontreck.shapedaionresources.ShapedAionResources;
|
||||
import dev.zontreck.shapedaionresources.blocks.ModBlocks;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.data.worldgen.features.FeatureUtils;
|
||||
|
@ -23,9 +24,11 @@ public class OreGenerator {
|
|||
public static final List<ConfiguredFeature<OreConfiguration, OreFeature>> OVERWORLD_ORES = new ArrayList();
|
||||
|
||||
|
||||
public static final List<OreConfiguration.TargetBlockState> OVERWORLD_AION_ORE = List.of(OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, ModBlocks.AION_ORE_BLOCK.get().defaultBlockState()), OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, ModBlocks.AION_ORE_BLOCK.get().defaultBlockState()));
|
||||
public static final List<OreConfiguration.TargetBlockState> OVERWORLD_AION_ORE = List.of(OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, ModBlocks.AION_ORE_BLOCK.get().defaultBlockState()), OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, ModBlocks.DEEPSLATE_AION_ORE_BLOCK.get().defaultBlockState()));
|
||||
|
||||
public static final Holder<ConfiguredFeature<OreConfiguration, ?>> AION_ORE = FeatureUtils.register("aion_ore_block", Feature.ORE, new OreConfiguration(OVERWORLD_AION_ORE, 9));
|
||||
public static final Holder<ConfiguredFeature<OreConfiguration, ?>> AION_ORE = FeatureUtils.register("aion_ore_block", Feature.ORE, new OreConfiguration(OVERWORLD_AION_ORE, 6));
|
||||
|
||||
public static final Holder<ConfiguredFeature<OreConfiguration, ?>> DEEPSLATE_AION_ORE = FeatureUtils.register("deepslate_aion_ore_block", Feature.ORE, new OreConfiguration(OVERWORLD_AION_ORE, 6));
|
||||
|
||||
|
||||
//public static final Holder<PlacedFeature> EBONY_PLACED = PlacementUtils.register("ebony_placed",
|
||||
|
@ -36,13 +39,22 @@ public class OreGenerator {
|
|||
//ModConfiguredFeatures.PINK_ROSE, RarityFilter.onAverageOnceEvery(16),
|
||||
//InSquarePlacement.spread(), PlacementUtils.HEIGHTMAP, BiomeFilter.biome());
|
||||
|
||||
public static final Holder<PlacedFeature> AION_ORE_PLACED = PlacementUtils.register("aion_ore_placed",
|
||||
AION_ORE, ModdedOrePlacement.commonOrePlacement(6, // VeinsPerChunk
|
||||
HeightRangePlacement.triangle(VerticalAnchor.aboveBottom(-40), VerticalAnchor.aboveBottom(40))));
|
||||
public static final Holder<PlacedFeature> AION_ORE_PLACED = PlacementUtils.register("aion_ore_placed",
|
||||
AION_ORE, ModdedOrePlacement.commonOrePlacement(3, // VeinsPerChunk
|
||||
HeightRangePlacement.triangle(VerticalAnchor.absolute(-20), VerticalAnchor.absolute(20))));
|
||||
|
||||
public static void generateOres(final BiomeLoadingEvent ev){
|
||||
|
||||
//public static final Holder<PlacedFeature> DEEPSLATE_AION_ORE_PLACED = PlacementUtils.register("deepslate_aion_ore_placed",
|
||||
// DEEPSLATE_AION_ORE, ModdedOrePlacement.commonOrePlacement(3, // VeinsPerChunk
|
||||
// HeightRangePlacement.triangle(VerticalAnchor.aboveBottom(-20), VerticalAnchor.aboveBottom(0))));
|
||||
|
||||
public static void generateOres(final BiomeLoadingEvent ev)
|
||||
{
|
||||
|
||||
List<Holder<PlacedFeature>> base = ev.getGeneration().getFeatures(GenerationStep.Decoration.UNDERGROUND_ORES);
|
||||
|
||||
ShapedAionResources.LOGGER.info("Register: AION_ORE");
|
||||
base.add(AION_ORE_PLACED);
|
||||
//base.add(DEEPSLATE_AION_ORE_PLACED);
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue