Project renamed to "TAIGA: Tinkers alloying addon"

This commit is contained in:
Robert Sosnitzka
2016-07-18 16:04:36 +02:00
parent c72689b68a
commit 7515737cb4
264 changed files with 341 additions and 339 deletions

View File

@@ -0,0 +1,67 @@
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.*;
public class ZWorldGen implements IWorldGenerator {
private void nether(Random random, int x, int z, World world) {
Generator.generateNetherOre(adamantiteOre.getDefaultState(), random, x, z, world, 25, 1, 32, 2, 5);
Generator.generateNetherOre(tiberiumOre.getDefaultState(), random, x, z, world, 60, 1, 128, 2, 7);
Generator.generateNetherOre(palladiumOre.getDefaultState(), random, x, z, world, 21, 32, 64, 2, 5);
Generator.generateOre(prometheumOre.getDefaultState(), random, x, z, world, 21, 48, 64, 2, 4);
}
private void world(Random random, int x, int z, World world) {
Generator.generateOre(slagironOre.getDefaultState(), random, x, z, world, 40, 8, 96, 5, 16);
Generator.generateOre(slaggoldOre.getDefaultState(), random, x, z, world, 20, 8, 48, 5, 9);
Generator.generateOre(ligniteOre.getDefaultState(), random, x, z, world, 40, 8, 96, 5, 15);
Generator.generateOre(Blocks.IRON_ORE.getDefaultState(), random, x, z, world, 40, 8, 96, 2, 14);
Generator.generateOre(basalt.getDefaultState(), Blocks.LAVA.getDefaultState(), random, x, z, world, 100, 8, 24, 2, 5);
Generator.generateOre(rottenGround.getDefaultState(), Blocks.DIRT.getDefaultState(), random, x, z, world, 25, 50, 70, 2, 15);
Generator.generateOre(vibraniumOre.getDefaultState(), random, x, z, world, 18, 48, 64, 2, 4);
Generator.generateOre(karmesineOre.getDefaultState(), random, x, z, world, 30, 16, 48, 2, 5);
Generator.generateOre(bismuthOre.getDefaultState(), random, x, z, world, 50, 50, 130, 2, 4);
Generator.generateOre(mythrilOre.getDefaultState(), random, x, z, world, 18, 16, 32, 2, 4);
Generator.generateOre(meteoriteOre.getDefaultState(), random, x, z, world, 12, 0, 32, 2, 10);
Generator.generateOre(mindoriteOre.getDefaultState(), Blocks.STONE.getDefaultState(), BlockStone.VARIANT, BlockStone.EnumType.DIORITE, random, x, z, world, 200, 16, 96, 2, 4);
Generator.generateOre(arcaniteOre.getDefaultState(), Blocks.STONE.getDefaultState(), BlockStone.VARIANT, BlockStone.EnumType.GRANITE, random, x, z, world, 200, 16, 96, 2, 4);
Generator.generateOre(eterniteOre.getDefaultState(), Blocks.STONE.getDefaultState(), BlockStone.VARIANT, BlockStone.EnumType.ANDESITE, random, x, z, world, 200, 16, 96, 2, 4);
}
private void end(Random random, int x, int z, World world) {
Generator.generateEndOre(rubiumOre.getDefaultState(), random, x, z, world, 16, 10, 35, 2, 6);
Generator.generateEndOre(ignititeOre.getDefaultState(), random, x, z, world, 16, 20, 45, 2, 6);
Generator.generateEndOre(violiumOre.getDefaultState(), random, x, z, world, 16, 30, 55, 2, 6);
Generator.generateEndOre(titaniteOre.getDefaultState(), random, x, z, world, 16, 40, 65, 2, 6);
}
@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;
}
}
}

View File

@@ -0,0 +1,87 @@
package com.sosnitzka.taiga.world;
import com.google.common.base.Predicate;
import com.sosnitzka.taiga.util.StateMatcher;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.state.pattern.BlockMatcher;
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 java.util.Random;
public class ZWorldGenMinable extends WorldGenMinable {
private final IBlockState oreBlock;
/**
* The number of com.sosnitzka.taiga.blocks to generate.
*/
private final int numberOfBlocks;
private final Predicate<IBlockState> predicate;
public ZWorldGenMinable(IBlockState state, int blockCount) {
this(state, blockCount, BlockMatcher.forBlock(Blocks.STONE));
}
public ZWorldGenMinable(IBlockState state, int blockCount, Predicate<IBlockState> predicate) {
super(state, blockCount, predicate);
this.oreBlock = state;
this.numberOfBlocks = blockCount;
this.predicate = predicate;
}
@Override
public boolean generate(World worldIn, Random rand, BlockPos position) {
float f = rand.nextFloat() * (float) Math.PI;
double d0 = (double) ((float) (position.getX() + 8) + MathHelper.sin(f) * (float) this.numberOfBlocks / 8.0F);
double d1 = (double) ((float) (position.getX() + 8) - MathHelper.sin(f) * (float) this.numberOfBlocks / 8.0F);
double d2 = (double) ((float) (position.getZ() + 8) + MathHelper.cos(f) * (float) this.numberOfBlocks / 8.0F);
double d3 = (double) ((float) (position.getZ() + 8) - MathHelper.cos(f) * (float) this.numberOfBlocks / 8.0F);
double d4 = (double) (position.getY() + rand.nextInt(3) - 2);
double d5 = (double) (position.getY() + rand.nextInt(3) - 2);
for (int i = 0; i < this.numberOfBlocks; ++i) {
float f1 = (float) i / (float) this.numberOfBlocks;
double d6 = d0 + (d1 - d0) * (double) f1;
double d7 = d4 + (d5 - d4) * (double) f1;
double d8 = d2 + (d3 - d2) * (double) f1;
double d9 = rand.nextDouble() * (double) this.numberOfBlocks / 16.0D;
double d10 = (double) (MathHelper.sin((float) Math.PI * f1) + 1.0F) * d9 + 1.0D;
double d11 = (double) (MathHelper.sin((float) Math.PI * f1) + 1.0F) * d9 + 1.0D;
int j = MathHelper.floor_double(d6 - d10 / 2.0D);
int k = MathHelper.floor_double(d7 - d11 / 2.0D);
int l = MathHelper.floor_double(d8 - d10 / 2.0D);
int i1 = MathHelper.floor_double(d6 + d10 / 2.0D);
int j1 = MathHelper.floor_double(d7 + d11 / 2.0D);
int k1 = MathHelper.floor_double(d8 + d10 / 2.0D);
for (int l1 = j; l1 <= i1; ++l1) {
double d12 = ((double) l1 + 0.5D - d6) / (d10 / 2.0D);
if (d12 * d12 < 1.0D) {
for (int i2 = k; i2 <= j1; ++i2) {
double d13 = ((double) i2 + 0.5D - d7) / (d11 / 2.0D);
if (d12 * d12 + d13 * d13 < 1.0D) {
for (int j2 = l; j2 <= k1; ++j2) {
double d14 = ((double) j2 + 0.5D - d8) / (d10 / 2.0D);
if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D) {
BlockPos blockpos = new BlockPos(l1, i2, j2);
IBlockState state = worldIn.getBlockState(blockpos);
if (((StateMatcher) this.predicate).apply(state, blockpos, worldIn)) {
worldIn.setBlockState(blockpos, this.oreBlock, 2);
}
}
}
}
}
}
}
}
return true;
}
}