mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 00:38:35 +01:00
Made blocks in the cave world be determined by seed, added impure iron ore that spawns in cave world
This commit is contained in:
parent
aec4bfbaa4
commit
05f159f48a
9 changed files with 68 additions and 36 deletions
|
@ -19,11 +19,15 @@ import net.minecraft.item.ItemStack;
|
||||||
public class BlockGeneric extends BlockBase{
|
public class BlockGeneric extends BlockBase{
|
||||||
|
|
||||||
public BlockGeneric(String name){
|
public BlockGeneric(String name){
|
||||||
super(Material.ROCK, name);
|
this(name, Material.ROCK, SoundType.STONE, 1.5F, 10.0F, "pickaxe", 0);
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
}
|
||||||
this.setHardness(1.5F);
|
|
||||||
this.setResistance(10.0F);
|
public BlockGeneric(String name, Material material, SoundType sound, float hardness, float resistance, String harvestTool, int harvestLevel){
|
||||||
this.setSoundType(SoundType.STONE);
|
super(material, name);
|
||||||
|
this.setHarvestLevel(harvestTool, harvestLevel);
|
||||||
|
this.setHardness(hardness);
|
||||||
|
this.setResistance(resistance);
|
||||||
|
this.setSoundType(sound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -13,9 +13,12 @@ package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockStair;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockStair;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.CompatUtil;
|
import de.ellpeck.actuallyadditions.mod.util.CompatUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.SoundType;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
|
||||||
public class InitBlocks{
|
public class InitBlocks{
|
||||||
|
|
||||||
|
@ -114,9 +117,15 @@ public class InitBlocks{
|
||||||
public static Block blockPillarQuartzStair;
|
public static Block blockPillarQuartzStair;
|
||||||
public static Block blockPillarQuartzSlab;
|
public static Block blockPillarQuartzSlab;
|
||||||
|
|
||||||
|
public static Block blockImpureIron;
|
||||||
|
|
||||||
public static void init(){
|
public static void init(){
|
||||||
ModUtil.LOGGER.info("Initializing Blocks...");
|
ModUtil.LOGGER.info("Initializing Blocks...");
|
||||||
|
|
||||||
|
if(ConfigValues.caveWorld){
|
||||||
|
blockImpureIron = new BlockGeneric("blockImpureIron", Material.ROCK, SoundType.STONE, 3.5F, 12.5F, "pickaxe", 1);
|
||||||
|
}
|
||||||
|
|
||||||
blockItemViewer = new BlockItemViewer("blockItemViewer");
|
blockItemViewer = new BlockItemViewer("blockItemViewer");
|
||||||
blockFireworkBox = new BlockFireworkBox("blockFireworkBox");
|
blockFireworkBox = new BlockFireworkBox("blockFireworkBox");
|
||||||
blockMiner = new BlockMiner("blockMiner");
|
blockMiner = new BlockMiner("blockMiner");
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.creative;
|
package de.ellpeck.actuallyadditions.mod.creative;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.InitForeignPaxels;
|
import de.ellpeck.actuallyadditions.mod.items.InitForeignPaxels;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||||
|
@ -303,6 +304,10 @@ public class CreativeTab extends CreativeTabs{
|
||||||
this.add(InitItems.itemChestCrystalWhite);
|
this.add(InitItems.itemChestCrystalWhite);
|
||||||
this.add(InitItems.itemPantsCrystalWhite);
|
this.add(InitItems.itemPantsCrystalWhite);
|
||||||
this.add(InitItems.itemBootsCrystalWhite);
|
this.add(InitItems.itemBootsCrystalWhite);
|
||||||
|
|
||||||
|
if(ConfigValues.caveWorld){
|
||||||
|
this.add(InitBlocks.blockImpureIron);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(Item item){
|
public void add(Item item){
|
||||||
|
|
|
@ -14,6 +14,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
|
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.gen.cave.CaveWorldType;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
@ -43,31 +44,22 @@ public class OreGen implements IWorldGenerator{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider){
|
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider){
|
||||||
if(world.getWorldType() != WorldType.FLAT && Util.arrayContains(ConfigValues.oreGenDimensionBlacklist, world.provider.getDimension()) < 0){
|
int dimension = world.provider.getDimension();
|
||||||
switch(world.provider.getDimension()){
|
if(dimension != -1 && dimension != 1){
|
||||||
case -1:
|
if(CaveWorldType.isCave(world)){
|
||||||
this.generateNether(world, random, chunkX*16, chunkZ*16);
|
this.generateCave(world, random, chunkX*16, chunkZ*16);
|
||||||
//case 0:
|
}
|
||||||
// generateSurface(world, random, chunkX*16, chunkZ*16);
|
else if(world.getWorldType() != WorldType.FLAT && Util.arrayContains(ConfigValues.oreGenDimensionBlacklist, world.provider.getDimension()) < 0){
|
||||||
case 1:
|
this.generateDefault(world, random, chunkX*16, chunkZ*16);
|
||||||
this.generateEnd(world, random, chunkX*16, chunkZ*16);
|
|
||||||
default:
|
|
||||||
this.generateSurface(world, random, chunkX*16, chunkZ*16);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
private void generateCave(World world, Random random, int x, int z){
|
||||||
private void generateNether(World world, Random random, int x, int z){
|
this.addOreSpawn(InitBlocks.blockImpureIron, 0, Blocks.STONE, world, random, x, z, MathHelper.getRandomIntegerInRange(random, 5, 10), 60, 0, world.getHeight());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
private void generateDefault(World world, Random random, int x, int z){
|
||||||
private void generateEnd(World world, Random random, int x, int z){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void generateSurface(World world, Random random, int x, int z){
|
|
||||||
if(ConfigBoolValues.GENERATE_QUARTZ.isEnabled()){
|
if(ConfigBoolValues.GENERATE_QUARTZ.isEnabled()){
|
||||||
this.addOreSpawn(InitBlocks.blockMisc, TheMiscBlocks.ORE_QUARTZ.ordinal(), Blocks.STONE, world, random, x, z, MathHelper.getRandomIntegerInRange(random, 5, 8), 10, QUARTZ_MIN, QUARTZ_MAX);
|
this.addOreSpawn(InitBlocks.blockMisc, TheMiscBlocks.ORE_QUARTZ.ordinal(), Blocks.STONE, world, random, x, z, MathHelper.getRandomIntegerInRange(random, 5, 8), 10, QUARTZ_MIN, QUARTZ_MAX);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.gen.cave;
|
package de.ellpeck.actuallyadditions.mod.gen.cave;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
|
||||||
import net.minecraft.entity.EnumCreatureType;
|
import net.minecraft.entity.EnumCreatureType;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -19,21 +18,23 @@ import net.minecraft.world.biome.BiomeGenBase;
|
||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
import net.minecraft.world.chunk.ChunkPrimer;
|
import net.minecraft.world.chunk.ChunkPrimer;
|
||||||
import net.minecraft.world.chunk.IChunkGenerator;
|
import net.minecraft.world.chunk.IChunkGenerator;
|
||||||
import net.minecraft.world.gen.MapGenBase;
|
|
||||||
import net.minecraft.world.gen.MapGenCaves;
|
|
||||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class ChunkProviderCave implements IChunkGenerator{
|
public class ChunkProviderCave implements IChunkGenerator{
|
||||||
|
|
||||||
private boolean generatedSpawn;
|
private boolean generatedSpawn;
|
||||||
private World world;
|
private World world;
|
||||||
|
private Random rand;
|
||||||
|
|
||||||
private WorldGenerator spawnGenerator = new WorldGenCaveSpawn();
|
private WorldGenerator spawnGenerator;
|
||||||
|
|
||||||
public ChunkProviderCave(World world){
|
public ChunkProviderCave(World world){
|
||||||
this.world = world;
|
this.world = world;
|
||||||
|
this.rand = new Random(world.getSeed());
|
||||||
|
this.spawnGenerator = new WorldGenCaveSpawn(this.rand);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -47,9 +48,9 @@ public class ChunkProviderCave implements IChunkGenerator{
|
||||||
primer.setBlockState(x, y, z, Blocks.BEDROCK.getDefaultState());
|
primer.setBlockState(x, y, z, Blocks.BEDROCK.getDefaultState());
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(Util.RANDOM.nextInt(5) <= 0){
|
if(this.rand.nextInt(5) <= 0){
|
||||||
if(Util.RANDOM.nextFloat() <= 0.95F){
|
if(this.rand.nextFloat() <= 0.95F){
|
||||||
primer.setBlockState(x, y, z, (Util.RANDOM.nextFloat() >= 0.85F ? Blocks.MOSSY_COBBLESTONE : Blocks.COBBLESTONE).getDefaultState());
|
primer.setBlockState(x, y, z, (this.rand.nextFloat() >= 0.85F ? Blocks.MOSSY_COBBLESTONE : Blocks.COBBLESTONE).getDefaultState());
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
primer.setBlockState(x, y, z, Blocks.GLOWSTONE.getDefaultState());
|
primer.setBlockState(x, y, z, Blocks.GLOWSTONE.getDefaultState());
|
||||||
|
@ -74,7 +75,7 @@ public class ChunkProviderCave implements IChunkGenerator{
|
||||||
BlockPos spawn = this.world.getSpawnPoint();
|
BlockPos spawn = this.world.getSpawnPoint();
|
||||||
Chunk chunk = this.world.getChunkFromBlockCoords(spawn);
|
Chunk chunk = this.world.getChunkFromBlockCoords(spawn);
|
||||||
if(chunk.xPosition == x && chunk.zPosition == z){
|
if(chunk.xPosition == x && chunk.zPosition == z){
|
||||||
this.generatedSpawn = this.spawnGenerator.generate(this.world, this.world.rand, spawn);
|
this.generatedSpawn = this.spawnGenerator.generate(this.world, this.rand, spawn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,12 @@ import java.util.Random;
|
||||||
|
|
||||||
public class WorldGenCaveSpawn extends WorldGenerator{
|
public class WorldGenCaveSpawn extends WorldGenerator{
|
||||||
|
|
||||||
|
private Random rand;
|
||||||
|
|
||||||
|
public WorldGenCaveSpawn(Random rand){
|
||||||
|
this.rand = rand;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean generate(World world, Random rand, BlockPos position){
|
public boolean generate(World world, Random rand, BlockPos position){
|
||||||
this.generateCave(world, position);
|
this.generateCave(world, position);
|
||||||
|
@ -49,9 +55,9 @@ public class WorldGenCaveSpawn extends WorldGenerator{
|
||||||
|
|
||||||
world.setBlockState(center.add(-1, -5, -8), Blocks.DIRT.getStateFromMeta(1));
|
world.setBlockState(center.add(-1, -5, -8), Blocks.DIRT.getStateFromMeta(1));
|
||||||
WorldGenTrees trees = new WorldGenTrees(true);
|
WorldGenTrees trees = new WorldGenTrees(true);
|
||||||
trees.generate(world, Util.RANDOM, center.add(-1, -4, -8));
|
trees.generate(world, this.rand, center.add(-1, -4, -8));
|
||||||
|
|
||||||
int length = Util.RANDOM.nextInt(20)+20;
|
int length = this.rand.nextInt(20)+20;
|
||||||
for(int z = 0; z <= length; z++){
|
for(int z = 0; z <= length; z++){
|
||||||
for(int x = 0; x < 5; x++){
|
for(int x = 0; x < 5; x++){
|
||||||
for(int y = 0; y < 4; y++){
|
for(int y = 0; y < 4; y++){
|
||||||
|
@ -63,7 +69,7 @@ public class WorldGenCaveSpawn extends WorldGenerator{
|
||||||
else if((z%4 == 0 || x == 0 || x == 4) && y == 3){
|
else if((z%4 == 0 || x == 0 || x == 4) && y == 3){
|
||||||
world.setBlockState(pos, Blocks.PLANKS.getStateFromMeta(1));
|
world.setBlockState(pos, Blocks.PLANKS.getStateFromMeta(1));
|
||||||
}
|
}
|
||||||
else if(!((y == 0 || y == 3) && Util.RANDOM.nextInt(5) <= 0)){
|
else if(!((y == 0 || y == 3) && this.rand.nextInt(5) <= 0)){
|
||||||
world.setBlockToAir(pos);
|
world.setBlockToAir(pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,7 +80,7 @@ public class WorldGenCaveSpawn extends WorldGenerator{
|
||||||
TileEntity tile = world.getTileEntity(chestPos);
|
TileEntity tile = world.getTileEntity(chestPos);
|
||||||
if(tile instanceof TileEntityChest){
|
if(tile instanceof TileEntityChest){
|
||||||
TileEntityChest chest = (TileEntityChest)tile;
|
TileEntityChest chest = (TileEntityChest)tile;
|
||||||
chest.setInventorySlotContents(12, new ItemStack(InitItems.itemFoods, MathHelper.getRandomIntegerInRange(Util.RANDOM, 5, 15), Util.RANDOM.nextInt(TheFoods.values().length)));
|
chest.setInventorySlotContents(12, new ItemStack(InitItems.itemFoods, MathHelper.getRandomIntegerInRange(this.rand, 5, 15), this.rand.nextInt(TheFoods.values().length)));
|
||||||
chest.setInventorySlotContents(14, new ItemStack(InitItems.itemAxeCrystalBlack));
|
chest.setInventorySlotContents(14, new ItemStack(InitItems.itemAxeCrystalBlack));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"forge_marker": 1,
|
||||||
|
"defaults": {
|
||||||
|
"model": "minecraft:cube_all",
|
||||||
|
"textures": {
|
||||||
|
"all": "actuallyadditions:blocks/blockImpureIron"
|
||||||
|
},
|
||||||
|
"transform": "forge:default-block"
|
||||||
|
},
|
||||||
|
"variants": {
|
||||||
|
"normal": [{}],
|
||||||
|
"inventory": [{}]
|
||||||
|
}
|
||||||
|
}
|
|
@ -206,6 +206,7 @@ tile.actuallyadditions.blockPillarQuartzSlab.name=Black Quartz Pillar Slab
|
||||||
tile.actuallyadditions.blockLaserRelayItem.name=Item Laser Relay
|
tile.actuallyadditions.blockLaserRelayItem.name=Item Laser Relay
|
||||||
tile.actuallyadditions.blockLaserRelayItemWhitelist.name=Advanced Item Laser Relay
|
tile.actuallyadditions.blockLaserRelayItemWhitelist.name=Advanced Item Laser Relay
|
||||||
tile.actuallyadditions.blockItemViewer.name=Item Interface
|
tile.actuallyadditions.blockItemViewer.name=Item Interface
|
||||||
|
tile.actuallyadditions.blockImpureIron.name=Impure Iron
|
||||||
|
|
||||||
#ESD
|
#ESD
|
||||||
tile.actuallyadditions.blockInputter.name=ESD
|
tile.actuallyadditions.blockInputter.name=ESD
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 369 B |
Loading…
Reference in a new issue