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

@@ -126,11 +126,12 @@ public class Chisel {
NetworkRegistry.INSTANCE.registerGuiHandler(this, new ChiselGuiHandler());
registerWorldgen(Features.MARBLE, ChiselBlocks.marble, Configurations.marbleAmount);
registerWorldgen(Features.LIMESTONE, ChiselBlocks.limestone, Configurations.limestoneAmount);
registerWorldgen(Features.ANDESITE, ChiselBlocks.andesite, Configurations.andesiteAmount);
registerWorldgen(Features.GRANITE, ChiselBlocks.granite, Configurations.graniteAmount);
registerWorldgen(Features.DIORITE, ChiselBlocks.diorite, Configurations.dioriteAmount);
addWorldgen(Features.MARBLE, ChiselBlocks.marble, Configurations.marbleAmount);
addWorldgen(Features.LIMESTONE, ChiselBlocks.limestone, Configurations.limestoneAmount);
addWorldgen(Features.ANDESITE, ChiselBlocks.andesite, Configurations.andesiteAmount, 40, 100, 0.5);
addWorldgen(Features.GRANITE, ChiselBlocks.granite, Configurations.graniteAmount, 40, 100, 0.5);
addWorldgen(Features.DIORITE, ChiselBlocks.diorite, Configurations.dioriteAmount, 40, 100, 0.5);
GameRegistry.registerWorldGenerator(GeneratorChisel.INSTANCE, 1000);
proxy.init();
MinecraftForge.EVENT_BUS.register(this);
@@ -139,9 +140,15 @@ public class Chisel {
FMLInterModComms.sendMessage("Waila", "register", "com.cricketcraft.chisel.compat.WailaCompat.register");
}
private void registerWorldgen(Features feature, Block block, int amount) {
private void addWorldgen(Features feature, Block block, double... data) {
if (feature.enabled()) {
GameRegistry.registerWorldGenerator(new GeneratorChisel(block, 32, amount), 1000);
if (data.length == 1) {
GeneratorChisel.INSTANCE.addFeature(block, 32, (int) data[0]);
} else if (data.length > 1 && data.length < 4) {
GeneratorChisel.INSTANCE.addFeature(block, 32, (int) data[0], (int) data[1], (int) data[2]);
} else if (data.length == 4) {
GeneratorChisel.INSTANCE.addFeature(block, 32, (int) data[0], (int) data[1], (int) data[2], data[3]);
}
}
}
@@ -119,7 +119,8 @@ public enum Features {
BlockCarvable andesite = (BlockCarvable) new BlockCarvable(Material.rock).setHardness(2.0F).setResistance(10.0F).setCreativeTab(ChiselTabs.tabStoneChiselBlocks);
andesite.carverHelper.setChiselBlockName("andesite");
andesite.carverHelper.addVariation("tile.andesite.0.desc", 0, "andesite/andesite");
andesite.carverHelper.addVariation("tile.andesite.1.desc", 1, "andesite/polishedAndesite");
andesite.carverHelper.addVariation("tile.andesite.1.desc", 1, "andesite/andesitePolished");
andesite.carverHelper.addVariation("tile.andesite.2.desc", 2, "andesite/andesitePillar");
andesite.carverHelper.registerAll(andesite, "andesite");
Carving.chisel.registerOre("andesite", "andesite");
}
@@ -549,7 +550,8 @@ public enum Features {
BlockCarvable diorite = (BlockCarvable) new BlockCarvable(Material.rock).setHardness(2.0F).setResistance(10.0F).setCreativeTab(ChiselTabs.tabStoneChiselBlocks);
diorite.carverHelper.setChiselBlockName("diorite");
diorite.carverHelper.addVariation("tile.diorite.0.desc", 0, "diorite/diorite");
diorite.carverHelper.addVariation("tile.diorite.1.desc", 1, "diorite/polishedDiorite");
diorite.carverHelper.addVariation("tile.diorite.1.desc", 1, "diorite/dioritePolished");
diorite.carverHelper.addVariation("tile.diorite.2.desc", 2, "diorite/dioritePillar");
diorite.carverHelper.registerAll(diorite, "diorite");
Carving.chisel.registerOre("diorite", "diorite");
}
@@ -885,7 +887,8 @@ public enum Features {
BlockCarvable granite = (BlockCarvable) new BlockCarvable(Material.rock).setHardness(2.0F).setResistance(10.0F).setCreativeTab(ChiselTabs.tabStoneChiselBlocks);
granite.carverHelper.setChiselBlockName("granite");
granite.carverHelper.addVariation("tile.granite.0.desc", 0, "granite/granite");
granite.carverHelper.addVariation("tile.granite.1.desc", 1, "granite/polishedGranite");
granite.carverHelper.addVariation("tile.granite.1.desc", 1, "granite/granitePolished");
granite.carverHelper.addVariation("tile.granite.1.desc", 2, "granite/granitePillar");
granite.carverHelper.registerAll(granite, "granite");
Carving.chisel.registerOre("granite", "granite");
}
@@ -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);
}
}
}
@@ -52,16 +52,19 @@ tile.antiBlock.gray.desc=Gray Anti Block
tile.diorite.name=Diorite
tile.diorite.0.desc=Generates in your world
tile.diorite.1.desc=Polished Diorite
tile.diorite.2.desc=Diorite Pillar
#Andesite
tile.andesite.name=Andesite
tile.andesite.0.desc=Generates in your world
tile.andesite.1.desc=Polished Andesite
tile.andesite.2.desc=Andesite Pillar
#Granite
tile.granite.name=Granite
tile.granite.0.desc=Generates in your world
tile.granite.1.desc=Polished Granite
tile.granite.2.desc=Granite Pillar
#Auto Chisel
tile.autoChisel.name=Auto Chisel
File renamed without changes.

Before

Width:  |  Height:  |  Size: 566 B

After

Width:  |  Height:  |  Size: 566 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 682 B

After

Width:  |  Height:  |  Size: 682 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 850 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 747 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 721 B

After

Width:  |  Height:  |  Size: 984 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 547 B

After

Width:  |  Height:  |  Size: 547 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 566 B

After

Width:  |  Height:  |  Size: 566 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 887 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 610 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 607 B

After

Width:  |  Height:  |  Size: 979 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 449 B

After

Width:  |  Height:  |  Size: 449 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 522 B

After

Width:  |  Height:  |  Size: 522 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 804 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 508 B