mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
industrial boiler
This commit is contained in:
parent
d09813957e
commit
4ad28d25f4
@ -673,6 +673,7 @@ public class ModBlocks {
|
||||
public static Block machine_sawmill;
|
||||
public static Block machine_crucible;
|
||||
public static Block machine_boiler;
|
||||
public static Block machine_industrial_boiler;
|
||||
|
||||
public static Block foundry_mold;
|
||||
public static Block foundry_basin;
|
||||
@ -1810,6 +1811,7 @@ public class ModBlocks {
|
||||
machine_sawmill = new MachineSawmill().setBlockName("machine_sawmill").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_crucible = new MachineCrucible().setBlockName("machine_crucible").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":brick_fire");
|
||||
machine_boiler = new MachineHeatBoiler().setBlockName("machine_boiler").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_copper");
|
||||
machine_industrial_boiler = new MachineHeatBoilerIndustrial().setBlockName("machine_industrial_boiler").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_copper");
|
||||
|
||||
foundry_mold = new FoundryMold().setBlockName("foundry_mold").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":brick_fire");
|
||||
foundry_basin = new FoundryBasin().setBlockName("foundry_basin").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":brick_fire");
|
||||
@ -3049,6 +3051,7 @@ public class ModBlocks {
|
||||
register(machine_sawmill);
|
||||
register(machine_crucible);
|
||||
register(machine_boiler);
|
||||
register(machine_industrial_boiler);
|
||||
register(foundry_mold);
|
||||
register(foundry_basin);
|
||||
register(foundry_channel);
|
||||
|
||||
@ -0,0 +1,126 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.trait.FT_Heatable;
|
||||
import com.hbm.inventory.fluid.trait.FT_Heatable.HeatingType;
|
||||
import com.hbm.items.machine.IItemFluidIdentifier;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityHeatBoilerIndustrial;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.ChatStyle;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class MachineHeatBoilerIndustrial extends BlockDummyable implements ILookOverlay, ITooltipProvider {
|
||||
|
||||
public MachineHeatBoilerIndustrial() {
|
||||
super(Material.iron);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
|
||||
if(meta >= 12) return new TileEntityHeatBoilerIndustrial();
|
||||
if(meta >= extra) return new TileEntityProxyCombo().fluid();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
|
||||
if(!world.isRemote && !player.isSneaking()) {
|
||||
|
||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IItemFluidIdentifier) {
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
|
||||
if(pos == null)
|
||||
return false;
|
||||
|
||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
|
||||
if(!(te instanceof TileEntityHeatBoilerIndustrial))
|
||||
return false;
|
||||
|
||||
TileEntityHeatBoilerIndustrial boiler = (TileEntityHeatBoilerIndustrial) te;
|
||||
|
||||
FluidType type = ((IItemFluidIdentifier) player.getHeldItem().getItem()).getType(world, pos[0], pos[1], pos[2], player.getHeldItem());
|
||||
|
||||
if(type.hasTrait(FT_Heatable.class) && type.getTrait(FT_Heatable.class).getEfficiency(HeatingType.BOILER) > 0) {
|
||||
boiler.tanks[0].setTankType(type);
|
||||
boiler.markDirty();
|
||||
player.addChatComponentMessage(new ChatComponentText("Changed type to ").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.YELLOW)).appendSibling(new ChatComponentTranslation("hbmfluid." + type.getName().toLowerCase(Locale.US))).appendSibling(new ChatComponentText("!")));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getDimensions() {
|
||||
return new int[] {4, 0, 1, 1, 1, 1};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOffset() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
super.fillSpace(world, x, y, z, dir, o);
|
||||
|
||||
this.makeExtra(world, x + dir.offsetX + 1, y, z + dir.offsetZ);
|
||||
this.makeExtra(world, x + dir.offsetX - 1, y, z + dir.offsetZ);
|
||||
this.makeExtra(world, x + dir.offsetX, y, z + dir.offsetZ + 1);
|
||||
this.makeExtra(world, x + dir.offsetX, y, z + dir.offsetZ - 1);
|
||||
this.makeExtra(world, x + dir.offsetX, y + 4, z + dir.offsetZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
|
||||
if(pos == null)
|
||||
return;
|
||||
|
||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
|
||||
if(!(te instanceof TileEntityHeatBoilerIndustrial))
|
||||
return;
|
||||
|
||||
TileEntityHeatBoilerIndustrial boiler = (TileEntityHeatBoilerIndustrial) te;
|
||||
|
||||
List<String> text = new ArrayList();
|
||||
text.add(String.format("%,d", boiler.heat) + "TU");
|
||||
text.add(EnumChatFormatting.GREEN + "-> " + EnumChatFormatting.RESET + I18nUtil.resolveKey(boiler.tanks[0].getTankType().getUnlocalizedName()) + ": " + String.format("%,d", boiler.tanks[0].getFill()) + " / " + String.format("%,d", boiler.tanks[0].getMaxFill()) + "mB");
|
||||
text.add(EnumChatFormatting.RED + "<- " + EnumChatFormatting.RESET + I18nUtil.resolveKey(boiler.tanks[1].getTankType().getUnlocalizedName()) + ": " + String.format("%,d", boiler.tanks[1].getFill()) + " / " + String.format("%,d", boiler.tanks[1].getMaxFill()) + "mB");
|
||||
|
||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
this.addStandardInfo(stack, player, list, ext);
|
||||
}
|
||||
}
|
||||
@ -320,8 +320,9 @@ public class PollutionHandler {
|
||||
if(living instanceof IMob) {
|
||||
|
||||
if(data.pollution[PollutionType.SOOT.ordinal()] > RadiationConfig.buffMobThreshold) {
|
||||
if(living.getEntityAttribute(SharedMonsterAttributes.maxHealth) != null) living.getEntityAttribute(SharedMonsterAttributes.maxHealth).applyModifier(new AttributeModifier("Soot Anger Health Increase", 2D, 1));
|
||||
if(living.getEntityAttribute(SharedMonsterAttributes.maxHealth) != null) living.getEntityAttribute(SharedMonsterAttributes.maxHealth).applyModifier(new AttributeModifier("Soot Anger Health Increase", 1D, 1));
|
||||
if(living.getEntityAttribute(SharedMonsterAttributes.attackDamage) != null) living.getEntityAttribute(SharedMonsterAttributes.attackDamage).applyModifier(new AttributeModifier("Soot Anger Damage Increase", 1.5D, 1));
|
||||
living.heal(living.getMaxHealth());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -271,6 +271,7 @@ public class ClientProxy extends ServerProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySawmill.class, new RenderSawmill());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCrucible.class, new RenderCrucible());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityHeatBoiler.class, new RenderBoiler());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityHeatBoilerIndustrial.class, new RenderIndustrialBoiler());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySteamEngine.class, new RenderSteamEngine());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineDiesel.class, new RenderDieselGen());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineCombustionEngine.class, new RenderCombustionEngine());
|
||||
|
||||
@ -48,6 +48,7 @@ public class ResourceManager {
|
||||
public static final IModelCustom crucible_heat = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/machines/crucible.obj"));
|
||||
public static final IModelCustom boiler = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/boiler.obj"));
|
||||
public static final IModelCustom boiler_burst = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/boiler_burst.obj"));
|
||||
public static final IModelCustom boiler_industrial = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/industrial_boiler.obj"));
|
||||
public static final IModelCustom hephaestus = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/hephaestus.obj"));
|
||||
|
||||
//Furnaces
|
||||
@ -396,6 +397,7 @@ public class ResourceManager {
|
||||
public static final ResourceLocation sawmill_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/sawmill.png");
|
||||
public static final ResourceLocation crucible_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/crucible_heat.png");
|
||||
public static final ResourceLocation boiler_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/boiler.png");
|
||||
public static final ResourceLocation boiler_industrial_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/industrial_boiler.png");
|
||||
public static final ResourceLocation hephaestus_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/hephaestus.png");
|
||||
|
||||
//Furnaces
|
||||
|
||||
@ -0,0 +1,51 @@
|
||||
package com.hbm.render.tileentity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.render.item.ItemRenderBase;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
public class RenderIndustrialBoiler extends TileEntitySpecialRenderer implements IItemRendererProvider {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float interp) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
bindTexture(ResourceManager.boiler_industrial_tex);
|
||||
ResourceManager.boiler_industrial.renderAll();
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemForRenderer() {
|
||||
return Item.getItemFromBlock(ModBlocks.machine_boiler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemRenderer getRenderer() {
|
||||
return new ItemRenderBase( ) {
|
||||
public void renderInventory() {
|
||||
GL11.glTranslated(0, -3, 0);
|
||||
GL11.glScaled(3, 3, 3);
|
||||
}
|
||||
public void renderCommonWithStack(ItemStack item) {
|
||||
GL11.glRotatef(90, 0F, 1F, 0F);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
bindTexture(ResourceManager.boiler_industrial_tex);
|
||||
ResourceManager.boiler_industrial.renderAll();
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
}};
|
||||
}
|
||||
}
|
||||
@ -50,15 +50,15 @@ public class TileEntityHeatBoiler extends TileEntityLoadedBase implements IFluid
|
||||
private int audioTime;
|
||||
|
||||
/* CONFIGURABLE */
|
||||
public static int maxHeat = 12_800_000; //the heat required to turn 64k of water into steam
|
||||
public static int maxHeat = 3_200_000;
|
||||
public static double diffusion = 0.1D;
|
||||
public static boolean canExplode = true;
|
||||
|
||||
public TileEntityHeatBoiler() {
|
||||
this.tanks = new FluidTank[2];
|
||||
|
||||
this.tanks[0] = new FluidTank(Fluids.WATER, 64_000, 0);
|
||||
this.tanks[1] = new FluidTank(Fluids.STEAM, 64_000 * 100, 1);
|
||||
this.tanks[0] = new FluidTank(Fluids.WATER, 16_000);
|
||||
this.tanks[1] = new FluidTank(Fluids.STEAM, 16_000 * 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -0,0 +1,303 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.fluid.trait.FT_Heatable;
|
||||
import com.hbm.inventory.fluid.trait.FT_Heatable.HeatingStep;
|
||||
import com.hbm.inventory.fluid.trait.FT_Heatable.HeatingType;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.saveddata.TomSaveData;
|
||||
import com.hbm.sound.AudioWrapper;
|
||||
import com.hbm.tileentity.IConfigurableMachine;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import api.hbm.tile.IHeatSource;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.EnumSkyBlock;
|
||||
|
||||
public class TileEntityHeatBoilerIndustrial extends TileEntityLoadedBase implements INBTPacketReceiver, IFluidStandardTransceiver, IConfigurableMachine {
|
||||
|
||||
public int heat;
|
||||
public FluidTank[] tanks;
|
||||
public boolean isOn;
|
||||
|
||||
private AudioWrapper audio;
|
||||
private int audioTime;
|
||||
|
||||
/* CONFIGURABLE */
|
||||
public static int maxHeat = 12_800_000;
|
||||
public static double diffusion = 0.1D;
|
||||
|
||||
public TileEntityHeatBoilerIndustrial() {
|
||||
this.tanks = new FluidTank[2];
|
||||
|
||||
this.tanks[0] = new FluidTank(Fluids.WATER, 64_000, 0);
|
||||
this.tanks[1] = new FluidTank(Fluids.STEAM, 64_000 * 100, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
this.setupTanks();
|
||||
this.updateConnections();
|
||||
this.tryPullHeat();
|
||||
int lastHeat = this.heat;
|
||||
|
||||
int light = this.worldObj.getSavedLightValue(EnumSkyBlock.Sky, this.xCoord, this.yCoord, this.zCoord);
|
||||
if(light > 7 && TomSaveData.forWorld(worldObj).fire > 1e-5) {
|
||||
this.heat += ((maxHeat - heat) * 0.000005D); //constantly heat up 0.0005% of the remaining heat buffer for rampant but diminishing heating
|
||||
}
|
||||
|
||||
data.setInteger("heat", lastHeat);
|
||||
|
||||
tanks[0].writeToNBT(data, "0");
|
||||
this.isOn = false;
|
||||
this.tryConvert();
|
||||
tanks[1].writeToNBT(data, "1");
|
||||
|
||||
if(this.tanks[1].getFill() > 0) {
|
||||
this.sendFluid();
|
||||
}
|
||||
|
||||
data.setBoolean("isOn", this.isOn);
|
||||
INBTPacketReceiver.networkPack(this, data, 25);
|
||||
} else {
|
||||
|
||||
if(this.isOn) audioTime = 20;
|
||||
|
||||
if(audioTime > 0) {
|
||||
|
||||
audioTime--;
|
||||
|
||||
if(audio == null) {
|
||||
audio = createAudioLoop();
|
||||
audio.startSound();
|
||||
} else if(!audio.isPlaying()) {
|
||||
audio = rebootAudio(audio);
|
||||
}
|
||||
|
||||
audio.keepAlive();
|
||||
|
||||
} else {
|
||||
|
||||
if(audio != null) {
|
||||
audio.stopSound();
|
||||
audio = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AudioWrapper createAudioLoop() {
|
||||
return MainRegistry.proxy.getLoopedSound("hbm:block.boiler", xCoord, yCoord, zCoord, 0.125F, 10F, 1.0F, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChunkUnload() {
|
||||
|
||||
if(audio != null) {
|
||||
audio.stopSound();
|
||||
audio = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
|
||||
super.invalidate();
|
||||
|
||||
if(audio != null) {
|
||||
audio.stopSound();
|
||||
audio = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.heat = nbt.getInteger("heat");
|
||||
this.tanks[0].readFromNBT(nbt, "0");
|
||||
this.tanks[1].readFromNBT(nbt, "1");
|
||||
this.isOn = nbt.getBoolean("isOn");
|
||||
}
|
||||
|
||||
protected void tryPullHeat() {
|
||||
TileEntity con = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord);
|
||||
|
||||
if(con instanceof IHeatSource) {
|
||||
IHeatSource source = (IHeatSource) con;
|
||||
int diff = source.getHeatStored() - this.heat;
|
||||
|
||||
if(diff == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(diff > 0) {
|
||||
diff = (int) Math.ceil(diff * diffusion);
|
||||
source.useUpHeat(diff);
|
||||
this.heat += diff;
|
||||
if(this.heat > this.maxHeat)
|
||||
this.heat = this.maxHeat;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.heat = Math.max(this.heat - Math.max(this.heat / 1000, 1), 0);
|
||||
}
|
||||
|
||||
protected void setupTanks() {
|
||||
|
||||
if(tanks[0].getTankType().hasTrait(FT_Heatable.class)) {
|
||||
FT_Heatable trait = tanks[0].getTankType().getTrait(FT_Heatable.class);
|
||||
if(trait.getEfficiency(HeatingType.BOILER) > 0) {
|
||||
HeatingStep entry = trait.getFirstStep();
|
||||
tanks[1].setTankType(entry.typeProduced);
|
||||
tanks[1].changeTankSize(tanks[0].getMaxFill() * entry.amountProduced / entry.amountReq);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
tanks[0].setTankType(Fluids.NONE);
|
||||
tanks[1].setTankType(Fluids.NONE);
|
||||
}
|
||||
|
||||
protected void tryConvert() {
|
||||
|
||||
if(tanks[0].getTankType().hasTrait(FT_Heatable.class)) {
|
||||
FT_Heatable trait = tanks[0].getTankType().getTrait(FT_Heatable.class);
|
||||
if(trait.getEfficiency(HeatingType.BOILER) > 0) {
|
||||
|
||||
HeatingStep entry = trait.getFirstStep();
|
||||
int inputOps = this.tanks[0].getFill() / entry.amountReq;
|
||||
int outputOps = (this.tanks[1].getMaxFill() - this.tanks[1].getFill()) / entry.amountProduced;
|
||||
int heatOps = this.heat / entry.heatReq;
|
||||
|
||||
int ops = Math.min(inputOps, Math.min(outputOps, heatOps));
|
||||
|
||||
this.tanks[0].setFill(this.tanks[0].getFill() - entry.amountReq * ops);
|
||||
this.tanks[1].setFill(this.tanks[1].getFill() + entry.amountProduced * ops);
|
||||
this.heat -= entry.heatReq * ops;
|
||||
|
||||
if(ops > 0 && worldObj.rand.nextInt(400) == 0) {
|
||||
worldObj.playSoundEffect(xCoord + 0.5, yCoord + 2, zCoord + 0.5, "hbm:block.boilerGroan", 0.5F, 1.0F);
|
||||
}
|
||||
|
||||
if(ops > 0) {
|
||||
this.isOn = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
|
||||
private void sendFluid() {
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir().getOpposite());
|
||||
}
|
||||
}
|
||||
|
||||
private DirPos[] getConPos() {
|
||||
return new DirPos[] {
|
||||
new DirPos(xCoord + 2, yCoord, zCoord, Library.POS_X),
|
||||
new DirPos(xCoord - 2, yCoord, zCoord, Library.NEG_X),
|
||||
new DirPos(xCoord, yCoord, zCoord + 2, Library.POS_Z),
|
||||
new DirPos(xCoord, yCoord, zCoord - 2, Library.NEG_Z),
|
||||
new DirPos(xCoord, yCoord + 5, zCoord, Library.POS_Y),
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
tanks[0].readFromNBT(nbt, "water");
|
||||
tanks[1].readFromNBT(nbt, "steam");
|
||||
heat = nbt.getInteger("heat");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
tanks[0].writeToNBT(nbt, "water");
|
||||
tanks[1].writeToNBT(nbt, "steam");
|
||||
nbt.setInteger("heat", heat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return tanks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getSendingTanks() {
|
||||
return new FluidTank[] {tanks[1]};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] {tanks[0]};
|
||||
}
|
||||
|
||||
AxisAlignedBB bb = null;
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
|
||||
if(bb == null) {
|
||||
bb = AxisAlignedBB.getBoundingBox(
|
||||
xCoord - 1,
|
||||
yCoord,
|
||||
zCoord - 1,
|
||||
xCoord + 2,
|
||||
yCoord + 5,
|
||||
zCoord + 2
|
||||
);
|
||||
}
|
||||
|
||||
return bb;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getConfigName() {
|
||||
return "boilerIndustrial";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readIfPresent(JsonObject obj) {
|
||||
maxHeat = IConfigurableMachine.grab(obj, "I:maxHeat", maxHeat);
|
||||
diffusion = IConfigurableMachine.grab(obj, "D:diffusion", diffusion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeConfig(JsonWriter writer) throws IOException {
|
||||
writer.name("I:maxHeat").value(maxHeat);
|
||||
writer.name("D:diffusion").value(diffusion);
|
||||
}
|
||||
}
|
||||
2900
src/main/resources/assets/hbm/models/machines/industrial_boiler.obj
Normal file
2900
src/main/resources/assets/hbm/models/machines/industrial_boiler.obj
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
Loading…
x
Reference in New Issue
Block a user