finished heat exchanger, fixed remaining fluid API mistakes, mug

This commit is contained in:
Bob 2022-12-03 18:01:57 +01:00
parent 49ac34ddba
commit c38323ff5e
23 changed files with 20333 additions and 4557 deletions

View File

@ -1,18 +1,24 @@
package com.hbm.blocks.machine;
import java.util.ArrayList;
import java.util.List;
import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ILookOverlay;
import com.hbm.blocks.ITooltipProvider;
import com.hbm.tileentity.TileEntityProxyCombo;
import com.hbm.tileentity.machine.TileEntityHeaterHeatex;
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.world.World;
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
import net.minecraftforge.common.util.ForgeDirection;
public class HeaterHeatex extends BlockDummyable implements ITooltipProvider {
public class HeaterHeatex extends BlockDummyable implements ILookOverlay, ITooltipProvider {
public HeaterHeatex() {
super(Material.iron);
@ -21,8 +27,8 @@ public class HeaterHeatex extends BlockDummyable implements ITooltipProvider {
@Override
public TileEntity createNewTileEntity(World world, int meta) {
if(meta >= 12)
return new TileEntityHeaterHeatex();
if(meta >= 12) return new TileEntityHeaterHeatex();
if(hasExtra(meta)) return new TileEntityProxyCombo().fluid();
return null;
}
@ -41,6 +47,39 @@ public class HeaterHeatex extends BlockDummyable implements ITooltipProvider {
return this.standardOpenBehavior(world, x, y, z, player, 0);
}
@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 TileEntityHeaterHeatex))
return;
TileEntityHeaterHeatex heater = (TileEntityHeaterHeatex) te;
List<String> text = new ArrayList();
text.add(String.format("%,d", heater.heatEnergy) + " TU");
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
}
@Override
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
super.fillSpace(world, x, y, z, dir, o);
x += dir.offsetX * o;
z += dir.offsetZ * o;
this.makeExtra(world, x + 1, y, z + 1);
this.makeExtra(world, x + 1, y, z - 1);
this.makeExtra(world, x - 1, y, z + 1);
this.makeExtra(world, x - 1, y, z - 1);
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
this.addStandardInfo(stack, player, list, ext);

View File

@ -1,15 +1,11 @@
package com.hbm.blocks.machine.pile;
import java.util.ArrayList;
import com.hbm.blocks.ModBlocks;
import com.hbm.items.ModItems;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.machine.pile.TileEntityPileBreedingFuel;
import com.hbm.tileentity.machine.pile.TileEntityPileFuel;
import api.hbm.block.IToolable;
import api.hbm.block.IToolable.ToolType;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;

View File

@ -1,19 +1,13 @@
package com.hbm.blocks.machine.pile;
import com.hbm.blocks.ModBlocks;
import com.hbm.items.ModItems;
import com.hbm.lib.RefStrings;
import api.hbm.block.IToolable;
import api.hbm.block.IToolable.ToolType;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class BlockGraphiteBreedingProduct extends BlockGraphiteDrilledBase implements IToolable {

View File

@ -4,7 +4,6 @@ import com.hbm.blocks.ModBlocks;
import com.hbm.items.ModItems;
import api.hbm.block.IToolable;
import api.hbm.block.IToolable.ToolType;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;

View File

@ -9,7 +9,6 @@ import com.hbm.items.ModItems;
import com.hbm.lib.RefStrings;
import api.hbm.block.IToolable;
import api.hbm.block.IToolable.ToolType;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;

View File

@ -1,14 +1,10 @@
package com.hbm.blocks.machine.pile;
import java.util.List;
import com.hbm.blocks.ModBlocks;
import com.hbm.items.ModItems;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.machine.pile.TileEntityPileFuel;
import com.hbm.tileentity.machine.pile.TileEntityPileNeutronDetector;
import api.hbm.block.IToolable.ToolType;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;

View File

@ -11,7 +11,6 @@ import com.hbm.tileentity.machine.rbmk.RBMKDials;
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKBase;
import api.hbm.block.IToolable;
import api.hbm.block.IToolable.ToolType;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import cpw.mods.fml.relauncher.Side;

View File

@ -1,29 +1,13 @@
package com.hbm.blocks.machine.rbmk;
import java.util.ArrayList;
import java.util.List;
import com.hbm.blocks.ILookOverlay;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.items.machine.IItemFluidIdentifier;
import com.hbm.tileentity.machine.rbmk.TileEntityHeatex;
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKHeater;
import com.hbm.util.I18nUtil;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
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;
public class RBMKHeatex extends BlockContainer implements ILookOverlay {
public class RBMKHeatex extends BlockContainer {
public RBMKHeatex(Material mat) {
super(mat);
@ -33,54 +17,4 @@ public class RBMKHeatex extends BlockContainer implements ILookOverlay {
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityHeatex();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float fX, float fY, float fZ) {
if(world.isRemote)
return true;
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IItemFluidIdentifier) {
IItemFluidIdentifier id = (IItemFluidIdentifier) player.getHeldItem().getItem();
FluidType type = id.getType(world, x, y, z, player.getHeldItem());
FluidType convert = TileEntityRBMKHeater.getConversion(type);
if(!player.isSneaking() && convert != Fluids.NONE) {
TileEntity te = world.getTileEntity(x, y, z);
if(te instanceof TileEntityHeatex) {
TileEntityHeatex heatex = (TileEntityHeatex) te;
heatex.coolantIn.setTankType(convert);
heatex.coolantOut.setTankType(type);
heatex.markDirty();
player.addChatComponentMessage(new ChatComponentText("Changed type to ").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.YELLOW)).appendSibling(new ChatComponentTranslation("hbmfluid." + type.getName().toLowerCase())).appendSibling(new ChatComponentText("!")));
}
}
}
return false;
}
@Override
public void printHook(Pre event, World world, int x, int y, int z) {
TileEntity te = world.getTileEntity(x, y, z);
if(!(te instanceof TileEntityHeatex))
return;
TileEntityHeatex extractor = (TileEntityHeatex) te;
List<String> text = new ArrayList();
addLine(text, extractor.coolantIn, true);
addLine(text, extractor.waterIn, true);
addLine(text, extractor.coolantOut, false);
addLine(text, extractor.waterOut, false);
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
}
private void addLine(List<String> text, FluidTank tank, boolean in) {
text.add((in ? (EnumChatFormatting.GREEN + "-> ") : (EnumChatFormatting.RED + "<- ")) + EnumChatFormatting.RESET + I18nUtil.resolveKey("hbmfluid." + tank.getTankType().getName().toLowerCase()) + ": " + tank.getFill() + "/" + tank.getMaxFill() + "mB");
}
}

View File

@ -15,7 +15,7 @@ public class ContainerHeaterHeatex extends Container {
public ContainerHeaterHeatex(InventoryPlayer invPlayer, TileEntityHeaterHeatex tedf) {
heater = tedf;
this.addSlotToContainer(new Slot(tedf, 0, 71, 73));
this.addSlotToContainer(new Slot(tedf, 0, 80, 72));
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 9; j++) {

View File

@ -328,6 +328,12 @@ public class Fluids {
HOTOIL.addTraits(new FT_Coolable(OIL, 1, 1, 10).setEff(CoolingType.HEATEXCHANGER, 1.0D));
HOTCRACKOIL.addTraits(new FT_Coolable(CRACKOIL, 1, 1, 10).setEff(CoolingType.HEATEXCHANGER, 1.0D));
COOLANT.addTraits(new FT_Heatable().setEff(HeatingType.HEATEXCHANGER, 1.0D).addStep(300, 1, COOLANT_HOT, 1));
COOLANT_HOT.addTraits(new FT_Coolable(COOLANT, 1, 1, 300).setEff(CoolingType.HEATEXCHANGER, 1.0D));
MUG.addTraits(new FT_Heatable().setEff(HeatingType.HEATEXCHANGER, 1.0D).addStep(400, 1, MUG_HOT, 1));
MUG_HOT.addTraits(new FT_Coolable(MUG, 1, 1, 400).setEff(CoolingType.HEATEXCHANGER, 1.0D));
if(idMapping.size() != metaOrder.size()) {
throw new IllegalStateException("A severe error has occoured during NTM's fluid registering process! The MetaOrder and Mappings are inconsistent! Mapping size: " + idMapping.size()+ " / MetaOrder size: " + metaOrder.size());
}

View File

@ -1,16 +1,22 @@
package com.hbm.inventory.gui;
import java.util.Arrays;
import org.apache.commons.lang3.math.NumberUtils;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.container.ContainerHeaterHeatex;
import com.hbm.lib.RefStrings;
import com.hbm.packet.NBTControlPacket;
import com.hbm.packet.PacketDispatcher;
import com.hbm.tileentity.machine.TileEntityHeaterHeatex;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
public class GUIHeaterHeatex extends GuiInfoContainer {
@ -33,11 +39,11 @@ public class GUIHeaterHeatex extends GuiInfoContainer {
super.initGui();
Keyboard.enableRepeatEvents(true);
this.fieldCycles = new GuiTextField(this.fontRendererObj, guiLeft + 74, guiTop + 21, 28, 10);
this.fieldCycles = new GuiTextField(this.fontRendererObj, guiLeft + 74, guiTop + 31, 28, 10);
initText(this.fieldCycles);
this.fieldCycles.setText(String.valueOf(heater.amountToCool));
this.fieldDelay = new GuiTextField(this.fontRendererObj, guiLeft + 74, guiTop + 39, 28, 10);
this.fieldDelay = new GuiTextField(this.fontRendererObj, guiLeft + 74, guiTop + 49, 28, 10);
initText(this.fieldDelay);
this.fieldDelay.setText(String.valueOf(heater.tickDelay));
}
@ -50,11 +56,18 @@ public class GUIHeaterHeatex extends GuiInfoContainer {
}
@Override
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
public void drawScreen(int x, int y, float f) {
super.drawScreen(x, y, f);
heater.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 44, guiTop + 36, 16, 52);
heater.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 116, guiTop + 36, 16, 52);
heater.tanks[0].renderTankInfo(this, x, y, guiLeft + 44, guiTop + 36, 16, 52);
heater.tanks[1].renderTankInfo(this, x, y, guiLeft + 116, guiTop + 36, 16, 52);
if(guiLeft + 70 <= x && guiLeft + 70 + 36 > x && guiTop + 26 < y && guiTop + 26 + 18 >= y) {
func_146283_a(Arrays.asList(new String[] { "Amount per cycle" }), x, y);
}
if(guiLeft + 70 <= x && guiLeft + 70 + 36 > x && guiTop + 44 < y && guiTop + 44 + 18 >= y) {
func_146283_a(Arrays.asList(new String[] { "Cycle tick delay" }), x, y);
}
}
@Override
@ -72,13 +85,36 @@ public class GUIHeaterHeatex extends GuiInfoContainer {
heater.tanks[0].renderTank(guiLeft + 44, guiTop + 88, this.zLevel, 16, 52);
heater.tanks[1].renderTank(guiLeft + 116, guiTop + 88, this.zLevel, 16, 52);
this.fieldCycles.drawTextBox();
this.fieldDelay.drawTextBox();
}
@Override
protected void mouseClicked(int x, int y, int i) {
super.mouseClicked(x, y, i);
this.fieldCycles.mouseClicked(x, y, i);
this.fieldDelay.mouseClicked(x, y, i);
}
@Override
protected void keyTyped(char c, int i) {
if(this.fieldCycles.textboxKeyTyped(c, i)) return;
if(this.fieldDelay.textboxKeyTyped(c, i)) return;
if(this.fieldCycles.textboxKeyTyped(c, i)) {
int cyc = Math.max(NumberUtils.toInt(this.fieldCycles.getText()), 1);
NBTTagCompound data = new NBTTagCompound();
data.setInteger("toCool", cyc);
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, heater.xCoord, heater.yCoord, heater.zCoord));
return;
}
if(this.fieldDelay.textboxKeyTyped(c, i)) {
int delay = Math.max(NumberUtils.toInt(this.fieldDelay.getText()), 1);
NBTTagCompound data = new NBTTagCompound();
data.setInteger("delay", delay);
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, heater.xCoord, heater.yCoord, heater.zCoord));
return;
}
super.keyTyped(c, i);
}

View File

@ -25,6 +25,7 @@ public abstract class TileEntityMachineBase extends TileEntityLoadedBase impleme
slots = new ItemStack[scount];
}
/** The "chunks is modified, pls don't forget to save me" effect of markDirty, minus the block updates */
public void markChanged() {
this.worldObj.markTileEntityChunkModified(this.xCoord, this.yCoord, this.zCoord, this);
}

View File

@ -1,7 +1,9 @@
package com.hbm.tileentity.machine;
import com.hbm.blocks.BlockDummyable;
import com.hbm.interfaces.IControlReceiver;
import com.hbm.inventory.container.ContainerHeaterHeatex;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.fluid.trait.FT_Coolable;
@ -24,7 +26,7 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityHeaterHeatex extends TileEntityMachineBase implements IHeatSource, INBTPacketReceiver, IFluidStandardTransceiver, IGUIProvider {
public class TileEntityHeaterHeatex extends TileEntityMachineBase implements IHeatSource, INBTPacketReceiver, IFluidStandardTransceiver, IGUIProvider, IControlReceiver {
public FluidTank[] tanks;
public int amountToCool = 1;
@ -47,15 +49,24 @@ public class TileEntityHeaterHeatex extends TileEntityMachineBase implements IHe
public void updateEntity() {
if(!worldObj.isRemote) {
this.tanks[0].setType(0, slots);
this.setupTanks();
this.updateConnections();
this.heatEnergy *= 0.999;
NBTTagCompound data = new NBTTagCompound();
tanks[0].writeToNBT(data, "0");
this.tryConvert();
tanks[1].writeToNBT(data, "1");
data.setInteger("heat", heatEnergy);
data.setInteger("toCool", amountToCool);
data.setInteger("delay", tickDelay);
INBTPacketReceiver.networkPack(this, data, 25);
for(DirPos pos : getConPos()) {
if(this.tanks[1].getFill() > 0) this.sendFluid(tanks[1].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
}
}
}
@ -64,6 +75,8 @@ public class TileEntityHeaterHeatex extends TileEntityMachineBase implements IHe
tanks[0].readFromNBT(nbt, "0");
tanks[1].readFromNBT(nbt, "1");
this.heatEnergy = nbt.getInteger("heat");
this.amountToCool = nbt.getInteger("toCool");
this.tickDelay = nbt.getInteger("delay");
}
protected void setupTanks() {
@ -102,7 +115,7 @@ public class TileEntityHeaterHeatex extends TileEntityMachineBase implements IHe
int ops = Math.min(inputOps, Math.min(outputOps, opCap));
tanks[0].setFill(tanks[0].getFill() - trait.amountReq * ops);
tanks[1].setFill(tanks[1].getFill() + trait.amountProduced * ops);
this.heatEnergy += trait.heatEnergy * ops;
this.heatEnergy += trait.heatEnergy * ops * trait.getEfficiency(CoolingType.HEATEXCHANGER);
this.markChanged();
}
@ -117,6 +130,28 @@ public class TileEntityHeaterHeatex extends TileEntityMachineBase implements IHe
new DirPos(xCoord - dir.offsetX * 2 - rot.offsetX, yCoord, zCoord - dir.offsetZ * 2 - rot.offsetZ, dir.getOpposite())
};
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.tanks[0].readFromNBT(nbt, "0");
this.tanks[1].readFromNBT(nbt, "1");
this.heatEnergy = nbt.getInteger("heatEnergy");
this.amountToCool = nbt.getInteger("toCool");
this.tickDelay = nbt.getInteger("delay");
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
this.tanks[0].writeToNBT(nbt, "0");
this.tanks[1].writeToNBT(nbt, "1");
nbt.setInteger("heatEnergy", heatEnergy);
nbt.setInteger("toCool", amountToCool);
nbt.setInteger("delay", tickDelay);
}
@Override
public int getHeatStored() {
@ -143,6 +178,12 @@ public class TileEntityHeaterHeatex extends TileEntityMachineBase implements IHe
return new FluidTank[] {tanks[0]};
}
@Override
public boolean canConnect(FluidType type, ForgeDirection dir) {
ForgeDirection facing = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
return dir == facing || dir == facing.getOpposite();
}
@Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new ContainerHeaterHeatex(player.inventory, this);
@ -178,4 +219,17 @@ public class TileEntityHeaterHeatex extends TileEntityMachineBase implements IHe
public double getMaxRenderDistanceSquared() {
return 65536.0D;
}
@Override
public boolean hasPermission(EntityPlayer player) {
return player.getDistance(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 16;
}
@Override
public void receiveControl(NBTTagCompound data) {
if(data.hasKey("toCool")) this.amountToCool = Math.max(data.getInteger("toCool"), 1);
if(data.hasKey("delay")) this.tickDelay = Math.max(data.getInteger("delay"), 1);
this.markChanged();
}
}

View File

@ -3,6 +3,7 @@ package com.hbm.tileentity.machine;
import java.util.ArrayList;
import java.util.List;
import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.machine.MachineITER;
import com.hbm.explosion.ExplosionLarge;
@ -23,6 +24,7 @@ import com.hbm.main.MainRegistry;
import com.hbm.packet.AuxParticlePacketNT;
import com.hbm.packet.PacketDispatcher;
import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.util.fauxpointtwelve.DirPos;
import api.hbm.energy.IEnergyUser;
import api.hbm.fluid.IFluidStandardTransceiver;
@ -147,6 +149,12 @@ public class TileEntityITER extends TileEntityMachineBase implements IEnergyUser
tanks[i].updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
plasma.updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
for(DirPos pos : getConPos()) {
if(tanks[1].getFill() > 0) {
this.sendFluid(tanks[1].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
}
}
NBTTagCompound data = new NBTTagCompound();
data.setBoolean("isOn", isOn);
data.setLong("power", power);
@ -183,18 +191,34 @@ public class TileEntityITER extends TileEntityMachineBase implements IEnergyUser
}
}
protected List<DirPos> connections;
private void updateConnections() {
for(DirPos pos : getConPos()) {
this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
}
}
protected List<DirPos> getConPos() {
if(connections != null && !connections.isEmpty())
return connections;
connections = new ArrayList();
this.trySubscribe(worldObj, xCoord, yCoord + 3, zCoord, ForgeDirection.UP);
this.trySubscribe(worldObj, xCoord, yCoord - 3, zCoord, ForgeDirection.DOWN);
connections.add(new DirPos(xCoord, yCoord + 3, zCoord, ForgeDirection.UP));
connections.add(new DirPos(xCoord, yCoord - 3, zCoord, ForgeDirection.DOWN));
Vec3 vec = Vec3.createVectorHelper(5.75, 0, 0);
for(int i = 0; i < 16; i++) {
vec.rotateAroundY((float) (Math.PI / 8));
this.trySubscribe(worldObj, xCoord + (int)vec.xCoord, yCoord + 3, zCoord + (int)vec.zCoord, ForgeDirection.UP);
this.trySubscribe(worldObj, xCoord + (int)vec.xCoord, yCoord - 3, zCoord + (int)vec.zCoord, ForgeDirection.DOWN);
connections.add(new DirPos(xCoord + (int)vec.xCoord, yCoord + 3, zCoord + (int)vec.zCoord, ForgeDirection.UP));
connections.add(new DirPos(xCoord + (int)vec.xCoord, yCoord - 3, zCoord + (int)vec.zCoord, ForgeDirection.DOWN));
}
return connections;
}
private void explode() {
@ -548,4 +572,14 @@ public class TileEntityITER extends TileEntityMachineBase implements IEnergyUser
public FluidTank[] getAllTanks() {
return tanks;
}
@Override
public boolean canConnect(ForgeDirection dir) {
return dir == ForgeDirection.UP || dir == ForgeDirection.DOWN;
}
@Override
public boolean canConnect(FluidType type, ForgeDirection dir) {
return dir == ForgeDirection.UP || dir == ForgeDirection.DOWN;
}
}

View File

@ -72,7 +72,7 @@ public class TileEntityStirling extends TileEntityLoadedBase implements INBTPack
ForgeDirection rot = dir.getRotation(ForgeDirection.DOWN);
cog.motionX = rot.offsetX;
cog.motionY = 1;
cog.motionY = 1 + (heat - maxHeat()) * 0.0001D;
cog.motionZ = rot.offsetZ;
worldObj.spawnEntityInWorld(cog);

View File

@ -132,6 +132,14 @@ public class TileEntityMachineRefinery extends TileEntityMachineBase implements
tanks[i].updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
}
for(DirPos pos : getConPos()) {
for(int i = 1; i < 5; i++) {
if(tanks[i].getFill() > 0) {
this.sendFluid(tanks[i].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
}
}
}
NBTTagCompound data = new NBTTagCompound();
data.setLong("power", this.power);
this.networkPack(data, 50);

View File

@ -106,6 +106,11 @@ public abstract class TileEntityOilDrillBase extends TileEntityMachineBase imple
if(this.worldObj.getTotalWorldTime() % 10 == 5)
this.fillFluidInit(tanks[1].getTankType());
for(DirPos pos : getConPos()) {
if(tanks[0].getFill() > 0) this.sendFluid(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
if(tanks[1].getFill() > 0) this.sendFluid(tanks[1].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
}
if(this.power >= this.getPowerReqEff() && this.tanks[0].getFill() < this.tanks[0].getMaxFill() && this.tanks[1].getFill() < this.tanks[1].getMaxFill()) {
this.power -= this.getPowerReqEff();

View File

@ -11,6 +11,9 @@ import com.hbm.interfaces.IFluidSource;
import com.hbm.inventory.fluid.FluidType;
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.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;
import com.hbm.util.fauxpointtwelve.DirPos;
@ -40,23 +43,30 @@ public class TileEntityRBMKHeater extends TileEntityRBMKSlottedBase implements I
if(!worldObj.isRemote) {
feed.setType(0, slots);
steam.setTankType(getConversion(feed.getTankType()));
feed.updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
steam.updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
double heatCap = this.getConversionHeat(feed.getTankType());
double heatProvided = this.heat - heatCap;
if(heatProvided > 0 && steam.getTankType() != Fluids.NONE) {
if(feed.getTankType().hasTrait(FT_Heatable.class)) {
FT_Heatable trait = feed.getTankType().getTrait(FT_Heatable.class);
HeatingStep step = trait.getFirstStep();
steam.setTankType(step.typeProduced);
double tempRange = this.heat - steam.getTankType().temperature;
double capacity = feed.getTankType().heatCap;
int converted = (int)Math.floor(heatProvided / capacity);
converted = Math.min(converted, feed.getFill());
converted = Math.min(converted, steam.getMaxFill() - steam.getFill());
feed.setFill(feed.getFill() - converted);
steam.setFill(steam.getFill() + converted);
this.heat -= converted * capacity;
if(tempRange > 0) {
double TU_PER_DEGREE = 2_000D; //based on 1mB of water absorbing 200 TU as well as 0.1°C from an RBMK column
int inputOps = feed.getFill() / step.amountReq;
int outputOps = (steam.getMaxFill() - steam.getFill()) / step.amountProduced;
int tempOps = (int) Math.floor((tempRange * TU_PER_DEGREE) / step.heatReq);
int ops = Math.min(inputOps, Math.min(outputOps, tempOps));
feed.setFill(feed.getFill() - step.amountReq * ops);
steam.setFill(steam.getFill() + step.amountProduced * ops);
this.heat -= (step.heatReq * ops / TU_PER_DEGREE) * trait.getEfficiency(HeatingType.HEATEXCHANGER);
}
} else {
steam.setTankType(Fluids.NONE);
}
fillFluidInit(steam.getTankType());
@ -96,16 +106,6 @@ public class TileEntityRBMKHeater extends TileEntityRBMKSlottedBase implements I
};
}
}
public static double getConversionHeat(FluidType type) {
return getConversion(type).temperature;
}
public static FluidType getConversion(FluidType type) {
if(type == Fluids.MUG) return Fluids.MUG_HOT;
if(type == Fluids.COOLANT) return Fluids.COOLANT_HOT;
return Fluids.NONE;
}
@Override
public void fillFluidInit(FluidType type) {

View File

@ -3594,6 +3594,8 @@ tile.heater_electric.name=Elektrische Heizung
tile.heater_electric.desc=Erzeugt Wärme aus Strom.$Nimmt von unten Wärme mit 85%% Effizienz auf.$Kann mit einem Schraubenzeiher konfiguriert werden.
tile.heater_firebox.name=Feuerbüchse
tile.heater_firebox.desc=Erzeugt Wärme aus Festbrennstoff.
tile.heater_heatex.name=Wärmetauschender Heizer
tile.heater_heatex.desc=Erzeugt Wärme aus heißen Flüssigkeiten.
tile.heater_oilburner.name=Brenner
tile.heater_oilburner.desc=Erzäuft Wärme aus fluiden Brennstoffen.
tile.heater_oven.name=Heizofen

View File

@ -4122,6 +4122,8 @@ tile.heater_electric.name=Electric Heater
tile.heater_electric.desc=Uses energy to produce heat.$Accepts heat from the bottom with 85%% efficiency.$Can be configured with a screwdriver.
tile.heater_firebox.name=Firebox
tile.heater_firebox.desc=Burns solid fuel to produce heat.
tile.heater_heatex.name=Heat Exchanging Heater
tile.heater_heatex.desc=Produces heat from hot fluids.
tile.heater_oilburner.name=Fluid Burner
tile.heater_oilburner.desc=Burns fluids to produce heat.
tile.heater_oven.name=Heating Oven

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB