mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
ported even more machines to the new fluid system, flare stack upgrades
This commit is contained in:
parent
8958f163d2
commit
0bbacd5f25
@ -35,8 +35,8 @@ public class GUIMachineGasFlare extends GuiInfoContainer {
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 79, guiTop + 20, 35, 10, mouseX, mouseY, I18nUtil.resolveKeyArray("flare.valve"));
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 79, guiTop + 54, 35, 14, mouseX, mouseY, I18nUtil.resolveKeyArray("flare.ignition"));
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 79, guiTop + 16, 35, 10, mouseX, mouseY, I18nUtil.resolveKeyArray("flare.valve"));
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 79, guiTop + 50, 35, 14, mouseX, mouseY, I18nUtil.resolveKeyArray("flare.ignition"));
|
||||
|
||||
flare.tank.renderTankInfo(this, mouseX, mouseY, guiLeft + 35, guiTop + 69 - 52, 16, 52);
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 143, guiTop + 69 - 52, 16, 52, flare.power, flare.maxPower);
|
||||
@ -45,13 +45,13 @@ public class GUIMachineGasFlare extends GuiInfoContainer {
|
||||
protected void mouseClicked(int x, int y, int i) {
|
||||
super.mouseClicked(x, y, i);
|
||||
|
||||
if(guiLeft + 89 <= x && guiLeft + 89 + 16 > x && guiTop + 20 < y && guiTop + 20 + 10 >= y) {
|
||||
if(guiLeft + 89 <= x && guiLeft + 89 + 16 > x && guiTop + 16 < y && guiTop + 16 + 10 >= y) {
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setBoolean("valve", true);
|
||||
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, flare.xCoord, flare.yCoord, flare.zCoord));
|
||||
|
||||
} else if(guiLeft + 89 <= x && guiLeft + 89 + 16 > x && guiTop + 54 < y && guiTop + 54 + 14 >= y) {
|
||||
} else if(guiLeft + 89 <= x && guiLeft + 89 + 16 > x && guiTop + 50 < y && guiTop + 50 + 14 >= y) {
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setBoolean("dial", true);
|
||||
@ -77,11 +77,11 @@ public class GUIMachineGasFlare extends GuiInfoContainer {
|
||||
int j = (int)flare.getPowerScaled(52);
|
||||
drawTexturedModalRect(guiLeft + 143, guiTop + 69 - j, 176, 94 - j, 16, j);
|
||||
|
||||
if(flare.isOn) drawTexturedModalRect(guiLeft + 79, guiTop + 20, 176, 0, 35, 10);
|
||||
if(flare.doesBurn) drawTexturedModalRect(guiLeft + 79, guiTop + 54, 176, 10, 35, 14);
|
||||
if(flare.isOn) drawTexturedModalRect(guiLeft + 79, guiTop + 16, 176, 0, 35, 10);
|
||||
if(flare.doesBurn) drawTexturedModalRect(guiLeft + 79, guiTop + 50, 176, 10, 35, 14);
|
||||
|
||||
if(flare.isOn && flare.doesBurn && flare.tank.getFill() > 0 && flare.tank.getTankType().traits.contains(FluidTrait.GASEOUS) && flare.tank.getTankType() instanceof FluidTypeFlammable)
|
||||
drawTexturedModalRect(guiLeft + 88, guiTop + 34, 176, 24, 18, 18);
|
||||
drawTexturedModalRect(guiLeft + 88, guiTop + 29, 176, 24, 18, 18);
|
||||
|
||||
flare.tank.renderTank(guiLeft + 35, guiTop + 69, this.zLevel, 16, 52);
|
||||
}
|
||||
|
||||
@ -7,6 +7,10 @@ import com.hbm.blocks.generic.BlockEmitter.TileEntityEmitter;
|
||||
import com.hbm.blocks.generic.BlockLoot.TileEntityLoot;
|
||||
import com.hbm.blocks.generic.BlockMotherOfAllOres.TileEntityRandomOre;
|
||||
import com.hbm.blocks.network.CableDiode.TileEntityDiode;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidContainer;
|
||||
import com.hbm.interfaces.IFluidSource;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.bomb.*;
|
||||
import com.hbm.tileentity.conductor.*;
|
||||
import com.hbm.tileentity.deco.*;
|
||||
@ -17,7 +21,9 @@ import com.hbm.tileentity.machine.rbmk.*;
|
||||
import com.hbm.tileentity.machine.storage.*;
|
||||
import com.hbm.tileentity.network.*;
|
||||
import com.hbm.tileentity.turret.*;
|
||||
import com.hbm.util.LoggingUtil;
|
||||
|
||||
import api.hbm.fluid.IFluidConnector;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileMappings {
|
||||
@ -312,5 +318,9 @@ public class TileMappings {
|
||||
|
||||
private static void put(Class<? extends TileEntity> clazz, String... names) {
|
||||
map.put(clazz, names);
|
||||
|
||||
if((IFluidSource.class.isAssignableFrom(clazz) || IFluidAcceptor.class.isAssignableFrom(clazz)) && !IFluidConnector.class.isAssignableFrom(clazz)) {
|
||||
LoggingUtil.errorWithHighlight(clazz.getCanonicalName() + " implements the old interfaces but not IFluidConnector!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.config.BombConfig;
|
||||
@ -22,8 +21,10 @@ import com.hbm.lib.Library;
|
||||
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;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -32,7 +33,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
public class TileEntityMachineCyclotron extends TileEntityMachineBase implements IFluidSource, IFluidAcceptor, IEnergyUser {
|
||||
public class TileEntityMachineCyclotron extends TileEntityMachineBase implements IFluidSource, IFluidAcceptor, IEnergyUser, IFluidStandardTransceiver {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 100000000;
|
||||
@ -142,6 +143,7 @@ public class TileEntityMachineCyclotron extends TileEntityMachineBase implements
|
||||
progress = 0;
|
||||
}
|
||||
|
||||
this.sendFluid();
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", power);
|
||||
@ -156,15 +158,29 @@ public class TileEntityMachineCyclotron extends TileEntityMachineBase implements
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
|
||||
this.trySubscribe(worldObj, xCoord + 3, yCoord, zCoord + 1, Library.POS_X);
|
||||
this.trySubscribe(worldObj, xCoord + 3, yCoord, zCoord - 1, Library.POS_X);
|
||||
this.trySubscribe(worldObj, xCoord - 3, yCoord, zCoord + 1, Library.NEG_X);
|
||||
this.trySubscribe(worldObj, xCoord - 3, yCoord, zCoord - 1, Library.NEG_X);
|
||||
this.trySubscribe(worldObj, xCoord + 1, yCoord, zCoord + 3, Library.POS_Z);
|
||||
this.trySubscribe(worldObj, xCoord - 1, yCoord, zCoord + 3, Library.POS_Z);
|
||||
this.trySubscribe(worldObj, xCoord + 1, yCoord, zCoord - 3, Library.NEG_Z);
|
||||
this.trySubscribe(worldObj, xCoord - 1, yCoord, zCoord - 3, Library.NEG_Z);
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
this.trySubscribe(coolant.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
|
||||
private void sendFluid() {
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.sendFluid(amat.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
|
||||
public DirPos[] getConPos() {
|
||||
return new DirPos[] {
|
||||
new DirPos(xCoord + 3, yCoord, zCoord + 1, Library.POS_X),
|
||||
new DirPos(xCoord + 3, yCoord, zCoord - 1, Library.POS_X),
|
||||
new DirPos(xCoord - 3, yCoord, zCoord + 1, Library.NEG_X),
|
||||
new DirPos(xCoord - 3, yCoord, zCoord - 1, Library.NEG_X),
|
||||
new DirPos(xCoord + 1, yCoord, zCoord + 3, Library.POS_Z),
|
||||
new DirPos(xCoord - 1, yCoord, zCoord + 3, Library.POS_Z),
|
||||
new DirPos(xCoord + 1, yCoord, zCoord - 3, Library.NEG_Z),
|
||||
new DirPos(xCoord - 1, yCoord, zCoord - 3, Library.NEG_Z)
|
||||
};
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
@ -510,4 +526,14 @@ public class TileEntityMachineCyclotron extends TileEntityMachineBase implements
|
||||
public long getMaxPower() {
|
||||
return this.maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getSendingTanks() {
|
||||
return new FluidTank[] { amat };
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] { coolant };
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@ import com.hbm.util.InventoryUtil;
|
||||
import api.hbm.block.IDrillInteraction;
|
||||
import api.hbm.block.IMiningDrill;
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.fluid.IFluidStandardSender;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
@ -41,7 +42,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineMiningLaser extends TileEntityMachineBase implements IEnergyUser, IFluidSource, IMiningDrill {
|
||||
public class TileEntityMachineMiningLaser extends TileEntityMachineBase implements IEnergyUser, IFluidSource, IMiningDrill, IFluidStandardSender {
|
||||
|
||||
public long power;
|
||||
public int age = 0;
|
||||
@ -89,6 +90,11 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen
|
||||
|
||||
if (age == 9 || age == 19)
|
||||
fillFluidInit(tank.getTankType());
|
||||
|
||||
this.sendFluid(tank.getTankType(), worldObj, xCoord + 2, yCoord, zCoord, Library.POS_X);
|
||||
this.sendFluid(tank.getTankType(), worldObj, xCoord - 2, yCoord, zCoord, Library.NEG_X);
|
||||
this.sendFluid(tank.getTankType(), worldObj, xCoord, yCoord + 2, zCoord, Library.POS_Z);
|
||||
this.sendFluid(tank.getTankType(), worldObj, xCoord, yCoord - 2, zCoord, Library.NEG_Z);
|
||||
|
||||
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
|
||||
tank.updateTank(xCoord, yCoord, zCoord, this.worldObj.provider.dimensionId);
|
||||
@ -680,4 +686,9 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen
|
||||
public int getDrillRating() {
|
||||
return 100;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getSendingTanks() {
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
@ -12,6 +11,7 @@ import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.lib.Library;
|
||||
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@ -19,7 +19,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
|
||||
public class TileEntitySolarBoiler extends TileEntity implements IFluidAcceptor, IFluidSource {
|
||||
public class TileEntitySolarBoiler extends TileEntity implements IFluidAcceptor, IFluidSource, IFluidStandardTransceiver {
|
||||
|
||||
private FluidTank water;
|
||||
private FluidTank steam;
|
||||
@ -40,8 +40,11 @@ public class TileEntitySolarBoiler extends TileEntity implements IFluidAcceptor,
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
//if(worldObj.getTotalWorldTime() % 5 == 0) {
|
||||
fillFluidInit(Fluids.STEAM);
|
||||
fillFluidInit(Fluids.STEAM);
|
||||
//}
|
||||
|
||||
this.trySubscribe(water.getTankType(), worldObj, xCoord, yCoord + 3, zCoord, Library.POS_Y);
|
||||
this.trySubscribe(water.getTankType(), worldObj, xCoord, yCoord - 1, zCoord, Library.NEG_Y);
|
||||
|
||||
int process = heat / 10;
|
||||
process = Math.min(process, water.getFill());
|
||||
@ -52,9 +55,9 @@ public class TileEntitySolarBoiler extends TileEntity implements IFluidAcceptor,
|
||||
|
||||
water.setFill(water.getFill() - process);
|
||||
steam.setFill(steam.getFill() + process * 100);
|
||||
|
||||
//if(steam.getFill() > steam.getMaxFill() * 0.9)
|
||||
// System.out.println("*" + steam.getFill());
|
||||
|
||||
this.sendFluid(steam.getTankType(), worldObj, xCoord, yCoord + 3, zCoord, Library.POS_Y);
|
||||
this.sendFluid(steam.getTankType(), worldObj, xCoord, yCoord - 1, zCoord, Library.NEG_Y);
|
||||
|
||||
heat = 0;
|
||||
} else {
|
||||
@ -176,4 +179,14 @@ public class TileEntitySolarBoiler extends TileEntity implements IFluidAcceptor,
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getSendingTanks() {
|
||||
return new FluidTank[] { steam };
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] { water };
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,6 +20,7 @@ import com.hbm.util.ContaminationUtil;
|
||||
import com.hbm.util.ContaminationUtil.ContaminationType;
|
||||
import com.hbm.util.ContaminationUtil.HazardType;
|
||||
|
||||
import api.hbm.fluid.IFluidStandardSender;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -28,7 +29,7 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityStorageDrum extends TileEntityMachineBase implements IFluidSource {
|
||||
public class TileEntityStorageDrum extends TileEntityMachineBase implements IFluidSource, IFluidStandardSender {
|
||||
|
||||
public FluidTank[] tanks;
|
||||
private static final int[] slots_arr = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 };
|
||||
@ -139,6 +140,9 @@ public class TileEntityStorageDrum extends TileEntityMachineBase implements IFlu
|
||||
fillFluidInit(tanks[1].getTankType());
|
||||
}
|
||||
|
||||
this.sendFluidToAll(tanks[0].getTankType(), this);
|
||||
this.sendFluidToAll(tanks[1].getTankType(), this);
|
||||
|
||||
tanks[0].updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
|
||||
tanks[1].updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
|
||||
|
||||
@ -308,4 +312,9 @@ public class TileEntityStorageDrum extends TileEntityMachineBase implements IFlu
|
||||
this.tanks[0].writeToNBT(nbt, "liquid");
|
||||
this.tanks[1].writeToNBT(nbt, "gas");
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getSendingTanks() {
|
||||
return new FluidTank[] { tanks[0], tanks[1] };
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,7 +13,9 @@ import com.hbm.inventory.recipes.RefineryRecipes;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.util.Tuple.Pair;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@ -21,7 +23,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineFractionTower extends TileEntity implements IFluidSource, IFluidAcceptor, INBTPacketReceiver {
|
||||
public class TileEntityMachineFractionTower extends TileEntity implements IFluidSource, IFluidAcceptor, INBTPacketReceiver, IFluidStandardTransceiver {
|
||||
|
||||
public FluidTank[] tanks;
|
||||
public List<IFluidAcceptor> list1 = new ArrayList();
|
||||
@ -41,7 +43,6 @@ public class TileEntityMachineFractionTower extends TileEntity implements IFluid
|
||||
|
||||
TileEntity stack = worldObj.getTileEntity(xCoord, yCoord + 3, zCoord);
|
||||
|
||||
|
||||
if(stack instanceof TileEntityMachineFractionTower) {
|
||||
TileEntityMachineFractionTower frac = (TileEntityMachineFractionTower) stack;
|
||||
|
||||
@ -65,6 +66,7 @@ public class TileEntityMachineFractionTower extends TileEntity implements IFluid
|
||||
}
|
||||
|
||||
setupTanks();
|
||||
this.updateConnections();
|
||||
|
||||
if(worldObj.getTotalWorldTime() % 20 == 0)
|
||||
fractionate();
|
||||
@ -72,14 +74,16 @@ public class TileEntityMachineFractionTower extends TileEntity implements IFluid
|
||||
if(worldObj.getTotalWorldTime() % 10 == 0) {
|
||||
fillFluidInit(tanks[1].getTankType());
|
||||
fillFluidInit(tanks[2].getTankType());
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
|
||||
for(int i = 0; i < 3; i++)
|
||||
tanks[i].writeToNBT(data, "tank" + i);
|
||||
|
||||
INBTPacketReceiver.networkPack(this, data, 50);
|
||||
}
|
||||
|
||||
this.sendFluid();
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
|
||||
for(int i = 0; i < 3; i++)
|
||||
tanks[i].writeToNBT(data, "tank" + i);
|
||||
|
||||
INBTPacketReceiver.networkPack(this, data, 50);
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,6 +93,30 @@ public class TileEntityMachineFractionTower extends TileEntity implements IFluid
|
||||
tanks[i].readFromNBT(nbt, "tank" + i);
|
||||
}
|
||||
|
||||
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].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
this.sendFluid(tanks[2].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
};
|
||||
}
|
||||
|
||||
private void setupTanks() {
|
||||
|
||||
Pair<FluidStack, FluidStack> quart = RefineryRecipes.getFractions(tanks[0].getTankType());
|
||||
@ -234,4 +262,14 @@ public class TileEntityMachineFractionTower extends TileEntity implements IFluid
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getSendingTanks() {
|
||||
return new FluidTank[] { tanks[1], tanks[2] };
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] { tanks[0] };
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,15 +14,17 @@ import com.hbm.inventory.recipes.LiquefactionRecipes;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.fluid.IFluidStandardSender;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
public class TileEntityMachineLiquefactor extends TileEntityMachineBase implements IEnergyUser, IFluidSource {
|
||||
public class TileEntityMachineLiquefactor extends TileEntityMachineBase implements IEnergyUser, IFluidSource, IFluidStandardSender {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 100000;
|
||||
@ -50,13 +52,8 @@ public class TileEntityMachineLiquefactor extends TileEntityMachineBase implemen
|
||||
if(!worldObj.isRemote) {
|
||||
this.power = Library.chargeTEFromItems(slots, 1, power, maxPower);
|
||||
tank.updateTank(this);
|
||||
|
||||
this.trySubscribe(worldObj, xCoord, yCoord + 4, zCoord, Library.POS_Y);
|
||||
this.trySubscribe(worldObj, xCoord, yCoord - 1, zCoord, Library.NEG_Y);
|
||||
this.trySubscribe(worldObj, xCoord + 2, yCoord + 1, zCoord, Library.POS_X);
|
||||
this.trySubscribe(worldObj, xCoord - 2, yCoord + 1, zCoord, Library.NEG_X);
|
||||
this.trySubscribe(worldObj, xCoord, yCoord + 1, zCoord + 2, Library.POS_Z);
|
||||
this.trySubscribe(worldObj, xCoord, yCoord + 1, zCoord - 2, Library.NEG_Z);
|
||||
|
||||
this.updateConnections();
|
||||
|
||||
UpgradeManager.eval(slots, 2, 3);
|
||||
int speed = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3);
|
||||
@ -74,6 +71,8 @@ public class TileEntityMachineLiquefactor extends TileEntityMachineBase implemen
|
||||
this.fillFluidInit(tank.getTankType());
|
||||
}
|
||||
|
||||
this.sendFluid();
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", this.power);
|
||||
data.setInteger("progress", this.progress);
|
||||
@ -82,6 +81,29 @@ public class TileEntityMachineLiquefactor extends TileEntityMachineBase implemen
|
||||
this.networkPack(data, 50);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
|
||||
private void sendFluid() {
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.sendFluid(tank.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
|
||||
private DirPos[] getConPos() {
|
||||
return new DirPos[] {
|
||||
new DirPos(xCoord, yCoord + 4, zCoord, Library.POS_Y),
|
||||
new DirPos(xCoord, yCoord - 1, zCoord, Library.NEG_Y),
|
||||
new DirPos(xCoord + 2, yCoord + 1, zCoord, Library.POS_X),
|
||||
new DirPos(xCoord - 2, yCoord + 1, zCoord, Library.NEG_X),
|
||||
new DirPos(xCoord, yCoord + 1, zCoord + 2, Library.POS_Z),
|
||||
new DirPos(xCoord, yCoord + 1, zCoord - 2, Library.NEG_Z)
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
|
||||
@ -246,4 +268,9 @@ public class TileEntityMachineLiquefactor extends TileEntityMachineBase implemen
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getSendingTanks() {
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,8 +15,10 @@ import com.hbm.inventory.recipes.RefineryRecipes;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.Tuple.Quintet;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -26,7 +28,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
public class TileEntityMachineRefinery extends TileEntityMachineBase implements IEnergyUser, IFluidContainer, IFluidAcceptor, IFluidSource, IControlReceiver {
|
||||
public class TileEntityMachineRefinery extends TileEntityMachineBase implements IEnergyUser, IFluidContainer, IFluidAcceptor, IFluidSource, IControlReceiver, IFluidStandardTransceiver {
|
||||
|
||||
public long power = 0;
|
||||
public int sulfur = 0;
|
||||
@ -192,14 +194,23 @@ public class TileEntityMachineRefinery extends TileEntityMachineBase implements
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
this.trySubscribe(worldObj, xCoord + 2, yCoord, zCoord + 1, Library.POS_X);
|
||||
this.trySubscribe(worldObj, xCoord + 2, yCoord, zCoord - 1, Library.POS_X);
|
||||
this.trySubscribe(worldObj, xCoord - 2, yCoord, zCoord + 1, Library.NEG_X);
|
||||
this.trySubscribe(worldObj, xCoord - 2, yCoord, zCoord - 1, Library.NEG_X);
|
||||
this.trySubscribe(worldObj, xCoord + 1, yCoord, zCoord + 2, Library.POS_Z);
|
||||
this.trySubscribe(worldObj, xCoord - 1, yCoord, zCoord + 2, Library.POS_Z);
|
||||
this.trySubscribe(worldObj, xCoord + 1, yCoord, zCoord - 2, Library.NEG_Z);
|
||||
this.trySubscribe(worldObj, xCoord - 1, yCoord, zCoord - 2, Library.NEG_Z);
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
public DirPos[] getConPos() {
|
||||
return new DirPos[] {
|
||||
new DirPos(xCoord + 2, yCoord, zCoord + 1, Library.POS_X),
|
||||
new DirPos(xCoord + 2, yCoord, zCoord - 1, Library.POS_X),
|
||||
new DirPos(xCoord - 2, yCoord, zCoord + 1, Library.NEG_X),
|
||||
new DirPos(xCoord - 2, yCoord, zCoord - 1, Library.NEG_X),
|
||||
new DirPos(xCoord + 1, yCoord, zCoord + 2, Library.POS_Z),
|
||||
new DirPos(xCoord - 1, yCoord, zCoord + 2, Library.POS_Z),
|
||||
new DirPos(xCoord + 1, yCoord, zCoord - 2, Library.NEG_Z),
|
||||
new DirPos(xCoord - 1, yCoord, zCoord - 2, Library.NEG_Z)
|
||||
};
|
||||
}
|
||||
|
||||
public long getPowerScaled(long i) {
|
||||
@ -326,6 +337,10 @@ public class TileEntityMachineRefinery extends TileEntityMachineBase implements
|
||||
|
||||
if(data.hasKey("toggle")) {
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.tryUnsubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
if(tanks[0].getTankType() == Fluids.HOTOIL) {
|
||||
tanks[0].setTankType(Fluids.HOTCRACKOIL);
|
||||
} else {
|
||||
@ -333,4 +348,14 @@ public class TileEntityMachineRefinery extends TileEntityMachineBase implements
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getSendingTanks() {
|
||||
return new FluidTank[] { tanks[1], tanks[2], tanks[3], tanks[4] };
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] { tanks[0] };
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,5 @@
|
||||
package com.hbm.tileentity.machine.oil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.inventory.UpgradeManager;
|
||||
@ -13,15 +10,17 @@ import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.Tuple.Pair;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.fluid.IFluidStandardReceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
public class TileEntityMachineSolidifier extends TileEntityMachineBase implements IEnergyUser, IFluidAcceptor {
|
||||
public class TileEntityMachineSolidifier extends TileEntityMachineBase implements IEnergyUser, IFluidAcceptor, IFluidStandardReceiver {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 100000;
|
||||
@ -51,12 +50,7 @@ public class TileEntityMachineSolidifier extends TileEntityMachineBase implement
|
||||
tank.setType(4, slots);
|
||||
tank.updateTank(this);
|
||||
|
||||
this.trySubscribe(worldObj, xCoord, yCoord + 4, zCoord, Library.POS_Y);
|
||||
this.trySubscribe(worldObj, xCoord, yCoord - 1, zCoord, Library.NEG_Y);
|
||||
this.trySubscribe(worldObj, xCoord + 2, yCoord + 1, zCoord, Library.POS_X);
|
||||
this.trySubscribe(worldObj, xCoord - 2, yCoord + 1, zCoord, Library.NEG_X);
|
||||
this.trySubscribe(worldObj, xCoord, yCoord + 1, zCoord + 2, Library.POS_Z);
|
||||
this.trySubscribe(worldObj, xCoord, yCoord + 1, zCoord - 2, Library.NEG_Z);
|
||||
this.updateConnections();
|
||||
|
||||
UpgradeManager.eval(slots, 2, 3);
|
||||
int speed = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3);
|
||||
@ -78,6 +72,24 @@ public class TileEntityMachineSolidifier extends TileEntityMachineBase implement
|
||||
this.networkPack(data, 50);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
this.trySubscribe(tank.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
|
||||
private DirPos[] getConPos() {
|
||||
return new DirPos[] {
|
||||
new DirPos(xCoord, yCoord + 4, zCoord, Library.POS_Y),
|
||||
new DirPos(xCoord, yCoord - 1, zCoord, Library.NEG_Y),
|
||||
new DirPos(xCoord + 2, yCoord + 1, zCoord, Library.POS_X),
|
||||
new DirPos(xCoord - 2, yCoord + 1, zCoord, Library.NEG_X),
|
||||
new DirPos(xCoord, yCoord + 1, zCoord + 2, Library.POS_Z),
|
||||
new DirPos(xCoord, yCoord + 1, zCoord - 2, Library.NEG_Z)
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side) {
|
||||
@ -230,4 +242,9 @@ public class TileEntityMachineSolidifier extends TileEntityMachineBase implement
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.3 KiB |
Loading…
x
Reference in New Issue
Block a user