Ores and Rubber trees are spawn on Overworld and Nether
This commit is contained in:
parent
7e4d65ffa0
commit
3edff88ee0
4 changed files with 117 additions and 7 deletions
|
@ -26,7 +26,6 @@ package techreborn;
|
|||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.block.DispenserBlock;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
@ -45,6 +44,7 @@ import techreborn.proxies.CommonProxy;
|
|||
import techreborn.tiles.fusionReactor.TileFusionControlComputer;
|
||||
import techreborn.utils.BehaviorDispenseScrapbox;
|
||||
import techreborn.utils.StackWIPHandler;
|
||||
import techreborn.world.WorldGenerator;
|
||||
|
||||
public class TechReborn implements ModInitializer {
|
||||
|
||||
|
@ -83,12 +83,14 @@ public class TechReborn implements ModInitializer {
|
|||
ModSounds.init();
|
||||
// Client only init, needs to be done before parts system
|
||||
proxy.init();
|
||||
|
||||
// WorldGen
|
||||
WorldGenerator.initBiomeFeatures();
|
||||
|
||||
StackToolTipHandler.setup();
|
||||
StackWIPHandler.setup();
|
||||
|
||||
// WorldGen
|
||||
//GameRegistry.registerWorldGenerator(worldGen, 0);
|
||||
//GameRegistry.registerWorldGenerator(new OilLakeGenerator(), 0);
|
||||
// Register Gui Handler
|
||||
// Event busses
|
||||
|
|
|
@ -270,15 +270,37 @@ public class TRContent {
|
|||
}
|
||||
|
||||
public static enum Ores implements ItemConvertible {
|
||||
BAUXITE, CINNABAR, COPPER, GALENA, IRIDIUM, LEAD, PERIDOT, PYRITE, RUBY, SAPPHIRE, SHELDONITE, SILVER, SODALITE,
|
||||
SPHALERITE, TIN, TUNGSTEN;
|
||||
BAUXITE(6, 10, 10, 60),
|
||||
CINNABAR(6, 3, 10, 126),
|
||||
COPPER(8, 16, 20, 60),
|
||||
GALENA(8, 16, 10, 60),
|
||||
IRIDIUM(3, 3, 5, 60),
|
||||
LEAD(6, 16, 20, 60),
|
||||
PERIDOT(6, 3, 10, 250),
|
||||
PYRITE(6, 3, 10, 126),
|
||||
RUBY(6, 3, 10, 60),
|
||||
SAPPHIRE(6, 3, 10, 60),
|
||||
SHELDONITE(6, 3, 10, 250),
|
||||
SILVER(6, 16, 20, 60),
|
||||
SODALITE(6, 3, 10, 250),
|
||||
SPHALERITE(6, 3, 10, 126),
|
||||
TIN(8, 16, 20, 60),
|
||||
TUNGSTEN(6, 3, 10, 250);
|
||||
|
||||
public final String name;
|
||||
public final Block block;
|
||||
public final int veinSize;
|
||||
public final int veinsPerChunk;
|
||||
public final int minY;
|
||||
public final int maxY;
|
||||
|
||||
private Ores() {
|
||||
private Ores(int veinSize, int veinsPerChunk, int minY, int maxY) {
|
||||
name = this.toString().toLowerCase();
|
||||
block = new BlockOre();
|
||||
this.veinSize = veinSize;
|
||||
this.veinsPerChunk = veinsPerChunk;
|
||||
this.minY = minY;
|
||||
this.maxY = maxY;
|
||||
InitUtils.setup(block, name + "_ore");
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ import net.minecraft.item.ItemConvertible;
|
|||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import reborncore.common.tile.TileMachineBase;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.tiles.*;
|
||||
import techreborn.tiles.cable.TileCable;
|
||||
|
@ -63,7 +62,6 @@ import techreborn.tiles.transformers.TileMVTransformer;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class TRTileEntities {
|
||||
|
||||
|
|
88
src/main/java/techreborn/world/WorldGenerator.java
Normal file
88
src/main/java/techreborn/world/WorldGenerator.java
Normal file
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2018 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.world;
|
||||
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.Biome.Category;
|
||||
import net.minecraft.world.gen.GenerationStep;
|
||||
import net.minecraft.world.gen.decorator.CountExtraChanceDecoratorConfig;
|
||||
import net.minecraft.world.gen.decorator.Decorator;
|
||||
import net.minecraft.world.gen.decorator.RangeDecoratorConfig;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
import net.minecraft.world.gen.feature.FeatureConfig;
|
||||
import net.minecraft.world.gen.feature.OreFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.OreFeatureConfig.Target;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
/**
|
||||
* @author drcrazy
|
||||
*
|
||||
*/
|
||||
public class WorldGenerator {
|
||||
|
||||
// public static final Predicate<IBlockState> IS_ENDSTONE = (state) -> {
|
||||
// return state != null && (state.getBlock() == Blocks.END_STONE);
|
||||
// };
|
||||
|
||||
public static void initBiomeFeatures() {
|
||||
for (Biome biome : Registry.BIOME) {
|
||||
if (biome.getCategory() == Category.NETHER) {
|
||||
addOre(biome, OreFeatureConfig.Target.NETHERRACK, TRContent.Ores.CINNABAR);
|
||||
addOre(biome, OreFeatureConfig.Target.NETHERRACK, TRContent.Ores.PYRITE);
|
||||
addOre(biome, OreFeatureConfig.Target.NETHERRACK, TRContent.Ores.SPHALERITE);
|
||||
|
||||
} else if (biome.getCategory() == Category.THEEND) {
|
||||
// addOre(biome, IS_ENDSTONE, TRContent.Ores.PERIDOT);
|
||||
// addOre(biome, IS_ENDSTONE, TRContent.Ores.SHELDONITE);
|
||||
// addOre(biome, IS_ENDSTONE, TRContent.Ores.SODALITE);
|
||||
// addOre(biome, IS_ENDSTONE, TRContent.Ores.TUNGSTEN);
|
||||
} else {
|
||||
addOre(biome, OreFeatureConfig.Target.NATURAL_STONE, TRContent.Ores.BAUXITE);
|
||||
addOre(biome, OreFeatureConfig.Target.NATURAL_STONE, TRContent.Ores.COPPER);
|
||||
addOre(biome, OreFeatureConfig.Target.NATURAL_STONE, TRContent.Ores.GALENA);
|
||||
addOre(biome, OreFeatureConfig.Target.NATURAL_STONE, TRContent.Ores.IRIDIUM);
|
||||
addOre(biome, OreFeatureConfig.Target.NATURAL_STONE, TRContent.Ores.LEAD);
|
||||
addOre(biome, OreFeatureConfig.Target.NATURAL_STONE, TRContent.Ores.RUBY);
|
||||
addOre(biome, OreFeatureConfig.Target.NATURAL_STONE, TRContent.Ores.SAPPHIRE);
|
||||
addOre(biome, OreFeatureConfig.Target.NATURAL_STONE, TRContent.Ores.SILVER);
|
||||
addOre(biome, OreFeatureConfig.Target.NATURAL_STONE, TRContent.Ores.TIN);
|
||||
if (biome.getCategory() == Category.FOREST || biome.getCategory() == Category.TAIGA) {
|
||||
biome.addFeature(GenerationStep.Feature.VEGETAL_DECORATION,
|
||||
Biome.configureFeature(new RubberTreeFeature(DefaultFeatureConfig::deserialize, false),
|
||||
FeatureConfig.DEFAULT, Decorator.COUNT_EXTRA_HEIGHTMAP,
|
||||
new CountExtraChanceDecoratorConfig(10, 0.1F, 1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void addOre(Biome biome, Target canReplaceIn, TRContent.Ores ore) {
|
||||
biome.addFeature(GenerationStep.Feature.UNDERGROUND_ORES, Biome.configureFeature(Feature.ORE,
|
||||
new OreFeatureConfig(canReplaceIn, ore.block.getDefaultState(), ore.veinSize), Decorator.COUNT_RANGE,
|
||||
new RangeDecoratorConfig(ore.veinsPerChunk, ore.minY, ore.minY, ore.maxY)));
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue