mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
chemfac fluid IO finished, water cooling
This commit is contained in:
parent
0fe03d1e8f
commit
caa9394a92
@ -13,4 +13,16 @@ public interface IFluidSource extends IFluidContainer {
|
||||
boolean getTact();
|
||||
List<IFluidAcceptor> getFluidList(FluidType type);
|
||||
void clearFluidList(FluidType type);
|
||||
|
||||
public default void setFluidFillForTransfer(int fill, FluidType type) {
|
||||
this.setFluidFill(fill, type);
|
||||
}
|
||||
|
||||
public default int getFluidFillForTransfer(FluidType type) {
|
||||
return this.getFluidFill(type);
|
||||
}
|
||||
|
||||
public default void transferFluid(int amount, FluidType type) {
|
||||
this.setFluidFillForTransfer(this.getFluidFillForTransfer(type) - amount, type);
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,21 +143,32 @@ public class OreDictManager {
|
||||
/*
|
||||
* STABLE
|
||||
*/
|
||||
/** TITANIUM */
|
||||
public static final DictFrame TI = new DictFrame("Titanium");
|
||||
/** COPPER */
|
||||
public static final DictFrame CU = new DictFrame("Copper");
|
||||
public static final DictFrame MINGRADE = new DictFrame("Mingrade");
|
||||
public static final DictFrame ALLOY = new DictFrame("AdvancedAlloy");
|
||||
/** TUNGSTEN */
|
||||
public static final DictFrame W = new DictFrame("Tungsten");
|
||||
/** ALUMINUM */
|
||||
public static final DictFrame AL = new DictFrame("Aluminum");
|
||||
public static final DictFrame STEEL = new DictFrame("Steel");
|
||||
/** TECHNETIUM STEEL */
|
||||
public static final DictFrame TCALLOY = new DictFrame("TcAlloy");
|
||||
/** LEAD */
|
||||
public static final DictFrame PB = new DictFrame("Lead");
|
||||
//public static final DictFrame BI = new DictFrame("Bismuth");
|
||||
/** TANTALUM */
|
||||
public static final DictFrame TA = new DictFrame("Tantalum");
|
||||
public static final DictFrame COLTAN = new DictFrame("Coltan");
|
||||
/** NIOBIUM */
|
||||
public static final DictFrame NB = new DictFrame("Niobium");
|
||||
/** BERYLLIUM */
|
||||
public static final DictFrame BE = new DictFrame("Beryllium");
|
||||
/** COBALT */
|
||||
public static final DictFrame CO = new DictFrame("Cobalt");
|
||||
/** BORON */
|
||||
public static final DictFrame B = new DictFrame("Boron");
|
||||
public static final DictFrame GRAPHITE = new DictFrame("Graphite");
|
||||
public static final DictFrame DURA = new DictFrame("DuraSteel");
|
||||
@ -177,8 +188,11 @@ public class OreDictManager {
|
||||
/*
|
||||
* DUST AND GEM ORES
|
||||
*/
|
||||
/** SULFUR */
|
||||
public static final DictFrame S = new DictFrame("Sulfur");
|
||||
/** SALTPETER/NITER */
|
||||
public static final DictFrame KNO = new DictFrame("Saltpeter");
|
||||
/** FLUORITE */
|
||||
public static final DictFrame F = new DictFrame("Fluorite");
|
||||
public static final DictFrame LIGNITE = new DictFrame("Lignite");
|
||||
public static final DictFrame COALCOKE = new DictFrame("CoalCoke");
|
||||
@ -190,6 +204,7 @@ public class OreDictManager {
|
||||
/*
|
||||
* HAZARDS, MISC
|
||||
*/
|
||||
/** LITHIUM */
|
||||
public static final DictFrame LI = new DictFrame("Lithium");
|
||||
/*
|
||||
* PHOSPHORUS
|
||||
@ -208,18 +223,28 @@ public class OreDictManager {
|
||||
/*
|
||||
* RARE EARTHS
|
||||
*/
|
||||
/** LANTHANUM */
|
||||
public static final DictFrame LA = new DictFrame("Lanthanum");
|
||||
/** ZIRCONIUM */
|
||||
public static final DictFrame ZR = new DictFrame("Zirconium");
|
||||
/** NEODYMIUM */
|
||||
public static final DictFrame ND = new DictFrame("Neodymium");
|
||||
/** CERIUM */
|
||||
public static final DictFrame CE = new DictFrame("Cerium");
|
||||
/*
|
||||
* NITAN
|
||||
*/
|
||||
/** IODINE */
|
||||
public static final DictFrame I = new DictFrame("Iodine");
|
||||
/** ASTATINE */
|
||||
public static final DictFrame AT = new DictFrame("Astatine");
|
||||
/** CAESIUM */
|
||||
public static final DictFrame CS = new DictFrame("Caesium");
|
||||
/** STRONTIUM */
|
||||
public static final DictFrame ST = new DictFrame("Strontium");
|
||||
/** BROMINE */
|
||||
public static final DictFrame BR = new DictFrame("Bromine");
|
||||
/** TENNESSINE */
|
||||
public static final DictFrame TS = new DictFrame("Tennessine") ;
|
||||
/*
|
||||
* FISSION FRAGMENTS
|
||||
|
||||
@ -40,6 +40,9 @@ public class GUIChemfac extends GuiInfoContainer {
|
||||
chemfac.tanks[i * 4 + 2].renderTankInfo(this, mouseX, mouseY, offX + 102, offY + 45 - 32, 5, 34);
|
||||
chemfac.tanks[i * 4 + 3].renderTankInfo(this, mouseX, mouseY, offX + 107, offY + 45 - 32, 5, 34);
|
||||
}
|
||||
|
||||
chemfac.water.renderTankInfo(this, mouseX, mouseY, guiLeft + 233, guiTop + 108, 9, 54);
|
||||
chemfac.steam.renderTankInfo(this, mouseX, mouseY, guiLeft + 242, guiTop + 108, 9, 54);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -74,6 +77,9 @@ public class GUIChemfac extends GuiInfoContainer {
|
||||
chemfac.tanks[i * 4 + 2].renderTank(offX + 103, offY + 46, this.zLevel, 3, 32);
|
||||
chemfac.tanks[i * 4 + 3].renderTank(offX + 108, offY + 46, this.zLevel, 3, 32);
|
||||
}
|
||||
|
||||
chemfac.water.renderTank(guiLeft + 234, guiTop + 161, this.zLevel, 7, 52);
|
||||
chemfac.steam.renderTank(guiLeft + 243, guiTop + 161, this.zLevel, 7, 52);
|
||||
|
||||
if(Keyboard.isKeyDown(Keyboard.KEY_LMENU))
|
||||
for(int i = 0; i < this.inventorySlots.inventorySlots.size(); i++) {
|
||||
|
||||
@ -766,14 +766,27 @@ public class AssemblerRecipes {
|
||||
makeRecipe(new ComparableStack(ModBlocks.machine_deuterium_extractor, 1), new AStack[] {
|
||||
new ComparableStack(ModItems.deuterium_filter, 1),
|
||||
new ComparableStack(ModItems.sulfur, 12),
|
||||
new OreDictStack("plateSteel", 8),
|
||||
new OreDictStack("plateAluminum", 4),
|
||||
new OreDictStack(STEEL.plate(), 8),
|
||||
new OreDictStack(AL.plate(), 4),
|
||||
new ComparableStack(ModItems.pipes_steel),
|
||||
new ComparableStack(ModItems.board_copper, 2),
|
||||
new ComparableStack(ModItems.turbine_titanium, 2),
|
||||
new ComparableStack(ModItems.circuit_aluminium, 3)
|
||||
}, 100);
|
||||
|
||||
makeRecipe(new ComparableStack(ModBlocks.machine_chemfac, 1), new AStack[] {
|
||||
new OreDictStack(STEEL.ingot(), 48),
|
||||
new OreDictStack(TCALLOY.ingot(), 8),
|
||||
new OreDictStack(NB.ingot(), 4),
|
||||
new OreDictStack(RUBBER.ingot(), 16),
|
||||
new ComparableStack(ModItems.hull_big_steel, 6),
|
||||
new ComparableStack(ModItems.tank_steel, 8),
|
||||
new ComparableStack(ModItems.motor_desh, 4),
|
||||
new ComparableStack(ModItems.coil_tungsten, 24),
|
||||
new ComparableStack(ModItems.pipes_steel, 1),
|
||||
new ComparableStack(ModItems.circuit_gold, 3)
|
||||
}, 400);
|
||||
|
||||
makeRecipe(new ComparableStack(ModItems.missile_shuttle, 1), new AStack[] {
|
||||
new ComparableStack(ModItems.missile_generic, 2),
|
||||
new ComparableStack(ModItems.missile_strong, 1),
|
||||
|
||||
@ -368,10 +368,8 @@ public class Library {
|
||||
return power;
|
||||
}
|
||||
|
||||
//TODO: jesus christ kill it
|
||||
//Flut-Füll gesteuerter Energieübertragungsalgorithmus
|
||||
//Flood fill controlled energy transmission algorithm
|
||||
//TODO: bring back the @Cursed annotation just for garbage like this
|
||||
public static void ffgeua(int x, int y, int z, boolean newTact, Object that, World worldObj) {
|
||||
|
||||
/*
|
||||
@ -620,21 +618,20 @@ public class Library {
|
||||
int size = that.getFluidList(type).size();
|
||||
|
||||
if(size > 0) {
|
||||
int part = that.getFluidFill(type) / size;
|
||||
int part = that.getFluidFillForTransfer(type) / size;
|
||||
|
||||
for(IFluidAcceptor consume : that.getFluidList(type)) {
|
||||
|
||||
if(consume.getFluidFillForReceive(type) < consume.getMaxFluidFillForReceive(type)) {
|
||||
|
||||
if(consume.getMaxFluidFillForReceive(type) - consume.getFluidFillForReceive(type) >= part) {
|
||||
that.setFluidFill(that.getFluidFill(type) - part, type);
|
||||
that.transferFluid(part, type);
|
||||
consume.receiveFluid(part, type);
|
||||
//consume.setFluidFillForReceive(consume.getFluidFillForReceive(type) + part, type);
|
||||
|
||||
} else {
|
||||
that.setFluidFill(that.getFluidFill(type) - (consume.getMaxFluidFillForReceive(type) - consume.getFluidFillForReceive(type)), type);
|
||||
consume.receiveFluid(consume.getMaxFluidFillForReceive(type) - consume.getFluidFillForReceive(type), type);
|
||||
//consume.setFluidFillForReceive(consume.getMaxFluidFillForReceive(type), type);
|
||||
int transfer = consume.getMaxFluidFillForReceive(type) - consume.getFluidFillForReceive(type);
|
||||
that.transferFluid(transfer, type);
|
||||
consume.receiveFluid(transfer, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineChemfac;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@ -17,7 +18,9 @@ public class RenderChemfac extends TileEntitySpecialRenderer {
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
|
||||
switch(tileEntity.getBlockMetadata() - BlockDummyable.offset) {
|
||||
TileEntityMachineChemfac chemfac = (TileEntityMachineChemfac) tileEntity;
|
||||
|
||||
switch(chemfac.getBlockMetadata() - BlockDummyable.offset) {
|
||||
case 5: GL11.glRotatef(180, 0F, 1F, 0F); break;
|
||||
case 2: GL11.glRotatef(270, 0F, 1F, 0F); break;
|
||||
case 4: GL11.glRotatef(0, 0F, 1F, 0F); break;
|
||||
@ -30,18 +33,18 @@ public class RenderChemfac extends TileEntitySpecialRenderer {
|
||||
bindTexture(ResourceManager.chemfac_tex);
|
||||
ResourceManager.chemfac.renderPart("Main");
|
||||
|
||||
float slowdown = 2.5F;
|
||||
float rot = chemfac.prevRot + (chemfac.rot - chemfac.prevRot) * f;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(1, 0, 0);
|
||||
GL11.glRotated(System.currentTimeMillis() % (int)(360 * slowdown) / slowdown + f, 0, -1, 0);
|
||||
GL11.glRotated(rot, 0, -1, 0);
|
||||
GL11.glTranslated(-1, 0, 0);
|
||||
ResourceManager.chemfac.renderPart("Fan1");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(-1, 0, 0);
|
||||
GL11.glRotated(System.currentTimeMillis() % (int)(360 * slowdown) / slowdown + f, 0, -1, 0);
|
||||
GL11.glRotated(rot, 0, -1, 0);
|
||||
GL11.glTranslated(1, 0, 0);
|
||||
ResourceManager.chemfac.renderPart("Fan2");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package com.hbm.tileentity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.interfaces.IFluidContainer;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
|
||||
import api.hbm.energy.IEnergyConnector;
|
||||
@ -46,8 +45,8 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
if(!fluid)
|
||||
return;
|
||||
|
||||
if(getTile() instanceof IFluidAcceptor) {
|
||||
((IFluidAcceptor)getTile()).setFillForSync(fill, index);
|
||||
if(getTile() instanceof IFluidContainer) {
|
||||
((IFluidContainer)getTile()).setFillForSync(fill, index);
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,8 +56,44 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
if(!fluid)
|
||||
return;
|
||||
|
||||
if(getTile() instanceof IFluidContainer) {
|
||||
((IFluidContainer)getTile()).setFluidFill(fill, type);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFluidFillForReceive(FluidType type) {
|
||||
|
||||
if(!fluid)
|
||||
return 0;
|
||||
|
||||
if(getTile() instanceof IFluidAcceptor) {
|
||||
((IFluidAcceptor)getTile()).setFluidFill(fill, type);
|
||||
return ((IFluidAcceptor)getTile()).getFluidFillForReceive(type);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxFluidFillForReceive(FluidType type) {
|
||||
|
||||
if(!fluid)
|
||||
return 0;
|
||||
|
||||
if(getTile() instanceof IFluidAcceptor) {
|
||||
return ((IFluidAcceptor)getTile()).getMaxFluidFillForReceive(type);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveFluid(int amount, FluidType type) {
|
||||
|
||||
if(!fluid)
|
||||
return;
|
||||
|
||||
if(getTile() instanceof IFluidAcceptor) {
|
||||
((IFluidAcceptor)getTile()).receiveFluid(amount, type);
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,8 +103,8 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
if(!fluid)
|
||||
return;
|
||||
|
||||
if(getTile() instanceof IFluidAcceptor) {
|
||||
((IFluidAcceptor)getTile()).setTypeForSync(type, index);
|
||||
if(getTile() instanceof IFluidContainer) {
|
||||
((IFluidContainer)getTile()).setTypeForSync(type, index);
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,8 +114,8 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
if(!fluid)
|
||||
return 0;
|
||||
|
||||
if(getTile() instanceof IFluidAcceptor) {
|
||||
return ((IFluidAcceptor)getTile()).getFluidFill(type);
|
||||
if(getTile() instanceof IFluidContainer) {
|
||||
return ((IFluidContainer)getTile()).getFluidFill(type);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@ -2,7 +2,6 @@ package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.blocks.machine.MachineDiFurnaceRTG;
|
||||
import com.hbm.inventory.recipes.MachineRecipes;
|
||||
import com.hbm.items.machine.ItemRTGPellet;
|
||||
import com.hbm.util.RTGUtil;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
@ -164,6 +163,11 @@ public class TileEntityDiFurnaceRTG extends TileEntityMachineBase
|
||||
return side == 0 ? new int[] {2} : side == 1 ? new int[] {0} : new int[] {1};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side) {
|
||||
return slot == 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "container.diFurnaceRTG";
|
||||
|
||||
@ -1,22 +1,40 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.inventory.UpgradeManager;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
|
||||
import com.hbm.lib.Library;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase {
|
||||
|
||||
float rotSpeed;
|
||||
public float rot;
|
||||
public float prevRot;
|
||||
|
||||
public FluidTank water;
|
||||
public FluidTank steam;
|
||||
|
||||
public TileEntityMachineChemfac() {
|
||||
super(77);
|
||||
|
||||
water = new FluidTank(Fluids.WATER, 64_000, tanks.length);
|
||||
steam = new FluidTank(Fluids.SPENTSTEAM, 64_000, tanks.length + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -25,6 +43,22 @@ public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.speed = 100;
|
||||
this.consumption = 100;
|
||||
|
||||
UpgradeManager.eval(slots, 1, 4);
|
||||
|
||||
int speedLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 6);
|
||||
int powerLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3);
|
||||
int overLevel = UpgradeManager.getLevel(UpgradeType.OVERDRIVE);
|
||||
|
||||
this.speed -= speedLevel * 15;
|
||||
this.consumption += speedLevel * 300;
|
||||
this.speed += powerLevel * 5;
|
||||
this.consumption -= powerLevel * 30;
|
||||
this.speed /= (overLevel + 1);
|
||||
this.consumption *= (overLevel + 1);
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", this.power);
|
||||
data.setIntArray("progress", this.progress);
|
||||
@ -34,22 +68,49 @@ public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase {
|
||||
for(int i = 0; i < tanks.length; i++) {
|
||||
tanks[i].writeToNBT(data, "t" + i);
|
||||
}
|
||||
water.writeToNBT(data, "w");
|
||||
steam.writeToNBT(data, "s");
|
||||
|
||||
this.networkPack(data, 150);
|
||||
} else {
|
||||
|
||||
if(this.worldObj.getTotalWorldTime() % 5 == 0) {
|
||||
float maxSpeed = 30F;
|
||||
|
||||
if(isProgressing) {
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset).getOpposite();
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
Random rand = worldObj.rand;
|
||||
rotSpeed += 0.1;
|
||||
|
||||
double x = xCoord + 0.5 - rot.offsetX * 0.5;
|
||||
double y = yCoord + 3;
|
||||
double z = zCoord + 0.5 - rot.offsetZ * 0.5;
|
||||
|
||||
worldObj.spawnParticle("cloud", x + dir.offsetX * 1.5 + rand.nextGaussian() * 0.15, y, z + dir.offsetZ * 1.5 + rand.nextGaussian() * 0.15, 0.0, 0.15, 0.0);
|
||||
worldObj.spawnParticle("cloud", x - dir.offsetX * 0.5 + rand.nextGaussian() * 0.15, y, z - dir.offsetZ * 0.5 + rand.nextGaussian() * 0.15, 0.0, 0.15, 0.0);
|
||||
if(rotSpeed > maxSpeed)
|
||||
rotSpeed = maxSpeed;
|
||||
|
||||
if(rotSpeed == maxSpeed && this.worldObj.getTotalWorldTime() % 5 == 0) {
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset).getOpposite();
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
Random rand = worldObj.rand;
|
||||
|
||||
double x = xCoord + 0.5 - rot.offsetX * 0.5;
|
||||
double y = yCoord + 3;
|
||||
double z = zCoord + 0.5 - rot.offsetZ * 0.5;
|
||||
|
||||
worldObj.spawnParticle("cloud", x + dir.offsetX * 1.5 + rand.nextGaussian() * 0.15, y, z + dir.offsetZ * 1.5 + rand.nextGaussian() * 0.15, 0.0, 0.15, 0.0);
|
||||
worldObj.spawnParticle("cloud", x - dir.offsetX * 0.5 + rand.nextGaussian() * 0.15, y, z - dir.offsetZ * 0.5 + rand.nextGaussian() * 0.15, 0.0, 0.15, 0.0);
|
||||
}
|
||||
} else {
|
||||
|
||||
rotSpeed -= 0.1;
|
||||
|
||||
if(rotSpeed < 0)
|
||||
rotSpeed = 0;
|
||||
}
|
||||
|
||||
prevRot = rot;
|
||||
|
||||
rot += rotSpeed;
|
||||
|
||||
if(rot >= 360) {
|
||||
rot -= 360;
|
||||
prevRot -= 360;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -64,6 +125,25 @@ public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase {
|
||||
for(int i = 0; i < tanks.length; i++) {
|
||||
tanks[i].readFromNBT(nbt, "t" + i);
|
||||
}
|
||||
water.readFromNBT(nbt, "w");
|
||||
steam.readFromNBT(nbt, "s");
|
||||
}
|
||||
|
||||
private int getWaterRequired() {
|
||||
return 1000 / this.speed;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canProcess(int index) {
|
||||
return super.canProcess(index) && this.water.getFill() >= getWaterRequired() && this.steam.getFill() + getWaterRequired() <= this.steam.getMaxFill();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void process(int index) {
|
||||
super.process(index);
|
||||
this.water.setFill(this.water.getFill() - getWaterRequired());
|
||||
this.steam.setFill(this.steam.getFill() + getWaterRequired());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -74,26 +154,53 @@ public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase {
|
||||
@Override
|
||||
public void fillFluidInit(FluidType type) {
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
for(int i = 0; i < 6; i++) {
|
||||
fillFluid(xCoord + dir.offsetX * (2 - i) + rot.offsetX * 3, yCoord + 4, zCoord + dir.offsetZ * (2 - i) + rot.offsetZ * 3, this.getTact(), type);
|
||||
fillFluid(xCoord + dir.offsetX * (2 - i) - rot.offsetX * 2, yCoord + 4, zCoord + dir.offsetZ * (2 - i) - rot.offsetZ * 2, this.getTact(), type);
|
||||
|
||||
for(int j = 0; j < 2; j++) {
|
||||
fillFluid(xCoord + dir.offsetX * (2 - i) + rot.offsetX * 5, yCoord + 1 + j, zCoord + dir.offsetZ * (2 - i) + rot.offsetZ * 5, this.getTact(), type);
|
||||
fillFluid(xCoord + dir.offsetX * (2 - i) - rot.offsetX * 4, yCoord + 1 + j, zCoord + dir.offsetZ * (2 - i) - rot.offsetZ * 4, this.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
|
||||
public boolean getTact() {
|
||||
return false;
|
||||
return this.worldObj.getTotalWorldTime() % 20 < 10;
|
||||
}
|
||||
|
||||
private HashMap<FluidType, List<IFluidAcceptor>> fluidMap = new HashMap();
|
||||
|
||||
@Override
|
||||
public List<IFluidAcceptor> getFluidList(FluidType type) {
|
||||
return new ArrayList();
|
||||
|
||||
List<IFluidAcceptor> list = fluidMap.get(type);
|
||||
|
||||
if(list == null) {
|
||||
list = new ArrayList();
|
||||
fluidMap.put(type, list);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearFluidList(FluidType type) {
|
||||
|
||||
List<IFluidAcceptor> list = fluidMap.get(type);
|
||||
|
||||
if(list != null) {
|
||||
list.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -116,20 +223,95 @@ public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase {
|
||||
return new int[] {5 + index * 9, 8 + index * 9, 9 + index * 9, 12 + index * 9};
|
||||
}
|
||||
|
||||
ChunkCoordinates[] inpos;
|
||||
ChunkCoordinates[] outpos;
|
||||
|
||||
@Override
|
||||
public ChunkCoordinates[] getInputPositions() {
|
||||
return new ChunkCoordinates[0];
|
||||
|
||||
if(inpos != null)
|
||||
return inpos;
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
inpos = new ChunkCoordinates[] {
|
||||
new ChunkCoordinates(xCoord + dir.offsetX * 4 - rot.offsetX * 1, yCoord, zCoord + dir.offsetZ * 4 - rot.offsetZ * 1),
|
||||
new ChunkCoordinates(xCoord - dir.offsetX * 5 + rot.offsetX * 2, yCoord, zCoord - dir.offsetZ * 5 + rot.offsetZ * 2),
|
||||
new ChunkCoordinates(xCoord - dir.offsetX * 2 - rot.offsetX * 4, yCoord, zCoord - dir.offsetZ * 2 - rot.offsetZ * 4),
|
||||
new ChunkCoordinates(xCoord + dir.offsetX * 1 + rot.offsetX * 5, yCoord, zCoord + dir.offsetZ * 1 + rot.offsetZ * 5)
|
||||
};
|
||||
|
||||
return inpos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkCoordinates[] getOutputPositions() {
|
||||
return new ChunkCoordinates[0];
|
||||
|
||||
if(outpos != null)
|
||||
return outpos;
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
outpos = new ChunkCoordinates[] {
|
||||
new ChunkCoordinates(xCoord + dir.offsetX * 4 + rot.offsetX * 2, yCoord, zCoord + dir.offsetZ * 4 + rot.offsetZ * 2),
|
||||
new ChunkCoordinates(xCoord - dir.offsetX * 5 - rot.offsetX * 1, yCoord, zCoord - dir.offsetZ * 5 - rot.offsetZ * 1),
|
||||
new ChunkCoordinates(xCoord + dir.offsetX * 1 - rot.offsetX * 4, yCoord, zCoord + dir.offsetZ * 1 - rot.offsetZ * 4),
|
||||
new ChunkCoordinates(xCoord - dir.offsetX * 2 + rot.offsetX * 5, yCoord, zCoord - dir.offsetZ * 2 + rot.offsetZ * 5)
|
||||
};
|
||||
|
||||
return outpos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
water.readFromNBT(nbt, "w");
|
||||
steam.readFromNBT(nbt, "s");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
water.writeToNBT(nbt, "w");
|
||||
steam.writeToNBT(nbt, "s");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "container.machineChemFac";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<FluidTank> inTanks() {
|
||||
|
||||
List<FluidTank> inTanks = super.inTanks();
|
||||
inTanks.add(water);
|
||||
|
||||
return inTanks;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<FluidTank> outTanks() {
|
||||
|
||||
List<FluidTank> outTanks = super.outTanks();
|
||||
outTanks.add(steam);
|
||||
|
||||
return outTanks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxFluidFillForReceive(FluidType type) {
|
||||
/*int fill = this.getMaxFluidFill(type);
|
||||
|
||||
if(type == Fluids.WATER)
|
||||
fill += water.getMaxFill();
|
||||
|
||||
return fill;*/
|
||||
|
||||
return super.getMaxFluidFillForReceive(type);
|
||||
}
|
||||
|
||||
AxisAlignedBB bb = null;
|
||||
|
||||
@ -149,4 +331,10 @@ public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase {
|
||||
|
||||
return bb;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,6 +23,8 @@ import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.InventoryUtil;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@ -526,6 +528,12 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements
|
||||
|
||||
return bb;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlaying() {
|
||||
|
||||
@ -19,6 +19,7 @@ import com.hbm.util.InventoryUtil;
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
|
||||
@ -71,11 +72,12 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa
|
||||
unloadItems(i);
|
||||
}
|
||||
|
||||
if(worldObj.getTotalWorldTime() % 1 == 0) {
|
||||
if(worldObj.getTotalWorldTime() % 10 == 0) {
|
||||
|
||||
for(int i = 0; i < count; i++) {
|
||||
this.fillFluidInit(tanks[i * 4 + 2].getTankType());
|
||||
this.fillFluidInit(tanks[i * 4 + 3].getTankType());
|
||||
for(FluidTank tank : this.outTanks()) {
|
||||
if(tank.getTankType() != Fluids.NONE && tank.getFill() > 0) {
|
||||
this.fillFluidInit(tank.getTankType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,7 +93,7 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa
|
||||
}
|
||||
}
|
||||
|
||||
private boolean canProcess(int index) {
|
||||
protected boolean canProcess(int index) {
|
||||
|
||||
int template = getTemplateIndex(index);
|
||||
|
||||
@ -143,7 +145,7 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa
|
||||
return InventoryUtil.doesArrayHaveSpace(slots, indices[2], indices[3], recipe.outputs);
|
||||
}
|
||||
|
||||
private void process(int index) {
|
||||
protected void process(int index) {
|
||||
|
||||
this.power -= this.consumption;
|
||||
this.progress[index]++;
|
||||
@ -307,36 +309,26 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFillForSync(int fill, int index) {
|
||||
if(index >= 0 && index < tanks.length) tanks[index].setFill(fill);
|
||||
}
|
||||
public void setFillForSync(int fill, int index) { }
|
||||
|
||||
@Override
|
||||
public void setFluidFill(int fill, FluidType type) {
|
||||
|
||||
//TODO: figure this shit out
|
||||
//also this won't work anyway since there's no difference as of now between setting in or output tanks
|
||||
//the recent rework tried to implement that difference but we all know how that went
|
||||
|
||||
/*for(FluidTank tank : tanks) {
|
||||
if(tank.getTankType() == type) {
|
||||
tank.setFill(fill);
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
public void setFluidFill(int fill, FluidType type) { }
|
||||
|
||||
@Override
|
||||
public void setTypeForSync(FluidType type, int index) {
|
||||
if(index >= 0 && index < tanks.length) tanks[index].setTankType(type);
|
||||
}
|
||||
public void setTypeForSync(FluidType type, int index) { }
|
||||
|
||||
@Override
|
||||
public int getFluidFill(FluidType type) {
|
||||
|
||||
int fill = 0;
|
||||
|
||||
for(FluidTank tank : tanks) {
|
||||
for(FluidTank tank : inTanks()) {
|
||||
if(tank.getTankType() == type) {
|
||||
fill += tank.getFill();
|
||||
}
|
||||
}
|
||||
|
||||
for(FluidTank tank : outTanks()) {
|
||||
if(tank.getTankType() == type) {
|
||||
fill += tank.getFill();
|
||||
}
|
||||
@ -350,12 +342,11 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa
|
||||
public int getMaxFluidFill(FluidType type) {
|
||||
|
||||
int maxFill = 0;
|
||||
int count = getRecipeCount();
|
||||
|
||||
for(int i = 0; i < count; i++) {
|
||||
|
||||
if(tanks[i * 4].getTankType() == type) maxFill += tanks[i * 4].getMaxFill();
|
||||
if(tanks[i * 4 + 1].getTankType() == type) maxFill += tanks[i * 4 + 1].getMaxFill();
|
||||
for(FluidTank tank : inTanks()) {
|
||||
if(tank.getTankType() == type) {
|
||||
maxFill += tank.getMaxFill();
|
||||
}
|
||||
}
|
||||
|
||||
return maxFill;
|
||||
@ -366,22 +357,39 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa
|
||||
|
||||
int fill = 0;
|
||||
|
||||
for(FluidTank tank : tanks) {
|
||||
if(tank.index % 4 < 2 && tank.getTankType() == type) {
|
||||
for(FluidTank tank : inTanks()) {
|
||||
if(tank.getTankType() == type) {
|
||||
fill += tank.getFill();
|
||||
}
|
||||
}
|
||||
|
||||
return fill;
|
||||
}
|
||||
|
||||
protected List<FluidTank> inTanks() {
|
||||
|
||||
List<FluidTank> inTanks = new ArrayList();
|
||||
|
||||
for(int i = 0; i < tanks.length; i++) {
|
||||
FluidTank tank = tanks[i];
|
||||
if(tank.index % 4 < 2) {
|
||||
inTanks.add(tank);
|
||||
}
|
||||
}
|
||||
|
||||
return inTanks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveFluid(int amount, FluidType type) {
|
||||
|
||||
if(amount <= 0)
|
||||
return;
|
||||
|
||||
List<FluidTank> rec = new ArrayList();
|
||||
|
||||
for(FluidTank tank : tanks) {
|
||||
if(tank.index % 4 < 2 && tank.getTankType() == type) {
|
||||
for(FluidTank tank : inTanks()) {
|
||||
if(tank.getTankType() == type) {
|
||||
rec.add(tank);
|
||||
}
|
||||
}
|
||||
@ -390,31 +398,137 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa
|
||||
return;
|
||||
|
||||
int demand = 0;
|
||||
List<Integer> weight = new ArrayList();
|
||||
|
||||
for(FluidTank tank : rec) {
|
||||
demand += tank.getMaxFill() - tank.getFill();
|
||||
int fillWeight = tank.getMaxFill() - tank.getFill();
|
||||
demand += fillWeight;
|
||||
weight.add(fillWeight);
|
||||
}
|
||||
|
||||
int part = demand / rec.size(); // dividing ints rounds down anyway
|
||||
|
||||
for(FluidTank tank : rec) {
|
||||
tank.setFill(tank.getFill() + part);
|
||||
demand -= part;
|
||||
}
|
||||
|
||||
//getting rid of annoying rounding errors
|
||||
if(demand > 0) {
|
||||
for(int i = 0; i < rec.size(); i++) {
|
||||
|
||||
while(demand > 0) {
|
||||
|
||||
FluidTank tank = rec.get(worldObj.rand.nextInt(rec.size()));
|
||||
if(tank.getFill() < tank.getMaxFill()) {
|
||||
//we do single mB steps because the distribution is more even this way and honestly the remainder can't possibly be that big
|
||||
tank.setFill(tank.getFill() + 1);
|
||||
demand--;
|
||||
}
|
||||
if(demand <= 0)
|
||||
break;
|
||||
|
||||
FluidTank tank = rec.get(i);
|
||||
int fillWeight = weight.get(i);
|
||||
int part = (int) ((long)amount * (long)fillWeight / (long)demand);
|
||||
|
||||
tank.setFill(tank.getFill() + part);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFluidFillForTransfer(FluidType type) {
|
||||
|
||||
int fill = 0;
|
||||
|
||||
for(FluidTank tank : outTanks()) {
|
||||
if(tank.getTankType() == type) {
|
||||
fill += tank.getFill();
|
||||
}
|
||||
}
|
||||
|
||||
return fill;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transferFluid(int amount, FluidType type) {
|
||||
|
||||
/*
|
||||
* this whole new fluid mumbo jumbo extra abstraction layer might just be a bandaid
|
||||
* on the gushing wound that is the current fluid systemm but i'll be damned if it
|
||||
* didn't at least do what it's supposed to. half a decade and we finally have multi
|
||||
* tank support for tanks with matching fluid types!!
|
||||
*/
|
||||
if(amount <= 0)
|
||||
return;
|
||||
|
||||
List<FluidTank> send = new ArrayList();
|
||||
|
||||
for(FluidTank tank : outTanks()) {
|
||||
if(tank.getTankType() == type) {
|
||||
send.add(tank);
|
||||
}
|
||||
}
|
||||
|
||||
if(send.size() == 0)
|
||||
return;
|
||||
|
||||
int offer = 0;
|
||||
List<Integer> weight = new ArrayList();
|
||||
|
||||
for(FluidTank tank : send) {
|
||||
int fillWeight = tank.getFill();
|
||||
offer += fillWeight;
|
||||
weight.add(fillWeight);
|
||||
}
|
||||
|
||||
int tracker = amount;
|
||||
|
||||
for(int i = 0; i < send.size(); i++) {
|
||||
|
||||
FluidTank tank = send.get(i);
|
||||
int fillWeight = weight.get(i);
|
||||
int part = amount * fillWeight / offer;
|
||||
|
||||
tank.setFill(tank.getFill() - part);
|
||||
tracker -= part;
|
||||
}
|
||||
|
||||
//making sure to properly deduct even the last mB lost by rounding errors
|
||||
for(int i = 0; i < 100 && tracker > 0; i++) {
|
||||
|
||||
FluidTank tank = send.get(i % send.size());
|
||||
|
||||
if(tank.getFill() > 0) {
|
||||
int total = Math.min(tank.getFill(), tracker);
|
||||
tracker -= total;
|
||||
tank.setFill(tank.getFill() - total);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected List<FluidTank> outTanks() {
|
||||
|
||||
List<FluidTank> outTanks = new ArrayList();
|
||||
|
||||
for(int i = 0; i < tanks.length; i++) {
|
||||
FluidTank tank = tanks[i];
|
||||
if(tank.index % 4 > 1) {
|
||||
outTanks.add(tank);
|
||||
}
|
||||
}
|
||||
|
||||
return outTanks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
this.power = nbt.getLong("power");
|
||||
this.progress = nbt.getIntArray("progress");
|
||||
|
||||
if(progress.length == 0)
|
||||
progress = new int[this.getRecipeCount()];
|
||||
|
||||
for(int i = 0; i < tanks.length; i++) {
|
||||
tanks[i].readFromNBT(nbt, "t" + i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
nbt.setLong("power", power);
|
||||
nbt.setIntArray("progress", progress);
|
||||
|
||||
for(int i = 0; i < tanks.length; i++) {
|
||||
tanks[i].writeToNBT(nbt, "t" + i);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract int getRecipeCount();
|
||||
|
||||
@ -1831,7 +1831,7 @@ item.ingot_asbestos.name=Asbestos Sheet
|
||||
item.ingot_asbestos.desc=§o\"Filled with life, self-doubt and asbestos. That comes with the air.\"§r
|
||||
item.ingot_au198.name=Gold-198 Ingot
|
||||
item.ingot_australium.name=Australium Ingot
|
||||
item.ingot_bakelite.name=Bakelite Ingot
|
||||
item.ingot_bakelite.name=Bakelite Bar
|
||||
item.ingot_beryllium.name=Beryllium Ingot
|
||||
item.ingot_bismuth.name=Bismuth Ingot
|
||||
item.ingot_boron.name=Boron Ingot
|
||||
|
||||
BIN
src/main/resources/assets/hbm/textures/items/grenade_kyiv.png
Normal file
BIN
src/main/resources/assets/hbm/textures/items/grenade_kyiv.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 549 B |
@ -0,0 +1,3 @@
|
||||
{
|
||||
"animation": {}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user