Fix all worldgen issues. Use 1.8 textures. Implement 1.8 block pillars.

Closes #168
Closes #159
Closes #130
This commit is contained in:
tterrag1098 committed 2015-01-24 22:03:30 -05:00
1 parent eb83ecf7ec
commit fa2dee3d77
18 files changed
+65 -22

No files matched your search

@@ -1,34 +1,64 @@
package com.cricketcraft.chisel.world;
import java.util.Map;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import com.google.common.collect.Maps;
import cpw.mods.fml.common.IWorldGenerator;
public class GeneratorChisel implements IWorldGenerator {
WorldGenMinable gen;
int amount;
private class WorldGenInfo {
public GeneratorChisel(Block block, int count, int am) {
gen = new WorldGenMinable(block, count);
amount = am;
private int amount;
private int minY, maxY;
private double chance;
private WorldGenInfo(int amount, int minY, int maxY, double chance) {
this.amount = amount;
this.minY = minY;
this.maxY = maxY;
this.chance = chance;
}
}
protected void genStandardOre(World world, Random random, int x, int z, int bot, int top) {
for (int l = 0; l < amount; ++l) {
int i1 = x + random.nextInt(16);
int j1 = bot + random.nextInt(top - bot);
int k1 = z + random.nextInt(16);
gen.generate(world, random, i1, j1, k1);
public static final GeneratorChisel INSTANCE = new GeneratorChisel();
private final Map<WorldGenMinable, WorldGenInfo> map = Maps.newHashMap();
public void addFeature(Block block, int count, int amount) {
addFeature(block, count, amount, 40, 128);
}
public void addFeature(Block block, int count, int amount, int minY, int maxY) {
addFeature(block, count, amount, minY, maxY, 1);
}
public void addFeature(Block block, int count, int amount, int minY, int maxY, double chance) {
map.put(new WorldGenMinable(block, count), new WorldGenInfo(amount, minY, maxY, chance));
}
protected void genStandardOre(WorldGenMinable gen, WorldGenInfo info, World world, Random random, int x, int z) {
for (int l = 0; l < info.amount; ++l) {
if (random.nextDouble() < info.chance) {
int avgX = x + random.nextInt(16);
int avgY = info.minY + random.nextInt(info.maxY - info.minY) + 1;
int avgZ = z + random.nextInt(16);
gen.generate(world, random, avgX, avgY, avgZ);
}
}
}
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
genStandardOre(world, random, chunkX * 16, chunkZ * 16, 40, 128);
for (WorldGenMinable gen : map.keySet()) {
genStandardOre(gen, map.get(gen), world, random, chunkX * 16, chunkZ * 16);
}
}
}