More improvements to Oil Gen
Oil Lakes can no longer only spawn in sand. Added IMC calls for Lakes and excluded Biomes. "oil-lake-biome" and "oil-gen-exclude", both take the BiomeID as an argument. Increased specular highlights on Oil texture, you shouldn't have to jump in the pool to tell the difference between lighting glitches and oil anymore. Oil Lakes now have 50% chance of being 2 blocks deep. Improved gen to prevent floating trees, etc. Oil Wells should no longer gen in mod added trees.
This commit is contained in:
parent
0b44d97359
commit
bd6024a53f
6 changed files with 151 additions and 85 deletions
Binary file not shown.
Before Width: | Height: | Size: 6 KiB After Width: | Height: | Size: 3.3 KiB |
|
@ -1,32 +1,32 @@
|
||||||
0*2
|
0*4
|
||||||
1*2
|
1*4
|
||||||
2*2
|
2*4
|
||||||
3*2
|
3*4
|
||||||
4*2
|
4*4
|
||||||
5*2
|
5*4
|
||||||
6*2
|
6*4
|
||||||
7*2
|
7*4
|
||||||
8*2
|
8*4
|
||||||
9*2
|
9*4
|
||||||
10*2
|
10*4
|
||||||
11*2
|
11*4
|
||||||
12*2
|
12*4
|
||||||
13*2
|
13*4
|
||||||
14*2
|
14*4
|
||||||
15*2
|
15*4
|
||||||
16*2
|
16*4
|
||||||
17*2
|
17*4
|
||||||
18*2
|
18*4
|
||||||
19*2
|
19*4
|
||||||
20*2
|
20*4
|
||||||
21*2
|
21*4
|
||||||
22*2
|
22*4
|
||||||
23*2
|
23*4
|
||||||
24*2
|
24*4
|
||||||
25*2
|
25*4
|
||||||
26*2
|
26*4
|
||||||
27*2
|
27*4
|
||||||
28*2
|
28*4
|
||||||
29*2
|
29*4
|
||||||
30*2
|
30*4
|
||||||
31*2
|
31*4
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 6.5 KiB |
|
@ -0,0 +1,32 @@
|
||||||
|
0*2
|
||||||
|
1*2
|
||||||
|
2*2
|
||||||
|
3*2
|
||||||
|
4*2
|
||||||
|
5*2
|
||||||
|
6*2
|
||||||
|
7*2
|
||||||
|
8*2
|
||||||
|
9*2
|
||||||
|
10*2
|
||||||
|
11*2
|
||||||
|
12*2
|
||||||
|
13*2
|
||||||
|
14*2
|
||||||
|
15*2
|
||||||
|
16*2
|
||||||
|
17*2
|
||||||
|
18*2
|
||||||
|
19*2
|
||||||
|
20*2
|
||||||
|
21*2
|
||||||
|
22*2
|
||||||
|
23*2
|
||||||
|
24*2
|
||||||
|
25*2
|
||||||
|
26*2
|
||||||
|
27*2
|
||||||
|
28*2
|
||||||
|
29*2
|
||||||
|
30*2
|
||||||
|
31*2
|
|
@ -1,11 +1,10 @@
|
||||||
/**
|
/**
|
||||||
* BuildCraft is open-source. It is distributed under the terms of the
|
* BuildCraft is open-source. It is distributed under the terms of the
|
||||||
* BuildCraft Open Source License. It grants rights to read, modify, compile
|
* BuildCraft Open Source License. It grants rights to read, modify, compile or
|
||||||
* or run the code. It does *NOT* grant the right to redistribute this software
|
* run the code. It does *NOT* grant the right to redistribute this software or
|
||||||
* or its modifications in any form, binary or source, except if expressively
|
* its modifications in any form, binary or source, except if expressively
|
||||||
* granted by the copyright holder.
|
* granted by the copyright holder.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package buildcraft;
|
package buildcraft;
|
||||||
|
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
@ -47,45 +46,42 @@ import buildcraft.energy.ItemEngine;
|
||||||
import buildcraft.energy.OilBucketHandler;
|
import buildcraft.energy.OilBucketHandler;
|
||||||
import buildcraft.energy.OilPopulate;
|
import buildcraft.energy.OilPopulate;
|
||||||
import buildcraft.energy.TriggerEngineHeat;
|
import buildcraft.energy.TriggerEngineHeat;
|
||||||
|
import com.google.common.base.Splitter;
|
||||||
import cpw.mods.fml.common.Mod;
|
import cpw.mods.fml.common.Mod;
|
||||||
import cpw.mods.fml.common.Mod.Init;
|
import cpw.mods.fml.common.Mod.Init;
|
||||||
import cpw.mods.fml.common.Mod.Instance;
|
import cpw.mods.fml.common.Mod.Instance;
|
||||||
import cpw.mods.fml.common.Mod.PreInit;
|
import cpw.mods.fml.common.Mod.PreInit;
|
||||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||||
|
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||||
import cpw.mods.fml.common.network.NetworkMod;
|
import cpw.mods.fml.common.network.NetworkMod;
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
|
||||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
|
||||||
@Mod(name = "BuildCraft Energy", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Energy", dependencies = DefaultProps.DEPENDENCY_CORE)
|
@Mod(name = "BuildCraft Energy", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Energy", dependencies = DefaultProps.DEPENDENCY_CORE)
|
||||||
@NetworkMod(channels = { DefaultProps.NET_CHANNEL_NAME }, packetHandler = PacketHandler.class, clientSideRequired = true, serverSideRequired = true)
|
@NetworkMod(channels = {DefaultProps.NET_CHANNEL_NAME}, packetHandler = PacketHandler.class, clientSideRequired = true, serverSideRequired = true)
|
||||||
public class BuildCraftEnergy {
|
public class BuildCraftEnergy {
|
||||||
|
|
||||||
public final static int ENERGY_REMOVE_BLOCK = 25;
|
public final static int ENERGY_REMOVE_BLOCK = 25;
|
||||||
public final static int ENERGY_EXTRACT_ITEM = 2;
|
public final static int ENERGY_EXTRACT_ITEM = 2;
|
||||||
|
|
||||||
public static BlockEngine engineBlock;
|
public static BlockEngine engineBlock;
|
||||||
|
|
||||||
public static Block oilMoving;
|
public static Block oilMoving;
|
||||||
public static Block oilStill;
|
public static Block oilStill;
|
||||||
public static Item bucketOil;
|
public static Item bucketOil;
|
||||||
public static Item bucketFuel;
|
public static Item bucketFuel;
|
||||||
|
|
||||||
public static Item fuel;
|
public static Item fuel;
|
||||||
|
|
||||||
public static LiquidStack oilLiquid;
|
public static LiquidStack oilLiquid;
|
||||||
public static LiquidStack fuelLiquid;
|
public static LiquidStack fuelLiquid;
|
||||||
|
|
||||||
public static TreeMap<BlockIndex, Integer> saturationStored = new TreeMap<BlockIndex, Integer>();
|
public static TreeMap<BlockIndex, Integer> saturationStored = new TreeMap<BlockIndex, Integer>();
|
||||||
|
|
||||||
public static BCTrigger triggerBlueEngineHeat = new TriggerEngineHeat(DefaultProps.TRIGGER_BLUE_ENGINE_HEAT, EnergyStage.Blue);
|
public static BCTrigger triggerBlueEngineHeat = new TriggerEngineHeat(DefaultProps.TRIGGER_BLUE_ENGINE_HEAT, EnergyStage.Blue);
|
||||||
public static BCTrigger triggerGreenEngineHeat = new TriggerEngineHeat(DefaultProps.TRIGGER_GREEN_ENGINE_HEAT, EnergyStage.Green);
|
public static BCTrigger triggerGreenEngineHeat = new TriggerEngineHeat(DefaultProps.TRIGGER_GREEN_ENGINE_HEAT, EnergyStage.Green);
|
||||||
public static BCTrigger triggerYellowEngineHeat = new TriggerEngineHeat(DefaultProps.TRIGGER_YELLOW_ENGINE_HEAT, EnergyStage.Yellow);
|
public static BCTrigger triggerYellowEngineHeat = new TriggerEngineHeat(DefaultProps.TRIGGER_YELLOW_ENGINE_HEAT, EnergyStage.Yellow);
|
||||||
public static BCTrigger triggerRedEngineHeat = new TriggerEngineHeat(DefaultProps.TRIGGER_RED_ENGINE_HEAT, EnergyStage.Red);
|
public static BCTrigger triggerRedEngineHeat = new TriggerEngineHeat(DefaultProps.TRIGGER_RED_ENGINE_HEAT, EnergyStage.Red);
|
||||||
|
|
||||||
@Instance("BuildCraft|Energy")
|
@Instance("BuildCraft|Energy")
|
||||||
public static BuildCraftEnergy instance;
|
public static BuildCraftEnergy instance;
|
||||||
|
|
||||||
|
@ -134,8 +130,9 @@ public class BuildCraftEnergy {
|
||||||
CoreProxy.proxy.registerBlock(oilMoving);
|
CoreProxy.proxy.registerBlock(oilMoving);
|
||||||
|
|
||||||
// Oil and fuel
|
// Oil and fuel
|
||||||
if (oilMoving.blockID + 1 != oilStill.blockID)
|
if (oilMoving.blockID + 1 != oilStill.blockID) {
|
||||||
throw new RuntimeException("Oil Still id must be Oil Moving id + 1");
|
throw new RuntimeException("Oil Still id must be Oil Moving id + 1");
|
||||||
|
}
|
||||||
|
|
||||||
fuel = new ItemBuildCraft(itemFuelId.getInt(DefaultProps.FUEL_ID)).setUnlocalizedName("fuel");
|
fuel = new ItemBuildCraft(itemFuelId.getInt(DefaultProps.FUEL_ID)).setUnlocalizedName("fuel");
|
||||||
LanguageRegistry.addName(fuel, "Fuel");
|
LanguageRegistry.addName(fuel, "Fuel");
|
||||||
|
@ -182,14 +179,48 @@ public class BuildCraftEnergy {
|
||||||
|
|
||||||
public static void loadRecipes() {
|
public static void loadRecipes() {
|
||||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(engineBlock, 1, 0),
|
CoreProxy.proxy.addCraftingRecipe(new ItemStack(engineBlock, 1, 0),
|
||||||
new Object[] { "www", " g ", "GpG", Character.valueOf('w'), "plankWood", Character.valueOf('g'), Block.glass, Character.valueOf('G'),
|
new Object[]{"www", " g ", "GpG", Character.valueOf('w'), "plankWood", Character.valueOf('g'), Block.glass, Character.valueOf('G'),
|
||||||
BuildCraftCore.woodenGearItem, Character.valueOf('p'), Block.pistonBase });
|
BuildCraftCore.woodenGearItem, Character.valueOf('p'), Block.pistonBase});
|
||||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(engineBlock, 1, 1), new Object[] { "www", " g ", "GpG", Character.valueOf('w'), Block.cobblestone,
|
CoreProxy.proxy.addCraftingRecipe(new ItemStack(engineBlock, 1, 1), new Object[]{"www", " g ", "GpG", Character.valueOf('w'), Block.cobblestone,
|
||||||
Character.valueOf('g'), Block.glass, Character.valueOf('G'), BuildCraftCore.stoneGearItem, Character.valueOf('p'), Block.pistonBase });
|
Character.valueOf('g'), Block.glass, Character.valueOf('G'), BuildCraftCore.stoneGearItem, Character.valueOf('p'), Block.pistonBase});
|
||||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(engineBlock, 1, 2), new Object[] { "www", " g ", "GpG", Character.valueOf('w'), Item.ingotIron,
|
CoreProxy.proxy.addCraftingRecipe(new ItemStack(engineBlock, 1, 2), new Object[]{"www", " g ", "GpG", Character.valueOf('w'), Item.ingotIron,
|
||||||
Character.valueOf('g'), Block.glass, Character.valueOf('G'), BuildCraftCore.ironGearItem, Character.valueOf('p'), Block.pistonBase });
|
Character.valueOf('g'), Block.glass, Character.valueOf('G'), BuildCraftCore.ironGearItem, Character.valueOf('p'), Block.pistonBase});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Mod.IMCCallback
|
||||||
|
public void processIMCRequests(FMLInterModComms.IMCEvent event) {
|
||||||
|
for (FMLInterModComms.IMCMessage m : event.getMessages()) {
|
||||||
|
if (m.key.equals("oil-lake-biome")) {
|
||||||
|
try {
|
||||||
|
String biomeID = m.getStringValue().trim();
|
||||||
|
int id = Integer.valueOf(biomeID);
|
||||||
|
if (id >= BiomeGenBase.biomeList.length) {
|
||||||
|
throw new IllegalArgumentException("Biome ID must be less than " + BiomeGenBase.biomeList.length);
|
||||||
|
}
|
||||||
|
OilPopulate.surfaceDepositBiomes.add(id);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
Logger.getLogger("Buildcraft").log(Level.WARNING,
|
||||||
|
String.format("Received an invalid oil-lake-biome request %s from mod %s", m.getStringValue(), m.getSender()));
|
||||||
|
}
|
||||||
|
Logger.getLogger("Buildcraft").log(Level.INFO,
|
||||||
|
String.format("Received an successfull oil-lake-biome request %s from mod %s", m.getStringValue(), m.getSender()));
|
||||||
|
} else if (m.key.equals("oil-gen-exclude")) {
|
||||||
|
try {
|
||||||
|
String biomeID = m.getStringValue().trim();
|
||||||
|
int id = Integer.valueOf(biomeID);
|
||||||
|
if (id >= BiomeGenBase.biomeList.length) {
|
||||||
|
throw new IllegalArgumentException("Biome ID must be less than " + BiomeGenBase.biomeList.length);
|
||||||
|
}
|
||||||
|
OilPopulate.excludedBiomes.add(id);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
Logger.getLogger("Buildcraft").log(Level.WARNING,
|
||||||
|
String.format("Received an invalid oil-gen-exclude request %s from mod %s", m.getStringValue(), m.getSender()));
|
||||||
|
}
|
||||||
|
Logger.getLogger("Buildcraft").log(Level.INFO,
|
||||||
|
String.format("Received an successfull oil-gen-exclude request %s from mod %s", m.getStringValue(), m.getSender()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// public static int createPollution (World world, int i, int j, int k, int
|
// public static int createPollution (World world, int i, int j, int k, int
|
||||||
// saturation) {
|
// saturation) {
|
||||||
// int remainingSaturation = saturation;
|
// int remainingSaturation = saturation;
|
||||||
|
|
|
@ -17,16 +17,20 @@ import net.minecraftforge.event.terraingen.PopulateChunkEvent;
|
||||||
import net.minecraftforge.event.terraingen.TerrainGen;
|
import net.minecraftforge.event.terraingen.TerrainGen;
|
||||||
import buildcraft.BuildCraftCore;
|
import buildcraft.BuildCraftCore;
|
||||||
import buildcraft.BuildCraftEnergy;
|
import buildcraft.BuildCraftEnergy;
|
||||||
import buildcraft.core.BlockSpring;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import net.minecraft.block.BlockFlower;
|
||||||
|
|
||||||
public class OilPopulate {
|
public class OilPopulate {
|
||||||
|
|
||||||
public static final Set<Integer> surfaceDepositBiomes = new HashSet<Integer>();
|
public static final Set<Integer> surfaceDepositBiomes = new HashSet<Integer>();
|
||||||
|
public static final Set<Integer> excludedBiomes = new HashSet<Integer>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
surfaceDepositBiomes.add(BiomeGenBase.desert.biomeID);
|
surfaceDepositBiomes.add(BiomeGenBase.desert.biomeID);
|
||||||
|
|
||||||
|
excludedBiomes.add(BiomeGenBase.sky.biomeID);
|
||||||
|
excludedBiomes.add(BiomeGenBase.hell.biomeID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ForgeSubscribe
|
@ForgeSubscribe
|
||||||
|
@ -48,28 +52,20 @@ public class OilPopulate {
|
||||||
public static void doPopulate(World world, Random rand, int x, int z) {
|
public static void doPopulate(World world, Random rand, int x, int z) {
|
||||||
BiomeGenBase biome = world.getBiomeGenForCoords(x + 16, z + 16);
|
BiomeGenBase biome = world.getBiomeGenForCoords(x + 16, z + 16);
|
||||||
|
|
||||||
// Do not generate oil in the End
|
// Do not generate oil in the End or Nether
|
||||||
if (biome.biomeID == BiomeGenBase.sky.biomeID || biome.biomeID == BiomeGenBase.hell.biomeID) {
|
if (excludedBiomes.contains(biome.biomeID)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Generate a surface oil lake
|
||||||
if (surfaceDepositBiomes.contains(biome.biomeID) && rand.nextFloat() > 0.97) {
|
if (surfaceDepositBiomes.contains(biome.biomeID) && rand.nextFloat() > 0.97) {
|
||||||
// Generate a small desert deposit
|
int lakeX = rand.nextInt(10) + 2 + x;
|
||||||
|
int lakeY = world.getTopSolidOrLiquidBlock(x, z) - 1;
|
||||||
|
int lakeZ = rand.nextInt(10) + 2 + z;
|
||||||
|
|
||||||
int startX = rand.nextInt(10) + 2;
|
int blockId = world.getBlockId(lakeX, lakeY, lakeZ);
|
||||||
int startZ = rand.nextInt(10) + 2;
|
if (blockId == biome.topBlock) {
|
||||||
|
generateSurfaceDeposit(world, rand, lakeX, lakeY, lakeZ, 3);
|
||||||
for (int j = 128; j > 65; --j) {
|
|
||||||
int i = startX + x;
|
|
||||||
int k = startZ + z;
|
|
||||||
|
|
||||||
int blockId = world.getBlockId(i, j, k);
|
|
||||||
if (blockId != 0) {
|
|
||||||
if (blockId == Block.sand.blockID) {
|
|
||||||
generateSurfaceDeposit(world, rand, i, j, k, 3);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +122,8 @@ public class OilPopulate {
|
||||||
world.setBlock(baseX, y, baseZ, BuildCraftEnergy.oilStill.blockID);
|
world.setBlock(baseX, y, baseZ, BuildCraftEnergy.oilStill.blockID);
|
||||||
} else {
|
} else {
|
||||||
int blockId = world.getBlockId(baseX, y, baseZ);
|
int blockId = world.getBlockId(baseX, y, baseZ);
|
||||||
if (blockId != 0 && blockId != Block.leaves.blockID && blockId != Block.wood.blockID && blockId != Block.grass.blockID) {
|
Block block = Block.blocksList[blockId];
|
||||||
|
if (blockId != 0 && !block.isLeaves(world, baseX, y, baseZ) && !block.isWood(world, baseX, y, baseZ)) {
|
||||||
started = true;
|
started = true;
|
||||||
|
|
||||||
if (largeDeposit) {
|
if (largeDeposit) {
|
||||||
|
@ -154,16 +151,17 @@ public class OilPopulate {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void generateSurfaceDeposit(World world, Random rand, int x, int y, int z, int radius) {
|
public static void generateSurfaceDeposit(World world, Random rand, int x, int y, int z, int radius) {
|
||||||
setOilWithProba(world, rand, 1, x, y, z, true);
|
int depth = rand.nextDouble() < 0.5 ? 1 : 2;
|
||||||
|
setOilWithProba(world, rand, 1, x, y, z, true, depth);
|
||||||
|
|
||||||
for (int w = 1; w <= radius; ++w) {
|
for (int w = 1; w <= radius; ++w) {
|
||||||
float proba = (float) (radius - w + 4) / (float) (radius + 4);
|
float proba = (float) (radius - w + 4) / (float) (radius + 4);
|
||||||
|
|
||||||
for (int d = -w; d <= w; ++d) {
|
for (int d = -w; d <= w; ++d) {
|
||||||
setOilWithProba(world, rand, proba, x + d, y, z + w, false);
|
setOilWithProba(world, rand, proba, x + d, y, z + w, false, depth);
|
||||||
setOilWithProba(world, rand, proba, x + d, y, z - w, false);
|
setOilWithProba(world, rand, proba, x + d, y, z - w, false, depth);
|
||||||
setOilWithProba(world, rand, proba, x + w, y, z + d, false);
|
setOilWithProba(world, rand, proba, x + w, y, z + d, false, depth);
|
||||||
setOilWithProba(world, rand, proba, x - w, y, z + d, false);
|
setOilWithProba(world, rand, proba, x - w, y, z + d, false, depth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,7 +171,7 @@ public class OilPopulate {
|
||||||
if (world.getBlockId(dx, y - 1, dz) != BuildCraftEnergy.oilStill.blockID) {
|
if (world.getBlockId(dx, y - 1, dz) != BuildCraftEnergy.oilStill.blockID) {
|
||||||
if (isOil(world, dx + 1, y - 1, dz) && isOil(world, dx - 1, y - 1, dz) && isOil(world, dx, y - 1, dz + 1)
|
if (isOil(world, dx + 1, y - 1, dz) && isOil(world, dx - 1, y - 1, dz) && isOil(world, dx, y - 1, dz + 1)
|
||||||
&& isOil(world, dx, y - 1, dz - 1)) {
|
&& isOil(world, dx, y - 1, dz - 1)) {
|
||||||
setOilWithProba(world, rand, 1.0F, dx, y, dz, true);
|
setOilWithProba(world, rand, 1.0F, dx, y, dz, true, depth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,10 +179,11 @@ public class OilPopulate {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isOil(World world, int x, int y, int z) {
|
private static boolean isOil(World world, int x, int y, int z) {
|
||||||
return (world.getBlockId(x, y, z) == BuildCraftEnergy.oilStill.blockID || world.getBlockId(x, y, z) == BuildCraftEnergy.oilMoving.blockID);
|
int blockId = world.getBlockId(x, y, z);
|
||||||
|
return (blockId == BuildCraftEnergy.oilStill.blockID || blockId == BuildCraftEnergy.oilMoving.blockID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setOilWithProba(World world, Random rand, float proba, int x, int y, int z, boolean force) {
|
public static void setOilWithProba(World world, Random rand, float proba, int x, int y, int z, boolean force, int depth) {
|
||||||
if ((rand.nextFloat() <= proba && world.getBlockId(x, y - 2, z) != 0) || force) {
|
if ((rand.nextFloat() <= proba && world.getBlockId(x, y - 2, z) != 0) || force) {
|
||||||
boolean adjacentOil = false;
|
boolean adjacentOil = false;
|
||||||
|
|
||||||
|
@ -195,14 +194,18 @@ public class OilPopulate {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (adjacentOil || force) {
|
if (adjacentOil || force) {
|
||||||
if (world.getBlockId(x, y, z) == Block.waterMoving.blockID || world.getBlockId(x, y, z) == Block.waterStill.blockID || isOil(world, x, y, z)) {
|
if (world.isAirBlock(x, y + 1, z) || Block.blocksList[world.getBlockId(x, y + 1, z)] instanceof BlockFlower) {
|
||||||
|
int blockId = world.getBlockId(x, y, z);
|
||||||
|
if (blockId == Block.waterMoving.blockID || blockId == Block.waterStill.blockID || isOil(world, x, y, z)) {
|
||||||
world.setBlock(x, y, z, BuildCraftEnergy.oilStill.blockID);
|
world.setBlock(x, y, z, BuildCraftEnergy.oilStill.blockID);
|
||||||
} else {
|
} else {
|
||||||
world.setBlock(x, y, z, 0);
|
world.setBlockToAir(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
world.setBlock(x, y - 1, z, BuildCraftEnergy.oilStill.blockID);
|
for (int i = depth; i > 0; i--) {
|
||||||
|
world.setBlock(x, y - i, z, BuildCraftEnergy.oilStill.blockID);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue