use of net.minecraft.world.biome.BiomeGenBase in project BuildCraft by BuildCraft.
the class OilPopulateOld method generateSurfaceDeposit.
public void generateSurfaceDeposit(World world, Random rand, int x, int y, int z, int radius) {
BiomeGenBase biome = world.getBiomeGenForCoords(new BlockPos(x, y, z));
generateSurfaceDeposit(world, rand, biome, x, y, z, radius);
}
use of net.minecraft.world.biome.BiomeGenBase in project RFToolsDimensions by McJty.
the class BiomeControllerMapping method findSuitableBiomes.
private static int findSuitableBiomes(BiomeGenBase[] biomeGenArray, BiomeGenBase biome, ControllerType.BiomeFilter filter) {
double bestdist = 1000000000.0f;
// Make sure we always have some matching biome.
int bestidx = 0;
for (BiomeGenBase base : biomeGenArray) {
if (base != null && filter.match(base)) {
// This 'base' could be a replacement. Check if it is close enough.
if (biome.getBiomeClass() == base.getBiomeClass()) {
// Same class, that's good enough for me.
return base.biomeID;
}
double dist = filter.calculateBiomeDistance(biome, base);
if (dist < bestdist) {
bestdist = dist;
bestidx = base.biomeID;
}
}
}
return bestidx;
}
use of net.minecraft.world.biome.BiomeGenBase in project RFToolsDimensions by McJty.
the class BiomeAbsorberTileEntity method placeDown.
public void placeDown() {
if (biomeName == null) {
BiomeGenBase biomeGenBase = worldObj.getBiomeGenForCoords(getPos());
if (biomeGenBase == null) {
biomeName = null;
absorbing = 0;
} else if (!biomeGenBase.biomeName.equals(biomeName)) {
biomeName = biomeGenBase.biomeName;
absorbing = DimletConstructionConfiguration.maxBiomeAbsorbtion;
}
markDirty();
}
}
use of net.minecraft.world.biome.BiomeGenBase in project RFToolsDimensions by McJty.
the class BiomeAbsorberTileEntity method checkStateServer.
protected void checkStateServer() {
if (absorbing > 0) {
BiomeGenBase biomeGenBase = worldObj.getBiomeGenForCoords(getPos());
if (biomeGenBase == null || !biomeGenBase.biomeName.equals(biomeName)) {
return;
}
absorbing--;
markDirtyClient();
}
}
use of net.minecraft.world.biome.BiomeGenBase in project RFToolsDimensions by McJty.
the class DimensionInformation method setupFromNBT.
private void setupFromNBT(NBTTagCompound tagCompound) {
terrainType = TerrainType.values()[tagCompound.getInteger("terrain")];
featureTypes = toEnumSet(getIntArraySafe(tagCompound, "features"), FeatureType.values());
structureTypes = toEnumSet(getIntArraySafe(tagCompound, "structures"), StructureType.values());
effectTypes = toEnumSet(getIntArraySafe(tagCompound, "effects"), EffectType.values());
biomes.clear();
for (int a : getIntArraySafe(tagCompound, "biomes")) {
BiomeGenBase biome = BiomeGenBase.getBiome(a);
if (biome != null) {
biomes.add(biome);
} else {
// Protect against deleted biomes (i.e. a mod with biomes gets removed and this dimension still uses it).
// We will pick a replacement biome here.
biomes.add(BiomeGenBase.plains);
}
}
if (tagCompound.hasKey("controller")) {
controllerType = ControllerType.values()[tagCompound.getInteger("controller")];
} else {
// Support for old type.
if (biomes.isEmpty()) {
controllerType = ControllerType.CONTROLLER_DEFAULT;
} else {
controllerType = ControllerType.CONTROLLER_SINGLE;
}
}
digitString = tagCompound.getString("digits");
forcedDimensionSeed = tagCompound.getLong("forcedSeed");
baseSeed = tagCompound.getLong("baseSeed");
worldVersion = tagCompound.getInteger("worldVersion");
baseBlockForTerrain = getBlockMeta(tagCompound, "baseBlock");
tendrilBlock = getBlockMeta(tagCompound, "tendrilBlock");
canyonBlock = getBlockMeta(tagCompound, "canyonBlock");
fluidForTerrain = (Block) Block.blockRegistry.getObjectById(tagCompound.getInteger("fluidBlock"));
hugeLiquidSphereFluids = readFluidsFromNBT(tagCompound, "hugeLiquidSphereFluids");
hugeLiquidSphereBlocks = readBlockArrayFromNBT(tagCompound, "hugeLiquidSphereBlocks");
// Support for the old format with only one liquid block.
Block oldLiquidSphereFluid = (Block) Block.blockRegistry.getObjectById(tagCompound.getInteger("liquidSphereFluid"));
liquidSphereFluids = readFluidsFromNBT(tagCompound, "liquidSphereFluids");
if (liquidSphereFluids.length == 0) {
liquidSphereFluids = new Block[] { oldLiquidSphereFluid };
}
// Support for the old format with only one sphere block.
IBlockState oldLiquidSphereBlock = getBlockMeta(tagCompound, "liquidSphereBlock");
liquidSphereBlocks = readBlockArrayFromNBT(tagCompound, "liquidSphereBlocks");
if (liquidSphereBlocks.length == 0) {
liquidSphereBlocks = new IBlockState[] { oldLiquidSphereBlock };
}
pyramidBlocks = readBlockArrayFromNBT(tagCompound, "pyramidBlocks");
if (pyramidBlocks.length == 0) {
pyramidBlocks = new IBlockState[] { Blocks.stone.getDefaultState() };
}
// Support for the old format with only one sphere block.
IBlockState oldSphereBlock = getBlockMeta(tagCompound, "sphereBlock");
sphereBlocks = readBlockArrayFromNBT(tagCompound, "sphereBlocks");
if (sphereBlocks.length == 0) {
sphereBlocks = new IBlockState[] { oldSphereBlock };
}
hugeSphereBlocks = readBlockArrayFromNBT(tagCompound, "hugeSphereBlocks");
extraOregen = readBlockArrayFromNBT(tagCompound, "extraOregen");
fluidsForLakes = readFluidsFromNBT(tagCompound, "lakeFluids");
peaceful = tagCompound.getBoolean("peaceful");
noanimals = tagCompound.getBoolean("noanimals");
shelter = tagCompound.getBoolean("shelter");
respawnHere = tagCompound.getBoolean("respawnHere");
if (tagCompound.hasKey("celestialAngle")) {
celestialAngle = tagCompound.getFloat("celestialAngle");
} else {
celestialAngle = null;
}
if (tagCompound.hasKey("timeSpeed")) {
timeSpeed = tagCompound.getFloat("timeSpeed");
} else {
timeSpeed = null;
}
probeCounter = tagCompound.getInteger("probes");
actualRfCost = tagCompound.getInteger("actualCost");
skyDescriptor = new SkyDescriptor.Builder().fromNBT(tagCompound).build();
calculateCelestialBodyDescriptors();
patreon1 = tagCompound.getLong("patreon1");
weatherDescriptor = new WeatherDescriptor.Builder().fromNBT(tagCompound).build();
extraMobs.clear();
NBTTagList list = tagCompound.getTagList("mobs", Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < list.tagCount(); i++) {
NBTTagCompound tc = list.getCompoundTagAt(i);
String className = tc.getString("class");
int chance = tc.getInteger("chance");
int minGroup = tc.getInteger("minGroup");
int maxGroup = tc.getInteger("maxGroup");
int maxLoaded = tc.getInteger("maxLoaded");
Class<? extends EntityLiving> c = null;
try {
c = (Class<? extends EntityLiving>) Class.forName(className);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
MobDescriptor mob = new MobDescriptor(c, chance, minGroup, maxGroup, maxLoaded);
extraMobs.add(mob);
}
String ds = tagCompound.getString("dimensionTypes");
dimensionTypes = StringUtils.split(ds, ",");
if (dimensionTypes == null) {
dimensionTypes = new String[0];
}
}
Aggregations