forked from TAIGA/TAIGA
[1.2] Material rework (#60)
* Developement tests for nbt data in traits * Lot of trait changes and better balancing * Traits reworked a bit, new traits added. * First correction of NBT Data in Trait (Soulbound). Is shown twice. Still needs corrections. * Few fixes in traits and new trait "catcher" * Small fix, needs workaround * fixed some catch issues * Fixed Catcher and Reviving Traits, new Trait: Souleater. Updated build.gradle for new TiC Version. * Splitted SoulEater to get the bad touch to an extra trait "Cursed". Added method for using nbt more easily. Changed declaration names of fluids * Some minor changes in Traits, Registry and Utils. * Iron_nugget is replaced with oreDict Item when not loaded via TAIGA. * Beginning of new material integration. Lot of names changed, lot more work to do here. Many null pointer exceptions and no changes of values up to now. * Some Small changes in names, registry and recipes * Some weird stuff I don't remember :D * fixed some things I missed while merging * Rollback to something * More Stuff * fixed some merging stuff * Fixed some misspelled names. Actually working with lots of restrictions. * Rearranged alloys, tried to add blocks / ingots for non-tinker-materials, but they won't work. * Again tried to fix the melting issue, but non-tinker materials still are not able to be casted as a block, ingot or nugget... * Fixed integration of materials without tools. * changed IMC to direct lib calls * removed more IMC, removed redundant code * some reformatting * Alloy integration reworked, needs to be balanced. * updated deps, renamed some func's, added duplicate material check * some more renaming * some reformatting, fixed wrong import, fixed string cmp's * Added images for blocks, ingots, nuggets and dust. Json changes do not work yet. * some reformatting * Removed old json files. Placeholder needed. * Fixed block json, items not working yet. * Fixed my own derp (missing json files) * Reduced materials to ensure unique traits for most of them. Still 30 though, but reduced by 20 more :'( RIP * Changed some generator stuff, not working properly right now! * rewrote offset generation, added some debug command, fixed some stuff * fixed on-surface-generation, made dependencies more flexible * reverted gen-weight back to its normal value * Meteor generator implemented. * fixed generating on ground * optimized a thing * Replaced Uru with Osram, replaced Meteorite with Uru, added Meteorite again for Hull-Material and late game alloy. * Some changes in generation of ores, not ready yet. * Added Cobble Meteorite. Added debug command. Implemented rest of ore generation. Some minor fixes left for generation including balancing. * Some changes for ore generation. Added 2 separate Generic Blocks for meteorite and their cobble variant. * some cleanup in Generator class, added meteor world save handler * Added Textures. Added blockstates and item models. Fixed fluid rendering. * renamed world save data file to be little more specific, removed a unused method * some preps for the upcoming release * First attempt of well balancing material stats. Renamed TiberiumX to Triberium. * Final changes... ready for beta testing * Added missing alloys. * Corrected balancing of ore generation. Still WIP * removed some last debug out * one last reformat
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
package com.sosnitzka.taiga.world;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldSavedData;
|
||||
import net.minecraft.world.storage.MapStorage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.sosnitzka.taiga.TAIGA.MODID;
|
||||
|
||||
public class MeteorWorldSaveData extends WorldSavedData {
|
||||
private static final String DATA_NAME = MODID + "_meteors";
|
||||
private List<BlockPos> posList;
|
||||
|
||||
public MeteorWorldSaveData() {
|
||||
super(DATA_NAME);
|
||||
}
|
||||
|
||||
public static MeteorWorldSaveData getForWorld(World world) {
|
||||
MapStorage storage = world.getPerWorldStorage();
|
||||
MeteorWorldSaveData instance = (MeteorWorldSaveData) storage.getOrLoadData(MeteorWorldSaveData.class, DATA_NAME);
|
||||
|
||||
if (instance == null) {
|
||||
instance = new MeteorWorldSaveData();
|
||||
storage.setData(DATA_NAME, instance);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public List<BlockPos> getPosList() {
|
||||
return posList;
|
||||
}
|
||||
|
||||
public void addPos(BlockPos pos) {
|
||||
if (posList == null)
|
||||
posList = new ArrayList<BlockPos>();
|
||||
|
||||
posList.add(pos);
|
||||
}
|
||||
|
||||
public boolean removePos(BlockPos pos) {
|
||||
return posList != null && posList.remove(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
if (nbt.hasKey("posData")) {
|
||||
posList = new Gson().fromJson(nbt.getString("posData"), posList.getClass());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
|
||||
if (posList == null)
|
||||
return null;
|
||||
|
||||
compound.setString("posData", new Gson().toJson(posList));
|
||||
return compound;
|
||||
}
|
||||
}
|
||||
71
src/main/java/com/sosnitzka/taiga/world/WorldGen.java
Normal file
71
src/main/java/com/sosnitzka/taiga/world/WorldGen.java
Normal file
@@ -0,0 +1,71 @@
|
||||
package com.sosnitzka.taiga.world;
|
||||
|
||||
|
||||
import com.sosnitzka.taiga.util.Generator;
|
||||
import net.minecraft.block.BlockStone;
|
||||
import net.minecraft.init.Biomes;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.IChunkGenerator;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraftforge.fml.common.IWorldGenerator;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import static com.google.common.collect.Lists.newArrayList;
|
||||
import static com.sosnitzka.taiga.Blocks.*;
|
||||
import static com.sosnitzka.taiga.TAIGAConfiguration.ironGen;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public class WorldGen implements IWorldGenerator {
|
||||
private void nether(Random random, int x, int z, World world) {
|
||||
|
||||
Generator.generateOre(false, Blocks.NETHERRACK.getDefaultState(), tiberiumOre.getDefaultState(), random, x, z, world, 15, 0, 128, 10, 35);
|
||||
Generator.generateOre(true, Blocks.NETHERRACK.getDefaultState(), prometheumOre.getDefaultState(), random, x, z, world, 25, 0, 128, 2, 4);
|
||||
Generator.generateOre(true, Blocks.NETHERRACK.getDefaultState(), valyriumOre.getDefaultState(), random, x, z, world, 10, 0, 32, 2, 4);
|
||||
Generator.generateOreDescending(newArrayList(Blocks.LAVA.getDefaultState(), Blocks.FLOWING_LAVA.getDefaultState()), osramOre.getDefaultState(), random, x, z, world, 1, 0, 64, 5);
|
||||
|
||||
}
|
||||
|
||||
private void world(Random random, int x, int z, World world) {
|
||||
// Optional
|
||||
if (!ironGen) {
|
||||
Generator.generateOre(false, Blocks.STONE.getDefaultState(), Blocks.IRON_ORE.getDefaultState(), random, x, z, world, 20, 0, 128, 1, 8);
|
||||
}
|
||||
Generator.generateMeteor(duraniteOre.getDefaultState(), blockMeteorite.getDefaultState(), random, x, z, world, 1, 4, 16, 112);
|
||||
Generator.generateOreDescending(newArrayList(Blocks.LAVA.getDefaultState(), Blocks.FLOWING_LAVA.getDefaultState()), basaltBlock.getDefaultState(), random, x, z, world, 10, 0, 64);
|
||||
Generator.generateOreDescending(newArrayList(Blocks.BEDROCK.getDefaultState()), eezoOre.getDefaultState(), random, x, z, world, 3, 0, 10);
|
||||
Generator.generateOre(karmesineOre.getDefaultState(), Blocks.STONE.getDefaultState(), BlockStone.VARIANT, BlockStone.EnumType.DIORITE, random, x, z, world, 15, 0, 96, 3, 4, null);
|
||||
Generator.generateOre(karmesineOre.getDefaultState(), Blocks.STONE.getDefaultState(), BlockStone.VARIANT, BlockStone.EnumType.ANDESITE, random, x, z, world, 15, 0, 96, 3, 4, null);
|
||||
Generator.generateOre(karmesineOre.getDefaultState(), Blocks.STONE.getDefaultState(), BlockStone.VARIANT, BlockStone.EnumType.GRANITE, random, x, z, world, 15, 0, 96, 3, 4, null);
|
||||
Generator.generateOreDense(vibraniumOre.getDefaultState(), Blocks.STONE.getDefaultState(), random, x, z, world, 10, 0, 64, 2, 12, newArrayList(Biomes.DESERT_HILLS, Biomes.EXTREME_HILLS, Biomes.EXTREME_HILLS_EDGE, Biomes.EXTREME_HILLS_WITH_TREES, Biomes.DESERT));
|
||||
}
|
||||
|
||||
private void end(Random random, int x, int z, World world) {
|
||||
Generator.generateCube(true, uruOre.getDefaultState(), blockObsidiorite.getDefaultState(), random, x, z, world, 1, 2, 0, 96, 3);
|
||||
Generator.generateOre(Blocks.END_STONE.getDefaultState(), Blocks.AIR.getDefaultState(), null, null, random, x, z, world, 1, 3, 64, 3, 8, null);
|
||||
Generator.generateOre(false, Blocks.END_STONE.getDefaultState(), auroriumOre.getDefaultState(), random, x, z, world, 10, 32, 48, 2, 4);
|
||||
Generator.generateOre(true, Blocks.END_STONE.getDefaultState(), palladiumOre.getDefaultState(), random, x, z, world, 10, 48, 64, 2, 4);
|
||||
Generator.generateOreBottom(Blocks.END_STONE.getDefaultState(), abyssumOre.getDefaultState(), random, x, z, world, 12, 4, 64);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
|
||||
int x = chunkX * 16;
|
||||
int z = chunkZ * 16;
|
||||
switch (world.provider.getDimension()) {
|
||||
case -1:
|
||||
nether(random, x, z, world);
|
||||
break;
|
||||
case 0:
|
||||
world(random, x, z, world);
|
||||
break;
|
||||
case 1:
|
||||
end(random, x, z, world);
|
||||
break;
|
||||
default:
|
||||
world(random, x, z, world);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,12 +8,11 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenMinable;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
import java.util.Random;
|
||||
|
||||
public class ZWorldGenMinable extends WorldGenMinable {
|
||||
public class WorldGenMinable extends net.minecraft.world.gen.feature.WorldGenMinable {
|
||||
private final IBlockState oreBlock;
|
||||
/**
|
||||
* The number of com.sosnitzka.taiga.blocks to generate.
|
||||
@@ -21,11 +20,11 @@ public class ZWorldGenMinable extends WorldGenMinable {
|
||||
private final int numberOfBlocks;
|
||||
private final Predicate<IBlockState> predicate;
|
||||
|
||||
public ZWorldGenMinable(IBlockState state, int blockCount) {
|
||||
public WorldGenMinable(IBlockState state, int blockCount) {
|
||||
this(state, blockCount, BlockMatcher.forBlock(Blocks.STONE));
|
||||
}
|
||||
|
||||
public ZWorldGenMinable(IBlockState state, int blockCount, Predicate<IBlockState> predicate) {
|
||||
public WorldGenMinable(IBlockState state, int blockCount, Predicate<IBlockState> predicate) {
|
||||
super(state, blockCount, predicate);
|
||||
this.oreBlock = state;
|
||||
this.numberOfBlocks = blockCount;
|
||||
@@ -1,80 +0,0 @@
|
||||
package com.sosnitzka.taiga.world;
|
||||
|
||||
import com.sosnitzka.taiga.util.Generator;
|
||||
import net.minecraft.block.BlockStone;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.IChunkGenerator;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraftforge.fml.common.IWorldGenerator;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import static com.sosnitzka.taiga.Blocks.*;
|
||||
import static com.sosnitzka.taiga.TAIGAConfiguration.*;
|
||||
|
||||
public class ZWorldGen implements IWorldGenerator {
|
||||
private void nether(Random random, int x, int z, World world) {
|
||||
|
||||
Generator.generateNetherOre(titaniteOre.getDefaultState(), random, x, z, world, (int) (35 * titaniteFactor * oreFactorGeneral), 1, 64, 2, 12);
|
||||
Generator.generateNetherOre(tiberiumOre.getDefaultState(), random, x, z, world, (int) (30 * tiberiumFactor * oreFactorGeneral), 0, 128, 2, 15);
|
||||
Generator.generateNetherOre(palladiumOre.getDefaultState(), random, x, z, world, (int) (35 * palladiumFactor * oreFactorGeneral), 32, 64, 2, 6);
|
||||
Generator.generateNetherOre(prometheumOre.getDefaultState(), random, x, z, world, (int) (35 * prometheumFactor * oreFactorGeneral), 64, 128, 2, 6);
|
||||
}
|
||||
|
||||
private void world(Random random, int x, int z, World world) {
|
||||
|
||||
// Optional
|
||||
if (slagIronGen) {
|
||||
Generator.generateOre(slagironOre.getDefaultState(), random, x, z, world, (int) (45 * slagironFactor * oreFactorGeneral), 0, 128, 2, 12);
|
||||
}
|
||||
if (slagGoldGen) {
|
||||
Generator.generateOre(slaggoldOre.getDefaultState(), random, x, z, world, (int) (20 * slaggoldFactor * oreFactorGeneral), 0, 32, 2, 12);
|
||||
}
|
||||
if (ironGen) {
|
||||
Generator.generateOre(Blocks.IRON_ORE.getDefaultState(), random, x, z, world, (int) (30 * ironFactor * oreFactorGeneral), 0, 128, 1, 9);
|
||||
}
|
||||
|
||||
// to be integrated mod specific
|
||||
Generator.generateOre(basalt.getDefaultState(), Blocks.LAVA.getDefaultState(), random, x, z, world, (int) (125 * basaltFactor * oreFactorGeneral), 0, 28, 2, 4);
|
||||
Generator.generateOre(rottenGround.getDefaultState(), Blocks.DIRT.getDefaultState(), random, x, z, world, (int) (25 * rottengroundFactor * oreFactorGeneral), 50, 70, 2, 15);
|
||||
|
||||
Generator.generateOre(ligniteOre.getDefaultState(), random, x, z, world, (int) (30 * ligniteFactor * oreFactorGeneral), 8, 96, 2, 12);
|
||||
Generator.generateOre(vibraniumOre.getDefaultState(), random, x, z, world, (int) (30 * vibraniumFactor * oreFactorGeneral), 48, 64, 2, 8);
|
||||
Generator.generateOre(karmesineOre.getDefaultState(), random, x, z, world, (int) (35 * karmesineFactor * oreFactorGeneral), 16, 48, 2, 8);
|
||||
Generator.generateOre(bismuthOre.getDefaultState(), random, x, z, world, (int) (40 * bismuthFactor * oreFactorGeneral), 50, 130, 2, 4);
|
||||
Generator.generateOre(mythrilOre.getDefaultState(), random, x, z, world, (int) (34 * mythrilFactor * oreFactorGeneral), 16, 32, 2, 8);
|
||||
Generator.generateOre(meteoriteOre.getDefaultState(), random, x, z, world, (int) (10 * meteoriteFactor * oreFactorGeneral), 0, 32, 2, 25);
|
||||
Generator.generateOre(mindoriteOre.getDefaultState(), Blocks.STONE.getDefaultState(), BlockStone.VARIANT, BlockStone.EnumType.DIORITE, random, x, z, world, (int) (120 * mindoriteFactor * oreFactorGeneral), 16, 96, 2, 8);
|
||||
Generator.generateOre(arcaniteOre.getDefaultState(), Blocks.STONE.getDefaultState(), BlockStone.VARIANT, BlockStone.EnumType.GRANITE, random, x, z, world, (int) (120 * arcaniteFactor * oreFactorGeneral), 16, 96, 2, 8);
|
||||
Generator.generateOre(eterniteOre.getDefaultState(), Blocks.STONE.getDefaultState(), BlockStone.VARIANT, BlockStone.EnumType.ANDESITE, random, x, z, world, (int) (120 * eterniteFactor * oreFactorGeneral), 16, 96, 2, 8);
|
||||
}
|
||||
|
||||
private void end(Random random, int x, int z, World world) {
|
||||
Generator.generateEndOre(adamantiteOre.getDefaultState(), random, x, z, world, (int) (15 * adamantiteFactor * oreFactorGeneral), 10, 35, 2, 8);
|
||||
Generator.generateEndOre(rubiumOre.getDefaultState(), random, x, z, world, (int) (15 * rubiumFactor * oreFactorGeneral), 10, 65, 2, 8);
|
||||
Generator.generateEndOre(ignititeOre.getDefaultState(), random, x, z, world, (int) (15 * ignititeFactor * oreFactorGeneral), 10, 45, 2, 8);
|
||||
Generator.generateEndOre(violiumOre.getDefaultState(), random, x, z, world, (int) (15 * violiumFactor * oreFactorGeneral), 10, 55, 2, 8);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
|
||||
int x = chunkX * 16;
|
||||
int z = chunkZ * 16;
|
||||
switch (world.provider.getDimension()) {
|
||||
case -1:
|
||||
nether(random, x, z, world);
|
||||
break;
|
||||
case 0:
|
||||
world(random, x, z, world);
|
||||
break;
|
||||
case 1:
|
||||
end(random, x, z, world);
|
||||
break;
|
||||
default:
|
||||
world(random, x, z, world);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user