mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
replaced biome specific world gen, RBMK boiler
This commit is contained in:
parent
e0a5d3f1d0
commit
07db4456af
@ -3,6 +3,10 @@ package com.hbm.interfaces;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* For receiving (sort of) complex control data via NBT from clients
|
||||
* @author hbm
|
||||
*/
|
||||
public interface IControlReceiver {
|
||||
|
||||
public boolean hasPermission(EntityPlayer player);
|
||||
|
||||
@ -69,7 +69,7 @@ public class HbmWorldGen implements IWorldGenerator {
|
||||
NoiseGeneratorOctaves octaves = new NoiseGeneratorOctaves(new Random(0x706f6e6379756dL), 1);
|
||||
|
||||
/**
|
||||
* Fake noise generator "unruh" ("unrest", the motion of a clockwork), using a bunch of layered, scaaled and offset
|
||||
* Fake noise generator "unruh" ("unrest", the motion of a clockwork), using a bunch of layered, scaled and offset
|
||||
* sine functions to simulate a simple noise generator that runs somewhat efficiently
|
||||
* @param long the random function seed used for this operation
|
||||
* @param x the exact x-coord of the height you want
|
||||
@ -223,8 +223,7 @@ public class HbmWorldGen implements IWorldGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
if (biome == BiomeGenBase.plains || biome == BiomeGenBase.forest || biome == BiomeGenBase.desert
|
||||
|| biome == BiomeGenBase.swampland || biome == BiomeGenBase.extremeHills) {
|
||||
if (biome.temperature >= 0.4F && biome.rainfall <= 0.6F) {
|
||||
if (WorldConfig.antennaStructure > 0 && rand.nextInt(WorldConfig.antennaStructure) == 0) {
|
||||
for (int a = 0; a < 1; a++) {
|
||||
int x = i + rand.nextInt(16);
|
||||
@ -236,8 +235,7 @@ public class HbmWorldGen implements IWorldGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
if (biome == BiomeGenBase.desert || biome == BiomeGenBase.beach || biome == BiomeGenBase.mesa
|
||||
|| biome == BiomeGenBase.mesaPlateau) {
|
||||
if(!biome.canSpawnLightningBolt() && biome.temperature >= 1.5F) {
|
||||
if (WorldConfig.atomStructure > 0 && rand.nextInt(WorldConfig.atomStructure) == 0) {
|
||||
for (int a = 0; a < 1; a++) {
|
||||
int x = i + rand.nextInt(16);
|
||||
@ -249,7 +247,7 @@ public class HbmWorldGen implements IWorldGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
if (biome == BiomeGenBase.desert) {
|
||||
if (!biome.canSpawnLightningBolt() && biome.temperature >= 2F) {
|
||||
if (WorldConfig.vertibirdStructure > 0 && rand.nextInt(WorldConfig.vertibirdStructure) == 0) {
|
||||
for (int a = 0; a < 1; a++) {
|
||||
int x = i + rand.nextInt(16);
|
||||
@ -273,7 +271,7 @@ public class HbmWorldGen implements IWorldGenerator {
|
||||
new LibraryDungeon().generate(world, rand, x, y, z);
|
||||
}
|
||||
|
||||
if (biome == BiomeGenBase.plains || biome == BiomeGenBase.desert) {
|
||||
if (biome.temperature == 0.5F || biome.temperature == 2.0F) {
|
||||
if (WorldConfig.relayStructure > 0 && rand.nextInt(WorldConfig.relayStructure) == 0) {
|
||||
for (int a = 0; a < 1; a++) {
|
||||
int x = i + rand.nextInt(16);
|
||||
@ -284,7 +282,8 @@ public class HbmWorldGen implements IWorldGenerator {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (biome == BiomeGenBase.plains || biome == BiomeGenBase.desert) {
|
||||
|
||||
if (biome.temperature == 0.5F || biome.temperature == 2.0F) {
|
||||
if (WorldConfig.satelliteStructure > 0 && rand.nextInt(WorldConfig.satelliteStructure) == 0) {
|
||||
for (int a = 0; a < 1; a++) {
|
||||
int x = i + rand.nextInt(16);
|
||||
@ -295,7 +294,8 @@ public class HbmWorldGen implements IWorldGenerator {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (biome == BiomeGenBase.desert) {
|
||||
|
||||
if (!biome.canSpawnLightningBolt() && biome.temperature >= 1.5F) {
|
||||
if (rand.nextInt(200) == 0) {
|
||||
for (int a = 0; a < 1; a++) {
|
||||
int x = i + rand.nextInt(16);
|
||||
@ -347,7 +347,7 @@ public class HbmWorldGen implements IWorldGenerator {
|
||||
new Spaceship().generate(world, rand, x, y, z);
|
||||
}
|
||||
|
||||
if (WorldConfig.barrelStructure > 0 && biome == BiomeGenBase.desert && rand.nextInt(WorldConfig.barrelStructure) == 0) {
|
||||
if (WorldConfig.barrelStructure > 0 && biome.temperature >= 1.5F && !biome.canSpawnLightningBolt() && rand.nextInt(WorldConfig.barrelStructure) == 0) {
|
||||
int x = i + rand.nextInt(16);
|
||||
int z = j + rand.nextInt(16);
|
||||
int y = world.getHeightValue(x, z);
|
||||
@ -399,7 +399,7 @@ public class HbmWorldGen implements IWorldGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
if (WorldConfig.geyserWater > 0 && biome == BiomeGenBase.plains && rand.nextInt(WorldConfig.geyserWater) == 0) {
|
||||
if (WorldConfig.geyserChlorine > 0 && biome == BiomeGenBase.plains && rand.nextInt(WorldConfig.geyserWater) == 0) {
|
||||
int x = i + rand.nextInt(16);
|
||||
int z = j + rand.nextInt(16);
|
||||
int y = world.getHeightValue(x, z);
|
||||
@ -408,7 +408,7 @@ public class HbmWorldGen implements IWorldGenerator {
|
||||
new Geyser().generate(world, rand, x, y, z);
|
||||
}
|
||||
|
||||
if (WorldConfig.geyserChlorine > 0 && biome == BiomeGenBase.desert && rand.nextInt(WorldConfig.geyserChlorine) == 0) {
|
||||
if (WorldConfig.geyserWater > 0 && biome == BiomeGenBase.desert && rand.nextInt(WorldConfig.geyserChlorine) == 0) {
|
||||
int x = i + rand.nextInt(16);
|
||||
int z = j + rand.nextInt(16);
|
||||
int y = world.getHeightValue(x, z);
|
||||
@ -442,7 +442,9 @@ public class HbmWorldGen implements IWorldGenerator {
|
||||
int z = j + rand.nextInt(16);
|
||||
int y = world.getHeightValue(x, z);
|
||||
|
||||
if(world.getBlock(x, y - 1, z) == Blocks.stone)
|
||||
if(world.getBlock(x, y, z) == Blocks.stone)
|
||||
world.setBlock(x, y, z, ModBlocks.geysir_vapor);
|
||||
else if(world.getBlock(x, y - 1, z) == Blocks.stone)
|
||||
world.setBlock(x, y - 1, z, ModBlocks.geysir_vapor);
|
||||
}
|
||||
|
||||
@ -567,7 +569,7 @@ public class HbmWorldGen implements IWorldGenerator {
|
||||
new ArcticVault().trySpawn(world, x, y, z);
|
||||
}
|
||||
|
||||
if (WorldConfig.pyramidStructure > 0 && biome == BiomeGenBase.desert && rand.nextInt(WorldConfig.pyramidStructure) == 0) {
|
||||
if (WorldConfig.pyramidStructure > 0 && biome.temperature >= 2.0F && !biome.canSpawnLightningBolt() && rand.nextInt(WorldConfig.pyramidStructure) == 0) {
|
||||
int x = i + rand.nextInt(16);
|
||||
int z = j + rand.nextInt(16);
|
||||
int y = world.getHeightValue(x, z);
|
||||
|
||||
@ -3,6 +3,7 @@ package com.hbm.tileentity.machine.rbmk;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@ -100,4 +101,18 @@ public abstract class TileEntityRBMKBase extends TileEntity {
|
||||
private void coolPassively() {
|
||||
this.heat -= this.passiveCooling();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
this.heat = nbt.getDouble("heat");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
nbt.setDouble("heat", this.heat);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,151 @@
|
||||
package com.hbm.tileentity.machine.rbmk;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidSource;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.lib.Library;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
public class TileEntityRBMKBoiler extends TileEntity {
|
||||
public class TileEntityRBMKBoiler extends TileEntityRBMKActiveBase implements IFluidAcceptor, IFluidSource, IControlReceiver {
|
||||
|
||||
public FluidTank feed;
|
||||
public FluidTank steam;
|
||||
public List<IFluidAcceptor> list = new ArrayList();
|
||||
|
||||
public TileEntityRBMKBoiler() {
|
||||
super();
|
||||
|
||||
feed = new FluidTank(FluidType.WATER, 10000, 0);
|
||||
steam = new FluidTank(FluidType.STEAM, 1000000, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "container.rbmkBoiler";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillFluidInit(FluidType type) {
|
||||
|
||||
fillFluid(this.xCoord + 1, this.yCoord, this.zCoord, getTact(), type);
|
||||
fillFluid(this.xCoord - 1, this.yCoord, this.zCoord, getTact(), type);
|
||||
fillFluid(this.xCoord, this.yCoord + 1, this.zCoord, getTact(), type);
|
||||
fillFluid(this.xCoord, this.yCoord - 1, this.zCoord, getTact(), type);
|
||||
fillFluid(this.xCoord, this.yCoord, this.zCoord + 1, getTact(), type);
|
||||
fillFluid(this.xCoord, this.yCoord, this.zCoord - 1, getTact(), type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillFluid(int x, int y, int z, boolean newTact, FluidType type) {
|
||||
Library.transmitFluid(x, y, z, newTact, this, worldObj, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated //why are we still doing this?
|
||||
public boolean getTact() { return false; }
|
||||
|
||||
@Override
|
||||
public void setFluidFill(int i, FluidType type) {
|
||||
|
||||
if(type == feed.getTankType())
|
||||
feed.setFill(i);
|
||||
else if(type == steam.getTankType())
|
||||
steam.setFill(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFluidFill(FluidType type) {
|
||||
|
||||
if(type == feed.getTankType())
|
||||
return feed.getFill();
|
||||
else if(type == steam.getTankType())
|
||||
return steam.getFill();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxFluidFill(FluidType type) {
|
||||
|
||||
if(type == feed.getTankType())
|
||||
return feed.getMaxFill();
|
||||
else if(type == steam.getTankType())
|
||||
return steam.getMaxFill();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFillstate(int fill, int index) {
|
||||
|
||||
if(index == 0)
|
||||
feed.setFill(fill);
|
||||
else if(index == 1)
|
||||
steam.setFill(fill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setType(FluidType type, int index) {
|
||||
|
||||
if(index == 0)
|
||||
feed.setTankType(type);
|
||||
else if(index == 1)
|
||||
steam.setTankType(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidTank> getTanks() {
|
||||
List<FluidTank> list = new ArrayList();
|
||||
list.add(feed);
|
||||
list.add(steam);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IFluidAcceptor> getFluidList(FluidType type) {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearFluidList(FluidType type) {
|
||||
list.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
feed.readFromNBT(nbt, "feed");
|
||||
steam.readFromNBT(nbt, "steam");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
feed.writeToNBT(nbt, "feed");
|
||||
steam.writeToNBT(nbt, "steam");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(EntityPlayer player) {
|
||||
return Vec3.createVectorHelper(xCoord - player.posX, yCoord - player.posY, zCoord - player.posZ).lengthVector() < 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveControl(NBTTagCompound data) {
|
||||
//TODO: compression toggles
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user