mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Merge remote-tracking branch 'HbmMods/master'
This commit is contained in:
commit
3fde052e09
@ -9,11 +9,11 @@ public interface IFluidConductor extends IFluidConnector {
|
||||
public void setPipeNet(FluidType type, IPipeNet network);
|
||||
|
||||
@Override
|
||||
public default long transferFluid(FluidType type, long amount) {
|
||||
public default long transferFluid(FluidType type, int pressure, long amount) {
|
||||
|
||||
if(this.getPipeNet(type) == null)
|
||||
return amount;
|
||||
|
||||
return this.getPipeNet(type).transferFluid(amount);
|
||||
return this.getPipeNet(type).transferFluid(amount, pressure);
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ public interface IFluidConnector {
|
||||
* @param power
|
||||
* @return
|
||||
*/
|
||||
public long transferFluid(FluidType type, long fluid);
|
||||
public long transferFluid(FluidType type, int pressure, long fluid);
|
||||
|
||||
/**
|
||||
* Whether the given side can be connected to
|
||||
@ -33,7 +33,7 @@ public interface IFluidConnector {
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
public long getDemand(FluidType type);
|
||||
public long getDemand(FluidType type, int pressure);
|
||||
|
||||
/**
|
||||
* Basic implementation of subscribing to a nearby power grid
|
||||
|
||||
@ -14,10 +14,10 @@ import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
public interface IFluidStandardReceiver extends IFluidUser {
|
||||
|
||||
@Override
|
||||
public default long transferFluid(FluidType type, long amount) {
|
||||
public default long transferFluid(FluidType type, int pressure, long amount) {
|
||||
|
||||
for(FluidTank tank : getReceivingTanks()) {
|
||||
if(tank.getTankType() == type) {
|
||||
if(tank.getTankType() == type && tank.getPressure() == pressure) {
|
||||
tank.setFill(tank.getFill() + (int) amount);
|
||||
|
||||
if(tank.getFill() > tank.getMaxFill()) {
|
||||
@ -36,10 +36,10 @@ public interface IFluidStandardReceiver extends IFluidUser {
|
||||
public FluidTank[] getReceivingTanks();
|
||||
|
||||
@Override
|
||||
public default long getDemand(FluidType type) {
|
||||
public default long getDemand(FluidType type, int pressure) {
|
||||
|
||||
for(FluidTank tank : getReceivingTanks()) {
|
||||
if(tank.getTankType() == type) {
|
||||
if(tank.getTankType() == type && tank.getPressure() == pressure) {
|
||||
return tank.getMaxFill() - tank.getFill();
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,10 +16,10 @@ public interface IFluidStandardSender extends IFluidUser {
|
||||
public FluidTank[] getSendingTanks();
|
||||
|
||||
@Override
|
||||
public default long getTotalFluidForSend(FluidType type) {
|
||||
public default long getTotalFluidForSend(FluidType type, int pressure) {
|
||||
|
||||
for(FluidTank tank : getSendingTanks()) {
|
||||
if(tank.getTankType() == type) {
|
||||
if(tank.getTankType() == type && tank.getPressure() == pressure) {
|
||||
return tank.getFill();
|
||||
}
|
||||
}
|
||||
@ -28,10 +28,10 @@ public interface IFluidStandardSender extends IFluidUser {
|
||||
}
|
||||
|
||||
@Override
|
||||
public default void removeFluidForTransfer(FluidType type, long amount) {
|
||||
public default void removeFluidForTransfer(FluidType type, int pressure, long amount) {
|
||||
|
||||
for(FluidTank tank : getSendingTanks()) {
|
||||
if(tank.getTankType() == type) {
|
||||
if(tank.getTankType() == type && tank.getPressure() == pressure) {
|
||||
tank.setFill(tank.getFill() - (int) amount);
|
||||
return;
|
||||
}
|
||||
@ -39,12 +39,12 @@ public interface IFluidStandardSender extends IFluidUser {
|
||||
}
|
||||
|
||||
@Override
|
||||
public default long transferFluid(FluidType type, long fluid) {
|
||||
public default long transferFluid(FluidType type, int pressure, long fluid) {
|
||||
return fluid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public default long getDemand(FluidType type) {
|
||||
public default long getDemand(FluidType type, int pressure) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ public interface IFluidStandardTransceiver extends IFluidUser {
|
||||
public FluidTank[] getReceivingTanks();
|
||||
|
||||
@Override
|
||||
public default long getTotalFluidForSend(FluidType type) {
|
||||
public default long getTotalFluidForSend(FluidType type, int pressure) {
|
||||
|
||||
for(FluidTank tank : getSendingTanks()) {
|
||||
if(tank.getTankType() == type) {
|
||||
@ -35,7 +35,7 @@ public interface IFluidStandardTransceiver extends IFluidUser {
|
||||
}
|
||||
|
||||
@Override
|
||||
public default void removeFluidForTransfer(FluidType type, long amount) {
|
||||
public default void removeFluidForTransfer(FluidType type, int pressure, long amount) {
|
||||
|
||||
for(FluidTank tank : getSendingTanks()) {
|
||||
if(tank.getTankType() == type) {
|
||||
@ -46,7 +46,7 @@ public interface IFluidStandardTransceiver extends IFluidUser {
|
||||
}
|
||||
|
||||
@Override
|
||||
public default long getDemand(FluidType type) {
|
||||
public default long getDemand(FluidType type, int pressure) {
|
||||
|
||||
for(FluidTank tank : getReceivingTanks()) {
|
||||
if(tank.getTankType() == type) {
|
||||
@ -58,7 +58,7 @@ public interface IFluidStandardTransceiver extends IFluidUser {
|
||||
}
|
||||
|
||||
@Override
|
||||
public default long transferFluid(FluidType type, long amount) {
|
||||
public default long transferFluid(FluidType type, int pressure, long amount) {
|
||||
|
||||
for(FluidTank tank : getReceivingTanks()) {
|
||||
if(tank.getTankType() == type) {
|
||||
|
||||
@ -13,7 +13,11 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface IFluidUser extends IFluidConnector {
|
||||
|
||||
public default void sendFluid(FluidType type, World world, int x, int y, int z, ForgeDirection dir) {
|
||||
public default void sendFluid(FluidTank tank, World world, int x, int y, int z, ForgeDirection dir) {
|
||||
sendFluid(tank.getTankType(), tank.getPressure(), world, x, y, z, dir);
|
||||
}
|
||||
|
||||
public default void sendFluid(FluidType type, int pressure, World world, int x, int y, int z, ForgeDirection dir) {
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
boolean wasSubscribed = false;
|
||||
@ -32,9 +36,9 @@ public interface IFluidUser extends IFluidConnector {
|
||||
IFluidConnector con = (IFluidConnector) te;
|
||||
|
||||
if(con.canConnect(type, dir.getOpposite())) {
|
||||
long toSend = this.getTotalFluidForSend(type);
|
||||
long transfer = toSend - con.transferFluid(type, toSend);
|
||||
this.removeFluidForTransfer(type, transfer);
|
||||
long toSend = this.getTotalFluidForSend(type, pressure);
|
||||
long transfer = toSend - con.transferFluid(type, pressure, toSend);
|
||||
this.removeFluidForTransfer(type, pressure, transfer);
|
||||
red = true;
|
||||
}
|
||||
}
|
||||
@ -77,15 +81,21 @@ public interface IFluidUser extends IFluidConnector {
|
||||
return null;
|
||||
}
|
||||
|
||||
public default void sendFluidToAll(FluidType type, TileEntity te) {
|
||||
/** Use more common conPos method instead */
|
||||
@Deprecated public default void sendFluidToAll(FluidTank tank, TileEntity te) {
|
||||
sendFluidToAll(tank.getTankType(), tank.getPressure(), te);
|
||||
}
|
||||
|
||||
/** Use more common conPos method instead */
|
||||
@Deprecated public default void sendFluidToAll(FluidType type, int pressure, TileEntity te) {
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
sendFluid(type, te.getWorldObj(), te.xCoord + dir.offsetX, te.yCoord + dir.offsetY, te.zCoord + dir.offsetZ, dir);
|
||||
sendFluid(type, pressure, te.getWorldObj(), te.xCoord + dir.offsetX, te.yCoord + dir.offsetY, te.zCoord + dir.offsetZ, dir);
|
||||
}
|
||||
}
|
||||
|
||||
public default long getTotalFluidForSend(FluidType type) { return 0; }
|
||||
public default void removeFluidForTransfer(FluidType type, long amount) { }
|
||||
public default long getTotalFluidForSend(FluidType type, int pressure) { return 0; }
|
||||
public default void removeFluidForTransfer(FluidType type, int pressure, long amount) { }
|
||||
|
||||
public default void subscribeToAllAround(FluidType type, TileEntity te) {
|
||||
subscribeToAllAround(type, te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord);
|
||||
|
||||
@ -24,7 +24,7 @@ public interface IPipeNet {
|
||||
|
||||
public boolean isValid();
|
||||
|
||||
public long transferFluid(long fill);
|
||||
public long transferFluid(long fill, int pressure);
|
||||
public FluidType getType();
|
||||
public BigInteger getTotalTransfer();
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ public class PipeNet implements IPipeNet {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long transferFluid(long fill) {
|
||||
public long transferFluid(long fill, int pressure) {
|
||||
|
||||
this.subscribers.removeIf(x ->
|
||||
x == null || !(x instanceof TileEntity) || ((TileEntity)x).isInvalid()
|
||||
@ -97,16 +97,16 @@ public class PipeNet implements IPipeNet {
|
||||
trackingInstances = new ArrayList();
|
||||
trackingInstances.add(this);
|
||||
List<IFluidConnector> subList = new ArrayList(subscribers);
|
||||
return fairTransfer(subList, type, fill);
|
||||
return fairTransfer(subList, type, pressure, fill);
|
||||
}
|
||||
|
||||
public static long fairTransfer(List<IFluidConnector> subList, FluidType type, long fill) {
|
||||
public static long fairTransfer(List<IFluidConnector> subList, FluidType type, int pressure, long fill) {
|
||||
|
||||
List<Long> weight = new ArrayList();
|
||||
long totalReq = 0;
|
||||
|
||||
for(IFluidConnector con : subList) {
|
||||
long req = con.getDemand(type);
|
||||
long req = con.getDemand(type, pressure);
|
||||
weight.add(req);
|
||||
totalReq += req;
|
||||
}
|
||||
@ -123,7 +123,7 @@ public class PipeNet implements IPipeNet {
|
||||
|
||||
long given = (long) Math.floor(fraction * fill);
|
||||
|
||||
totalGiven += (given - con.transferFluid(type, given));
|
||||
totalGiven += (given - con.transferFluid(type, pressure, given));
|
||||
}
|
||||
|
||||
if(trackingInstances != null) {
|
||||
|
||||
@ -910,7 +910,6 @@ public class ModBlocks {
|
||||
public static Block field_disturber;
|
||||
|
||||
public static Block machine_rtg_grey;
|
||||
public static Block machine_rtg_cyan;
|
||||
public static Block machine_amgen;
|
||||
public static Block machine_geo;
|
||||
public static Block machine_minirtg;
|
||||
@ -1859,20 +1858,13 @@ public class ModBlocks {
|
||||
machine_shredder = new MachineShredder(Material.iron).setBlockName("machine_shredder").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
machine_shredder_large = new MachineShredderLarge(Material.iron).setBlockName("machine_shredder_large").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":code");
|
||||
|
||||
machine_combine_factory = new MachineCMBFactory(Material.iron).setBlockName("machine_combine_factory").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
machine_combine_factory = new MachineCMBFactory(Material.iron).setBlockName("machine_combine_factory").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null);
|
||||
|
||||
machine_teleporter = new MachineTeleporter(Material.iron).setBlockName("machine_teleporter").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
teleanchor = new MachineTeleanchor().setBlockName("teleanchor").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
field_disturber = new MachineFieldDisturber().setBlockName("field_disturber").setHardness(5.0F).setResistance(200.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":field_disturber");
|
||||
|
||||
machine_rtg_grey = new MachineRTG(Material.iron).setBlockName("machine_rtg_grey").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rtg");
|
||||
//machine_rtg_red = new MachineRTG(Material.iron).setBlockName("machine_rtg_red").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
//machine_rtg_orange = new MachineRTG(Material.iron).setBlockName("machine_rtg_orange").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
//machine_rtg_yellow = new MachineRTG(Material.iron).setBlockName("machine_rtg_yellow").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
//machine_rtg_green = new MachineRTG(Material.iron).setBlockName("machine_rtg_green").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
machine_rtg_cyan = new MachineRTG(Material.iron).setBlockName("machine_rtg_cyan").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
//machine_rtg_blue = new MachineRTG(Material.iron).setBlockName("machine_rtg_blue").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
//machine_rtg_purple = new MachineRTG(Material.iron).setBlockName("machine_rtg_purple").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
machine_amgen = new MachineAmgen(Material.iron).setBlockName("machine_amgen").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
machine_geo = new MachineAmgen(Material.iron).setBlockName("machine_geo").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
machine_minirtg = new MachineMiniRTG(Material.iron).setBlockName("machine_minirtg").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rtg_cell");
|
||||
|
||||
112
src/main/java/com/hbm/commands/CommandDebugChunkLoad.java
Normal file
112
src/main/java/com/hbm/commands/CommandDebugChunkLoad.java
Normal file
@ -0,0 +1,112 @@
|
||||
package com.hbm.commands;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraft.world.chunk.storage.AnvilChunkLoader;
|
||||
import net.minecraft.world.chunk.storage.IChunkLoader;
|
||||
import net.minecraft.world.gen.ChunkProviderServer;
|
||||
|
||||
public class CommandDebugChunkLoad extends CommandBase {
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return "ntmloadchunk";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandUsage(ICommandSender sender) {
|
||||
return "/ntmloadchunk <x> <z>";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender sender, String[] args) {
|
||||
|
||||
if(args.length != 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
int x = this.parseInt(sender, args[0]);
|
||||
int z = this.parseInt(sender, args[1]);
|
||||
|
||||
IChunkProvider prov = sender.getEntityWorld().getChunkProvider();
|
||||
if(prov instanceof ChunkProviderServer) {
|
||||
ChunkProviderServer serv = (ChunkProviderServer) prov;
|
||||
IChunkLoader loader = serv.currentChunkLoader;
|
||||
|
||||
if(loader instanceof AnvilChunkLoader) {
|
||||
AnvilChunkLoader anvil = (AnvilChunkLoader) loader;
|
||||
|
||||
try {
|
||||
int cX = x >> 4;
|
||||
int cZ = z >> 4;
|
||||
|
||||
if(prov.chunkExists(cX, cZ)) {
|
||||
Chunk chunk = sender.getEntityWorld().getChunkFromChunkCoords(cX, cZ);
|
||||
if(chunk.isChunkLoaded) {
|
||||
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Chunk currently loaded."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Object[] data = anvil.loadChunk__Async(sender.getEntityWorld(), cX, cZ);
|
||||
Chunk chunk = (Chunk) data[0];
|
||||
NBTTagCompound nbt = (NBTTagCompound) data[1];
|
||||
NBTTagCompound level = nbt.getCompoundTag("Level");
|
||||
NBTTagList tagList = level.getTagList("TileEntities", 10);
|
||||
|
||||
if(tagList != null) {
|
||||
|
||||
if(tagList.tagCount() <= 0) {
|
||||
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Tag list empty"));
|
||||
}
|
||||
|
||||
for(int i1 = 0; i1 < tagList.tagCount(); ++i1) {
|
||||
NBTTagCompound tileCompound = tagList.getCompoundTagAt(i1);
|
||||
int tX = tileCompound.getInteger("x");
|
||||
int tY = tileCompound.getInteger("y");
|
||||
int tZ = tileCompound.getInteger("z");
|
||||
String name = tileCompound.getString("id");
|
||||
|
||||
int i = tX - cX * 16;
|
||||
int j = tY;
|
||||
int k = tZ - cZ * 16;
|
||||
|
||||
EnumChatFormatting color = EnumChatFormatting.GREEN;
|
||||
|
||||
if(i < 0 || i > 15 || j < 0 || j > 255 || k < 0 || k > 15) {
|
||||
color = EnumChatFormatting.RED;
|
||||
}
|
||||
|
||||
sender.addChatMessage(new ChatComponentText(color + name + " " + i + " " + j + " " + k));
|
||||
|
||||
if(i < 0 || i > 15 || j < 0 || j > 255 || k < 0 || k > 15) {
|
||||
tileCompound.setString("id", "INVALID_POS_" + name);
|
||||
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
nbttagcompound.setTag("Level", nbttagcompound1);
|
||||
// anvil.writeChunkToNBT(chunk, sender.getEntityWorld(), nbttagcompound1);
|
||||
// anvil.addChunkToPending(chunk.getChunkCoordIntPair(), nbttagcompound);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Tag list null"));
|
||||
}
|
||||
|
||||
} catch(Exception e) {
|
||||
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "" + e.getLocalizedMessage()));
|
||||
}
|
||||
} else {
|
||||
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Not AnvilChunkLoader"));
|
||||
}
|
||||
} else {
|
||||
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Not ChunkProviderServer"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -110,7 +110,7 @@ public class EntityMappings {
|
||||
addEntity(EntityTSmokeFX.class, "entity_t_smoke_fx", 1000);
|
||||
addEntity(EntityNukeExplosionMK3.class, "entity_nuke_mk3", 1000);
|
||||
addEntity(EntityVortex.class, "entity_vortex", 250);
|
||||
addEntity(EntityMeteor.class, "entity_meteor", 1000);
|
||||
addEntity(EntityMeteor.class, "entity_meteor", 250);
|
||||
addEntity(EntityLaser.class, "entity_laser", 1000);
|
||||
addEntity(EntityBoxcar.class, "entity_boxcar", 1000);
|
||||
addEntity(EntityMissileTaint.class, "entity_missile_taint", 1000);
|
||||
|
||||
@ -74,7 +74,7 @@ public class EntityMeteor extends Entity {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isInRangeToRenderDist(double distance) {
|
||||
return distance < 500000;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -9,13 +9,15 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class EntityRailCarBase extends Entity {
|
||||
|
||||
|
||||
public boolean isOnRail = true;
|
||||
private int turnProgress;
|
||||
private double trainX;
|
||||
@ -27,6 +29,9 @@ public abstract class EntityRailCarBase extends Entity {
|
||||
@SideOnly(Side.CLIENT) private double velocityX;
|
||||
@SideOnly(Side.CLIENT) private double velocityY;
|
||||
@SideOnly(Side.CLIENT) private double velocityZ;
|
||||
|
||||
public boolean initDummies = false;
|
||||
public BoundingBoxDummyEntity[] dummies = new BoundingBoxDummyEntity[0];
|
||||
|
||||
public EntityRailCarBase(World world) {
|
||||
super(world);
|
||||
@ -36,7 +41,7 @@ public abstract class EntityRailCarBase extends Entity {
|
||||
@Override protected void readEntityFromNBT(NBTTagCompound nbt) { }
|
||||
@Override protected void writeEntityToNBT(NBTTagCompound nbt) { }
|
||||
|
||||
@Override
|
||||
/*@Override
|
||||
public boolean canBePushed() {
|
||||
return true;
|
||||
}
|
||||
@ -44,7 +49,7 @@ public abstract class EntityRailCarBase extends Entity {
|
||||
@Override
|
||||
public boolean canBeCollidedWith() {
|
||||
return !this.isDead;
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
@ -68,6 +73,27 @@ public abstract class EntityRailCarBase extends Entity {
|
||||
}
|
||||
} else {
|
||||
|
||||
DummyConfig[] definitions = this.getDummies();
|
||||
|
||||
if(!this.initDummies) {
|
||||
this.dummies = new BoundingBoxDummyEntity[definitions.length];
|
||||
|
||||
for(int i = 0; i < definitions.length; i++) {
|
||||
DummyConfig def = definitions[i];
|
||||
BoundingBoxDummyEntity dummy = new BoundingBoxDummyEntity(worldObj, this, def.width, def.height);
|
||||
Vec3 rot = Vec3.createVectorHelper(def.offset.xCoord, def.offset.yCoord, def.offset.zCoord);
|
||||
rot.rotateAroundY((float) (-this.rotationYaw * Math.PI / 180));
|
||||
double x = posX + rot.xCoord;
|
||||
double y = posY + rot.yCoord;
|
||||
double z = posZ + rot.zCoord;
|
||||
dummy.setPosition(x, y, z);
|
||||
worldObj.spawnEntityInWorld(dummy);
|
||||
this.dummies[i] = dummy;
|
||||
}
|
||||
|
||||
this.initDummies = true;
|
||||
}
|
||||
|
||||
BlockPos anchor = this.getCurentAnchorPos();
|
||||
Vec3 corePos = getRelPosAlongRail(anchor, this.getCurrentSpeed());
|
||||
|
||||
@ -81,6 +107,7 @@ public abstract class EntityRailCarBase extends Entity {
|
||||
|
||||
if(frontPos == null || backPos == null) {
|
||||
this.derail();
|
||||
return;
|
||||
} else {
|
||||
this.prevRotationYaw = this.rotationYaw;
|
||||
this.rotationYaw = this.movementYaw = generateYaw(frontPos, backPos);
|
||||
@ -88,6 +115,18 @@ public abstract class EntityRailCarBase extends Entity {
|
||||
this.velocityChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < definitions.length; i++) {
|
||||
DummyConfig def = definitions[i];
|
||||
BoundingBoxDummyEntity dummy = dummies[i];
|
||||
Vec3 rot = Vec3.createVectorHelper(def.offset.xCoord, def.offset.yCoord, def.offset.zCoord);
|
||||
rot.rotateAroundY((float) (-this.rotationYaw * Math.PI / 180));
|
||||
double x = posX + rot.xCoord;
|
||||
double y = posY + rot.yCoord;
|
||||
double z = posZ + rot.zCoord;
|
||||
dummy.setSize(def.width, def.height); // TEMP
|
||||
dummy.setPosition(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -199,11 +238,85 @@ public abstract class EntityRailCarBase extends Entity {
|
||||
|
||||
/** Invisible entities that make up the dynamic bounding structure of the train, moving as the train rotates. */
|
||||
public static class BoundingBoxDummyEntity extends Entity {
|
||||
public BoundingBoxDummyEntity(World world) { this(world, 1F, 1F); }
|
||||
public BoundingBoxDummyEntity(World world, float width, float height) { super(world); this.setSize(width, height);}
|
||||
@Override protected void entityInit() { }
|
||||
|
||||
private int turnProgress;
|
||||
private double trainX;
|
||||
private double trainY;
|
||||
private double trainZ;
|
||||
public EntityRailCarBase train;
|
||||
|
||||
public BoundingBoxDummyEntity(World world) { this(world, null, 1F, 1F); }
|
||||
public BoundingBoxDummyEntity(World world, EntityRailCarBase train, float width, float height) {
|
||||
super(world);
|
||||
this.setSize(width, height);
|
||||
this.train = train;
|
||||
if(train != null) this.dataWatcher.updateObject(3, train.getEntityId());
|
||||
}
|
||||
|
||||
@Override protected void setSize(float width, float height) {
|
||||
super.setSize(width, height);
|
||||
this.dataWatcher.updateObject(4, width);
|
||||
this.dataWatcher.updateObject(5, height);
|
||||
}
|
||||
|
||||
@Override protected void entityInit() {
|
||||
this.dataWatcher.addObject(3, new Integer(0));
|
||||
this.dataWatcher.addObject(4, new Float(1F));
|
||||
this.dataWatcher.addObject(5, new Float(1F));
|
||||
}
|
||||
|
||||
@Override protected void writeEntityToNBT(NBTTagCompound nbt) { }
|
||||
@Override public boolean writeToNBTOptional(NBTTagCompound nbt) { return false; }
|
||||
@Override public void readEntityFromNBT(NBTTagCompound nbt) { this.setDead(); }
|
||||
@Override public boolean canBePushed() { return true; }
|
||||
@Override public boolean canBeCollidedWith() { return !this.isDead; }
|
||||
|
||||
@Override public boolean attackEntityFrom(DamageSource source, float amount) { if(train != null) return train.attackEntityFrom(source, amount); return super.attackEntityFrom(source, amount); }
|
||||
@Override public boolean interactFirst(EntityPlayer player) { if(train != null) return train.interactFirst(player); return super.interactFirst(player); }
|
||||
|
||||
@Override public void onUpdate() {
|
||||
if(!worldObj.isRemote) {
|
||||
if(this.train == null || this.train.isDead) {
|
||||
this.setDead();
|
||||
}
|
||||
} else {
|
||||
|
||||
if(this.turnProgress > 0) {
|
||||
this.prevRotationYaw = this.rotationYaw;
|
||||
double x = this.posX + (this.trainX - this.posX) / (double) this.turnProgress;
|
||||
double y = this.posY + (this.trainY - this.posY) / (double) this.turnProgress;
|
||||
double z = this.posZ + (this.trainZ - this.posZ) / (double) this.turnProgress;
|
||||
--this.turnProgress;
|
||||
this.setPosition(x, y, z);
|
||||
} else {
|
||||
this.setPosition(this.posX, this.posY, this.posZ);
|
||||
}
|
||||
|
||||
this.setSize(this.dataWatcher.getWatchableObjectFloat(4), this.dataWatcher.getWatchableObjectFloat(5));
|
||||
}
|
||||
}
|
||||
|
||||
@Override @SideOnly(Side.CLIENT) public void setPositionAndRotation2(double posX, double posY, double posZ, float yaw, float pitch, int turnProg) {
|
||||
this.trainX = posX;
|
||||
this.trainY = posY;
|
||||
this.trainZ = posZ;
|
||||
this.turnProgress = turnProg + 2;
|
||||
}
|
||||
}
|
||||
|
||||
public DummyConfig[] getDummies() {
|
||||
return new DummyConfig[0];
|
||||
}
|
||||
|
||||
public static class DummyConfig {
|
||||
public Vec3 offset;
|
||||
public float width;
|
||||
public float height;
|
||||
|
||||
public DummyConfig(float width, float height, Vec3 offset) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.offset = offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,13 @@
|
||||
package com.hbm.entity.train;
|
||||
|
||||
import com.hbm.util.BobMathUtil;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@ -32,9 +37,13 @@ public abstract class EntityRailCarRidable extends EntityRailCarCargo {
|
||||
|
||||
seat.rotateAroundY((float) (-this.rotationYaw * Math.PI / 180));
|
||||
double x = posX + seat.xCoord;
|
||||
double y = posY + seat.yCoord;
|
||||
double z = posZ + seat.zCoord;
|
||||
double dist = Vec3.createVectorHelper(player.posX - x, player.posY - y, player.posZ - z).lengthVector();
|
||||
|
||||
double deltaX = player.posX - x;
|
||||
double deltaZ = player.posZ - z;
|
||||
double radians = -Math.atan2(deltaX, deltaZ);
|
||||
double degrees = MathHelper.wrapAngleTo180_double(radians * 180D / Math.PI - 90);
|
||||
double dist = Math.abs(BobMathUtil.angularDifference(degrees, player.rotationYaw));
|
||||
|
||||
if(dist < nearestDist) {
|
||||
nearestDist = dist;
|
||||
@ -46,9 +55,13 @@ public abstract class EntityRailCarRidable extends EntityRailCarCargo {
|
||||
Vec3 seat = getRiderSeatPosition();
|
||||
seat.rotateAroundY((float) (-this.rotationYaw * Math.PI / 180));
|
||||
double x = posX + seat.xCoord;
|
||||
double y = posY + seat.yCoord;
|
||||
double z = posZ + seat.zCoord;
|
||||
double dist = Vec3.createVectorHelper(player.posX - x, player.posY - y, player.posZ - z).lengthVector();
|
||||
|
||||
double deltaX = player.posX - x;
|
||||
double deltaZ = player.posZ - z;
|
||||
double radians = -Math.atan2(deltaX, deltaZ);
|
||||
double degrees = MathHelper.wrapAngleTo180_double(radians * 180D / Math.PI - 90);
|
||||
double dist = Math.abs(BobMathUtil.angularDifference(degrees, player.rotationYaw));
|
||||
|
||||
if(dist < nearestDist) {
|
||||
nearestDist = dist;
|
||||
@ -56,12 +69,12 @@ public abstract class EntityRailCarRidable extends EntityRailCarCargo {
|
||||
}
|
||||
}
|
||||
|
||||
if(nearestDist > 20) return true;
|
||||
if(nearestDist > 180) return true;
|
||||
|
||||
if(nearestSeat == -1) {
|
||||
player.mountEntity(this);
|
||||
} else {
|
||||
SeatDummyEntity dummySeat = new SeatDummyEntity(worldObj);
|
||||
SeatDummyEntity dummySeat = new SeatDummyEntity(worldObj, this);
|
||||
Vec3 passengerSeat = this.getPassengerSeats()[nearestSeat];
|
||||
passengerSeat.rotateAroundY((float) (-this.rotationYaw * Math.PI / 180));
|
||||
double x = posX + passengerSeat.xCoord;
|
||||
@ -97,7 +110,6 @@ public abstract class EntityRailCarRidable extends EntityRailCarCargo {
|
||||
double y = posY + rot.yCoord;
|
||||
double z = posZ + rot.zCoord;
|
||||
seat.setPosition(x, y - 1, z);
|
||||
seat.updateRiderPosition();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -122,11 +134,51 @@ public abstract class EntityRailCarRidable extends EntityRailCarCargo {
|
||||
|
||||
/** Dynamic seats generated when a player clicks near a seat-spot, moves and rotates with the train as one would expect. */
|
||||
public static class SeatDummyEntity extends Entity {
|
||||
|
||||
private int turnProgress;
|
||||
private double trainX;
|
||||
private double trainY;
|
||||
private double trainZ;
|
||||
public EntityRailCarBase train;
|
||||
|
||||
public SeatDummyEntity(World world) { super(world); this.setSize(0.5F, 0.1F);}
|
||||
@Override protected void entityInit() { }
|
||||
public SeatDummyEntity(World world, EntityRailCarBase train) {
|
||||
this(world);
|
||||
this.train = train;
|
||||
if(train != null) this.dataWatcher.updateObject(3, train.getEntityId());
|
||||
}
|
||||
|
||||
@Override protected void entityInit() { this.dataWatcher.addObject(3, new Integer(0)); }
|
||||
@Override protected void writeEntityToNBT(NBTTagCompound nbt) { }
|
||||
@Override public boolean writeToNBTOptional(NBTTagCompound nbt) { return false; }
|
||||
@Override public void readEntityFromNBT(NBTTagCompound nbt) { this.setDead(); }
|
||||
|
||||
@Override public void onUpdate() {
|
||||
if(!worldObj.isRemote) {
|
||||
if(this.train == null || this.train.isDead) {
|
||||
this.setDead();
|
||||
}
|
||||
} else {
|
||||
|
||||
if(this.turnProgress > 0) {
|
||||
this.prevRotationYaw = this.rotationYaw;
|
||||
double x = this.posX + (this.trainX - this.posX) / (double) this.turnProgress;
|
||||
double y = this.posY + (this.trainY - this.posY) / (double) this.turnProgress;
|
||||
double z = this.posZ + (this.trainZ - this.posZ) / (double) this.turnProgress;
|
||||
--this.turnProgress;
|
||||
this.setPosition(x, y, z);
|
||||
} else {
|
||||
this.setPosition(this.posX, this.posY, this.posZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override @SideOnly(Side.CLIENT) public void setPositionAndRotation2(double posX, double posY, double posZ, float yaw, float pitch, int turnProg) {
|
||||
this.trainX = posX;
|
||||
this.trainY = posY;
|
||||
this.trainZ = posZ;
|
||||
this.turnProgress = turnProg + 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRiderPosition() {
|
||||
|
||||
@ -30,7 +30,7 @@ public class TrainCargoTram extends EntityRailCarRidable implements IGUIProvider
|
||||
|
||||
public TrainCargoTram(World world) {
|
||||
super(world);
|
||||
this.setSize(2F, 1F);
|
||||
this.setSize(5F, 2F);
|
||||
}
|
||||
|
||||
public double speed = 0;
|
||||
@ -78,7 +78,16 @@ public class TrainCargoTram extends EntityRailCarRidable implements IGUIProvider
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_) {
|
||||
public DummyConfig[] getDummies() {
|
||||
return new DummyConfig[] {
|
||||
new DummyConfig(2F, 1F, Vec3.createVectorHelper(0, 0, 1.5)),
|
||||
new DummyConfig(2F, 1F, Vec3.createVectorHelper(0, 0, 0)),
|
||||
new DummyConfig(2F, 1F, Vec3.createVectorHelper(0, 0, -1.5))
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityFrom(DamageSource source, float amount) {
|
||||
if(!this.worldObj.isRemote && !this.isDead) {
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
@ -1,132 +0,0 @@
|
||||
package com.hbm.handler.nei;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.hbm.inventory.gui.GUIMachineCMBFactory;
|
||||
import com.hbm.inventory.recipes.MachineRecipes;
|
||||
import com.hbm.lib.RefStrings;
|
||||
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class CMBFurnaceRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
public LinkedList<RecipeTransferRect> transferRectsRec = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<RecipeTransferRect> transferRectsGui = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<Class<? extends GuiContainer>> guiRec = new LinkedList<Class<? extends GuiContainer>>();
|
||||
public LinkedList<Class<? extends GuiContainer>> guiGui = new LinkedList<Class<? extends GuiContainer>>();
|
||||
|
||||
public class SmeltingSet extends TemplateRecipeHandler.CachedRecipe
|
||||
{
|
||||
PositionedStack input1;
|
||||
PositionedStack input2;
|
||||
PositionedStack result;
|
||||
|
||||
public SmeltingSet(ItemStack input1, ItemStack input2, ItemStack result) {
|
||||
input1.stackSize = 1;
|
||||
input2.stackSize = 1;
|
||||
this.input1 = new PositionedStack(input1, 66, 6);
|
||||
this.input2 = new PositionedStack(input2, 66, 42);
|
||||
this.result = new PositionedStack(result, 129, 24);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return getCycledIngredients(cycleticks / 48, Arrays.asList(new PositionedStack[] {input1, input2}));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return "CMB Steel Furnace";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return RefStrings.MODID + ":textures/gui/nei/gui_nei_cmb.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if ((outputId.equals("cmbsmelting")) && getClass() == CMBFurnaceRecipeHandler.class) {
|
||||
Map<Object[], Object> recipes = MachineRecipes.instance().getCMBRecipes();
|
||||
for (Map.Entry<Object[], Object> recipe : recipes.entrySet()) {
|
||||
this.arecipes.add(new SmeltingSet((ItemStack)recipe.getKey()[0], (ItemStack)recipe.getKey()[1], (ItemStack)recipe.getValue()));
|
||||
}
|
||||
} else {
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
Map<Object[], Object> recipes = MachineRecipes.instance().getCMBRecipes();
|
||||
for (Map.Entry<Object[], Object> recipe : recipes.entrySet()) {
|
||||
if (NEIServerUtils.areStacksSameType((ItemStack)recipe.getValue(), result))
|
||||
this.arecipes.add(new SmeltingSet((ItemStack)recipe.getKey()[0], (ItemStack)recipe.getKey()[1], (ItemStack)recipe.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(String inputId, Object... ingredients) {
|
||||
if ((inputId.equals("cmbsmelting")) && getClass() == CMBFurnaceRecipeHandler.class) {
|
||||
loadCraftingRecipes("cmbsmelting", new Object[0]);
|
||||
} else {
|
||||
super.loadUsageRecipes(inputId, ingredients);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
Map<Object[], Object> recipes = MachineRecipes.instance().getCMBRecipes();
|
||||
for (Map.Entry<Object[], Object> recipe : recipes.entrySet()) {
|
||||
if (NEIServerUtils.areStacksSameType(ingredient, (ItemStack)recipe.getKey()[0]) || NEIServerUtils.areStacksSameType(ingredient, (ItemStack)recipe.getKey()[1]))
|
||||
this.arecipes.add(new SmeltingSet((ItemStack)recipe.getKey()[0], (ItemStack)recipe.getKey()[1], (ItemStack)recipe.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass() {
|
||||
//return GUITestDiFurnace.class;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
transferRectsGui = new LinkedList<RecipeTransferRect>();
|
||||
guiGui = new LinkedList<Class<? extends GuiContainer>>();
|
||||
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(74 + 6 + 18, 23, 24, 18), "cmbsmelting"));
|
||||
transferRectsGui.add(new RecipeTransferRect(new Rectangle(74 + 6 + 18, 23, 24, 18), "cmbsmelting"));
|
||||
guiGui.add(GUIMachineCMBFactory.class);
|
||||
RecipeTransferRectHandler.registerRectsToGuis(getRecipeTransferRectGuis(), transferRects);
|
||||
RecipeTransferRectHandler.registerRectsToGuis(guiGui, transferRectsGui);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int recipe) {
|
||||
|
||||
drawProgressBar(83 - (18 * 4) - 9 + 1, 6, 36, 86, 16, 18 * 3 - 2, 480, 7);
|
||||
drawProgressBar(83 - (18 * 4) - 9 + 1 + 18, 6, 36 + 48, 86, 16, 18 * 3 - 2, 480, 7);
|
||||
|
||||
drawProgressBar(83 - 3 + 16, 5 + 18, 100, 118, 24, 16, 48, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TemplateRecipeHandler newInstance() {
|
||||
return super.newInstance();
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,6 +1,9 @@
|
||||
package com.hbm.handler.nei;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.inventory.gui.GUIMachineCoker;
|
||||
import com.hbm.inventory.recipes.CokerRecipes;
|
||||
|
||||
public class CokingHandler extends NEIUniversalHandler {
|
||||
@ -13,4 +16,12 @@ public class CokingHandler extends NEIUniversalHandler {
|
||||
public String getKey() {
|
||||
return "ntmCoking";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
super.loadTransferRects();
|
||||
transferRectsGui.add(new RecipeTransferRect(new Rectangle(55, 15, 36, 18), "ntmCoking"));
|
||||
guiGui.add(GUIMachineCoker.class);
|
||||
RecipeTransferRectHandler.registerRectsToGuis(guiGui, transferRectsGui);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
package com.hbm.handler.nei;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.inventory.gui.GUIFurnaceCombo;
|
||||
import com.hbm.inventory.recipes.CombinationRecipes;
|
||||
|
||||
public class CombinationHandler extends NEIUniversalHandler {
|
||||
@ -13,4 +16,12 @@ public class CombinationHandler extends NEIUniversalHandler {
|
||||
public String getKey() {
|
||||
return "ntmCombination";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
super.loadTransferRects();
|
||||
transferRectsGui.add(new RecipeTransferRect(new Rectangle(49, 44, 18, 18), "ntmCombination"));
|
||||
guiGui.add(GUIFurnaceCombo.class);
|
||||
RecipeTransferRectHandler.registerRectsToGuis(guiGui, transferRectsGui);
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,6 +19,7 @@ import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public class FluidTank {
|
||||
|
||||
@ -34,12 +35,18 @@ public class FluidTank {
|
||||
int fluid;
|
||||
int maxFluid;
|
||||
public int index = 0;
|
||||
int pressure = 0;
|
||||
|
||||
public FluidTank(FluidType type, int maxFluid) {
|
||||
this.type = type;
|
||||
this.maxFluid = maxFluid;
|
||||
}
|
||||
|
||||
public FluidTank withPressure(int pressure) {
|
||||
this.pressure = pressure;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Deprecated // indices are no longer needed
|
||||
public FluidTank(FluidType type, int maxFluid, int index) {
|
||||
this.type = type;
|
||||
@ -76,6 +83,10 @@ public class FluidTank {
|
||||
return maxFluid;
|
||||
}
|
||||
|
||||
public int getPressure() {
|
||||
return pressure;
|
||||
}
|
||||
|
||||
public int changeTankSize(int size) {
|
||||
maxFluid = size;
|
||||
|
||||
@ -108,6 +119,8 @@ public class FluidTank {
|
||||
if(slots[in] == null)
|
||||
return false;
|
||||
|
||||
if(this.pressure != 0) return false; //for now, canisters can only be loaded from high-pressure tanks, not unloaded
|
||||
|
||||
int prev = this.getFill();
|
||||
|
||||
for(FluidLoadingHandler handler : loadingHandlers) {
|
||||
@ -223,6 +236,10 @@ public class FluidTank {
|
||||
list.add(I18n.format(this.type.getUnlocalizedName()));
|
||||
list.add(fluid + "/" + maxFluid + "mB");
|
||||
|
||||
if(this.pressure != 0) {
|
||||
list.add(EnumChatFormatting.RED + "" + this.pressure + "mB/l");
|
||||
}
|
||||
|
||||
type.addInfo(list);
|
||||
gui.drawInfo(list.toArray(new String[0]), mouseX, mouseY);
|
||||
}
|
||||
@ -233,6 +250,7 @@ public class FluidTank {
|
||||
nbt.setInteger(s, fluid);
|
||||
nbt.setInteger(s + "_max", maxFluid);
|
||||
nbt.setInteger(s + "_type", type.getID());
|
||||
nbt.setShort(s + "_p", (short) pressure);
|
||||
}
|
||||
|
||||
//Called by TE to load fillstate
|
||||
@ -245,6 +263,8 @@ public class FluidTank {
|
||||
type = Fluids.fromName(nbt.getString(s + "_type")); //compat
|
||||
if(type == Fluids.NONE)
|
||||
type = Fluids.fromID(nbt.getInteger(s + "_type"));
|
||||
|
||||
this.pressure = nbt.getShort(s + "_p");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -61,6 +61,7 @@ import com.hbm.entity.mob.siege.*;
|
||||
import com.hbm.entity.particle.*;
|
||||
import com.hbm.entity.projectile.*;
|
||||
import com.hbm.entity.train.*;
|
||||
import com.hbm.entity.train.EntityRailCarBase.BoundingBoxDummyEntity;
|
||||
import com.hbm.entity.train.EntityRailCarRidable.SeatDummyEntity;
|
||||
import com.hbm.handler.CasingEjector;
|
||||
import com.hbm.handler.HbmKeybinds;
|
||||
@ -685,6 +686,7 @@ public class ClientProxy extends ServerProxy {
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityMagnusCartus.class, new RenderMagnusCartus());
|
||||
//trains
|
||||
RenderingRegistry.registerEntityRenderingHandler(SeatDummyEntity.class, new RenderEmpty());
|
||||
RenderingRegistry.registerEntityRenderingHandler(BoundingBoxDummyEntity.class, new RenderEmpty());
|
||||
RenderingRegistry.registerEntityRenderingHandler(TrainCargoTram.class, new RenderTrainCargoTram());
|
||||
//items
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityMovingItem.class, new RenderMovingItem());
|
||||
|
||||
@ -47,6 +47,7 @@ import com.hbm.blocks.BlockEnums.EnumStoneType;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.generic.BlockMotherOfAllOres;
|
||||
import com.hbm.blocks.generic.BlockToolConversion;
|
||||
import com.hbm.commands.CommandDebugChunkLoad;
|
||||
import com.hbm.commands.CommandReloadRecipes;
|
||||
import com.hbm.config.*;
|
||||
import com.hbm.crafting.RodRecipes;
|
||||
@ -895,6 +896,7 @@ public class MainRegistry {
|
||||
RBMKDials.createDials(world);
|
||||
SiegeOrchestrator.createGameRules(world);
|
||||
event.registerServerCommand(new CommandReloadRecipes());
|
||||
event.registerServerCommand(new CommandDebugChunkLoad());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
||||
@ -32,7 +32,6 @@ public class NEIConfig implements IConfigureNEI {
|
||||
registerHandler(new CentrifugeRecipeHandler());
|
||||
registerHandler(new GasCentrifugeRecipeHandler());
|
||||
registerHandler(new BreederRecipeHandler());
|
||||
registerHandler(new CMBFurnaceRecipeHandler());
|
||||
registerHandler(new CyclotronRecipeHandler());
|
||||
registerHandler(new AssemblerRecipeHandler());
|
||||
registerHandler(new RefineryRecipeHandler());
|
||||
|
||||
@ -2,7 +2,6 @@ package com.hbm.render.entity.item;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.main.ResourceManager;
|
||||
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
|
||||
@ -427,25 +427,25 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
}
|
||||
|
||||
@Override
|
||||
public long transferFluid(FluidType type, long fluid) {
|
||||
public long transferFluid(FluidType type, int pressure, long fluid) {
|
||||
|
||||
if(!this.fluid)
|
||||
return fluid;
|
||||
|
||||
if(getTile() instanceof IFluidConnector) {
|
||||
return ((IFluidConnector)getTile()).transferFluid(type, fluid);
|
||||
return ((IFluidConnector)getTile()).transferFluid(type, pressure, fluid);
|
||||
}
|
||||
return fluid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDemand(FluidType type) {
|
||||
public long getDemand(FluidType type, int pressure) {
|
||||
|
||||
if(!this.fluid)
|
||||
return 0;
|
||||
|
||||
if(getTile() instanceof IFluidConnector) {
|
||||
return ((IFluidConnector)getTile()).getDemand(type);
|
||||
return ((IFluidConnector)getTile()).getDemand(type, pressure);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IFluidAcc
|
||||
this.sendPower(worldObj, xCoord - dir.offsetX * 11, yCoord, zCoord - dir.offsetZ * 11, dir.getOpposite());
|
||||
|
||||
for(DirPos pos : this.getConPos()) {
|
||||
this.sendFluid(tanks[1].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
|
||||
|
||||
@ -60,7 +60,7 @@ public class TileEntityCondenser extends TileEntityLoadedBase implements IFluidA
|
||||
}
|
||||
|
||||
this.subscribeToAllAround(tanks[0].getTankType(), this);
|
||||
this.sendFluidToAll(tanks[1].getTankType(), this);
|
||||
this.sendFluidToAll(tanks[1], this);
|
||||
|
||||
fillFluidInit(tanks[1].getTankType());
|
||||
|
||||
|
||||
@ -3,9 +3,7 @@ package com.hbm.tileentity.machine;
|
||||
import api.hbm.block.ILaserable;
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.fluid.IFluidStandardReceiver;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.inventory.container.ContainerCoreEmitter;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.gui.GUICoreEmitter;
|
||||
@ -35,7 +33,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import java.util.List;
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityCoreEmitter extends TileEntityMachineBase implements IEnergyUser, IFluidAcceptor, ILaserable, IFluidStandardReceiver, SimpleComponent, IGUIProvider {
|
||||
public class TileEntityCoreEmitter extends TileEntityMachineBase implements IEnergyUser, ILaserable, IFluidStandardReceiver, SimpleComponent, IGUIProvider {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 1000000000L;
|
||||
@ -198,38 +196,6 @@ public class TileEntityCoreEmitter extends TileEntityMachineBase implements IEne
|
||||
return (watts * i) / 100;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFluidFill(int i, FluidType type) {
|
||||
if(type.name().equals(tank.getTankType().name()))
|
||||
tank.setFill(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFluidFill(FluidType type) {
|
||||
if(type.name().equals(tank.getTankType().name()))
|
||||
return tank.getFill();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxFluidFill(FluidType type) {
|
||||
if(type.name().equals(tank.getTankType().name()))
|
||||
return tank.getMaxFill();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFillForSync(int fill, int index) {
|
||||
tank.setFill(fill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTypeForSync(FluidType type, int index) {
|
||||
tank.setTankType(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long i) {
|
||||
this.power = i;
|
||||
|
||||
@ -43,7 +43,7 @@ public class TileEntityDeuteriumExtractor extends TileEntityMachineBase implemen
|
||||
}
|
||||
|
||||
this.subscribeToAllAround(tanks[0].getTankType(), this);
|
||||
this.sendFluidToAll(tanks[1].getTankType(), this);
|
||||
this.sendFluidToAll(tanks[1], this);
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", power);
|
||||
|
||||
@ -20,7 +20,8 @@ public class TileEntityDeuteriumTower extends TileEntityDeuteriumExtractor {
|
||||
tanks[0] = new FluidTank(Fluids.WATER, 50000, 0);
|
||||
tanks[1] = new FluidTank(Fluids.HEAVYWATER, 5000, 1);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void updateConnections() {
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
@ -28,17 +29,19 @@ public class TileEntityDeuteriumTower extends TileEntityDeuteriumExtractor {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void subscribeToAllAround(FluidType type, World world, int x, int y, int z) {
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.trySubscribe(type, world, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
|
||||
public void sendFluidToAll(FluidType type, TileEntity te) {
|
||||
|
||||
@Override
|
||||
public void sendFluidToAll(FluidTank tank, TileEntity te) {
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.sendFluid(type, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
this.sendFluid(tank, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -62,14 +62,14 @@ public class TileEntityFurnaceCombination extends TileEntityMachineBase implemen
|
||||
|
||||
for(int y = yCoord; y <= yCoord + 1; y++) {
|
||||
for(int j = -1; j <= 1; j++) {
|
||||
if(tank.getFill() > 0) this.sendFluid(tank.getTankType(), worldObj, xCoord + dir.offsetX * 2 + rot.offsetX * j, y, zCoord + dir.offsetZ * 2 + rot.offsetZ * j, dir);
|
||||
if(tank.getFill() > 0) this.sendFluid(tank, worldObj, xCoord + dir.offsetX * 2 + rot.offsetX * j, y, zCoord + dir.offsetZ * 2 + rot.offsetZ * j, dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(int x = xCoord - 1; x <= xCoord + 1; x++) {
|
||||
for(int z = zCoord - 1; z <= zCoord + 1; z++) {
|
||||
if(tank.getFill() > 0) this.sendFluid(tank.getTankType(), worldObj, x, yCoord + 2, z, ForgeDirection.UP);
|
||||
if(tank.getFill() > 0) this.sendFluid(tank, worldObj, x, yCoord + 2, z, ForgeDirection.UP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -193,7 +193,7 @@ public class TileEntityHeatBoiler extends TileEntityLoadedBase implements IFluid
|
||||
private void sendFluid() {
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.sendFluid(tanks[1].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir().getOpposite());
|
||||
this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir().getOpposite());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ public class TileEntityHeaterHeatex extends TileEntityMachineBase implements IHe
|
||||
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());
|
||||
if(this.tanks[1].getFill() > 0) this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -156,7 +156,7 @@ public class TileEntityITER extends TileEntityMachineBase implements IEnergyUser
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
if(tanks[1].getFill() > 0) {
|
||||
this.sendFluid(tanks[1].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -91,7 +91,7 @@ public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase im
|
||||
this.consumption *= (overLevel + 1);
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.sendFluid(steam.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
this.sendFluid(steam, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
|
||||
if(steam.getFill() > 0) {
|
||||
|
||||
@ -218,7 +218,7 @@ public class TileEntityMachineBoiler extends TileEntityLoadedBase implements ISi
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.subscribeToAllAround(tanks[0].getTankType(), this);
|
||||
this.sendFluidToAll(tanks[1].getTankType(), this);
|
||||
this.sendFluidToAll(tanks[1], this);
|
||||
|
||||
age++;
|
||||
if(age >= 20)
|
||||
|
||||
@ -233,7 +233,7 @@ public class TileEntityMachineBoilerElectric extends TileEntityLoadedBase implem
|
||||
{
|
||||
this.updateConnections();
|
||||
this.subscribeToAllAround(tanks[0].getTankType(), this);
|
||||
this.sendFluidToAll(tanks[1].getTankType(), this);
|
||||
this.sendFluidToAll(tanks[1], this);
|
||||
|
||||
age++;
|
||||
if(age >= 20)
|
||||
|
||||
@ -1,15 +1,12 @@
|
||||
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.UpgradeManager;
|
||||
import com.hbm.inventory.container.ContainerChemfac;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.gui.GUIChemfac;
|
||||
@ -76,7 +73,7 @@ public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase {
|
||||
|
||||
for(DirPos pos : getConPos()) for(FluidTank tank : outTanks()) {
|
||||
if(tank.getTankType() != Fluids.NONE && tank.getFill() > 0) {
|
||||
this.sendFluid(tank.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
this.sendFluid(tank, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
|
||||
@ -217,58 +214,6 @@ public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase {
|
||||
return conPos;
|
||||
}
|
||||
|
||||
@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 this.worldObj.getTotalWorldTime() % 20 < 10;
|
||||
}
|
||||
|
||||
private HashMap<FluidType, List<IFluidAcceptor>> fluidMap = new HashMap();
|
||||
|
||||
@Override
|
||||
public List<IFluidAcceptor> getFluidList(FluidType type) {
|
||||
|
||||
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
|
||||
public int getRecipeCount() {
|
||||
return 8;
|
||||
@ -366,11 +311,6 @@ public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase {
|
||||
|
||||
return outTanks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxFluidFillForReceive(FluidType type) {
|
||||
return super.getMaxFluidFillForReceive(type);
|
||||
}
|
||||
|
||||
AxisAlignedBB bb = null;
|
||||
|
||||
|
||||
@ -111,8 +111,8 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements
|
||||
}
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
if(tanks[2].getFill() > 0) this.sendFluid(tanks[2].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
if(tanks[3].getFill() > 0) this.sendFluid(tanks[3].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
if(tanks[2].getFill() > 0) this.sendFluid(tanks[2], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
if(tanks[3].getFill() > 0) this.sendFluid(tanks[3], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
|
||||
UpgradeManager.eval(slots, 1, 3);
|
||||
|
||||
@ -34,7 +34,7 @@ import net.minecraft.util.ChunkCoordinates;
|
||||
* Tanks follow the order R1(I1, I2, O1, O2), R2(I1, I2, O1, O2) ...
|
||||
* @author hbm
|
||||
*/
|
||||
public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBase implements IEnergyUser, IFluidSource, IFluidAcceptor, IFluidUser, IGUIProvider {
|
||||
public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBase implements IEnergyUser, IFluidUser, IGUIProvider {
|
||||
|
||||
public long power;
|
||||
public int[] progress;
|
||||
@ -74,15 +74,6 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa
|
||||
loadItems(i);
|
||||
unloadItems(i);
|
||||
}
|
||||
|
||||
if(worldObj.getTotalWorldTime() % 10 == 0) {
|
||||
|
||||
for(FluidTank tank : this.outTanks()) {
|
||||
if(tank.getTankType() != Fluids.NONE && tank.getFill() > 0) {
|
||||
this.fillFluidInit(tank.getTankType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(int i = 0; i < count; i++) {
|
||||
@ -322,17 +313,7 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa
|
||||
this.power = power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFillForSync(int fill, int index) { }
|
||||
|
||||
@Override
|
||||
public void setFluidFill(int fill, FluidType type) { }
|
||||
|
||||
@Override
|
||||
public void setTypeForSync(FluidType type, int index) { }
|
||||
|
||||
@Override
|
||||
public int getFluidFill(FluidType type) {
|
||||
/*public int getFluidFill(FluidType type) {
|
||||
|
||||
int fill = 0;
|
||||
|
||||
@ -349,10 +330,9 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa
|
||||
}
|
||||
|
||||
return fill;
|
||||
}
|
||||
}*/
|
||||
|
||||
/* For input only! */
|
||||
@Override
|
||||
public int getMaxFluidFill(FluidType type) {
|
||||
|
||||
int maxFill = 0;
|
||||
@ -365,20 +345,6 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa
|
||||
|
||||
return maxFill;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFluidFillForReceive(FluidType type) {
|
||||
|
||||
int fill = 0;
|
||||
|
||||
for(FluidTank tank : inTanks()) {
|
||||
if(tank.getTankType() == type) {
|
||||
fill += tank.getFill();
|
||||
}
|
||||
}
|
||||
|
||||
return fill;
|
||||
}
|
||||
|
||||
protected List<FluidTank> inTanks() {
|
||||
|
||||
@ -394,8 +360,7 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa
|
||||
return inTanks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveFluid(int amount, FluidType type) {
|
||||
/*public void receiveFluid(int amount, FluidType type) {
|
||||
|
||||
if(amount <= 0)
|
||||
return;
|
||||
@ -431,15 +396,14 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa
|
||||
|
||||
tank.setFill(tank.getFill() + part);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public int getFluidFillForTransfer(FluidType type) {
|
||||
public int getFluidFillForTransfer(FluidType type, int pressure) {
|
||||
|
||||
int fill = 0;
|
||||
|
||||
for(FluidTank tank : outTanks()) {
|
||||
if(tank.getTankType() == type) {
|
||||
if(tank.getTankType() == type && tank.getPressure() == pressure) {
|
||||
fill += tank.getFill();
|
||||
}
|
||||
}
|
||||
@ -447,8 +411,7 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa
|
||||
return fill;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transferFluid(int amount, FluidType type) {
|
||||
public void transferFluid(int amount, FluidType type, int pressure) {
|
||||
|
||||
/*
|
||||
* this whole new fluid mumbo jumbo extra abstraction layer might just be a bandaid
|
||||
@ -462,7 +425,7 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa
|
||||
List<FluidTank> send = new ArrayList();
|
||||
|
||||
for(FluidTank tank : outTanks()) {
|
||||
if(tank.getTankType() == type) {
|
||||
if(tank.getTankType() == type && tank.getPressure() == pressure) {
|
||||
send.add(tank);
|
||||
}
|
||||
}
|
||||
@ -524,7 +487,7 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa
|
||||
}
|
||||
|
||||
@Override
|
||||
public long transferFluid(FluidType type, long fluid) {
|
||||
public long transferFluid(FluidType type, int pressure, long fluid) {
|
||||
int amount = (int) fluid;
|
||||
|
||||
if(amount <= 0)
|
||||
@ -533,7 +496,7 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa
|
||||
List<FluidTank> rec = new ArrayList();
|
||||
|
||||
for(FluidTank tank : inTanks()) {
|
||||
if(tank.getTankType() == type) {
|
||||
if(tank.getTankType() == type && tank.getPressure() == pressure) {
|
||||
rec.add(tank);
|
||||
}
|
||||
}
|
||||
@ -567,18 +530,18 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDemand(FluidType type) {
|
||||
return getMaxFluidFill(type) - getFluidFillForTransfer(type);
|
||||
public long getDemand(FluidType type, int pressure) {
|
||||
return getMaxFluidFill(type) - getFluidFillForTransfer(type, pressure);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTotalFluidForSend(FluidType type) {
|
||||
return getFluidFillForTransfer(type);
|
||||
public long getTotalFluidForSend(FluidType type, int pressure) {
|
||||
return getFluidFillForTransfer(type, pressure);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFluidForTransfer(FluidType type, long amount) {
|
||||
this.transferFluid((int) amount, type);
|
||||
public void removeFluidForTransfer(FluidType type, int pressure, long amount) {
|
||||
this.transferFluid((int) amount, type, pressure);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -173,7 +173,7 @@ public class TileEntityMachineCyclotron extends TileEntityMachineBase implements
|
||||
|
||||
private void sendFluid() {
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.sendFluid(amat.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
this.sendFluid(amat, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -72,7 +72,7 @@ public class TileEntityMachineHephaestus extends TileEntityLoadedBase implements
|
||||
|
||||
if(output.getFill() > 0) {
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.sendFluid(output.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
this.sendFluid(output, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
data.setInteger("heat", this.getTotalHeat());
|
||||
|
||||
@ -74,7 +74,7 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
|
||||
this.sendPower(worldObj, xCoord + dir.offsetX * -4, yCoord, zCoord + dir.offsetZ * -4, dir.getOpposite());
|
||||
for(DirPos pos : getConPos()) this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
for(DirPos pos : getConPos()) this.sendFluid(tanks[1].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
for(DirPos pos : getConPos()) this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
|
||||
tanks[0].setType(0, 1, slots);
|
||||
tanks[0].loadTank(2, 3, slots);
|
||||
|
||||
@ -99,10 +99,10 @@ 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);
|
||||
this.sendFluid(tank, worldObj, xCoord + 2, yCoord, zCoord, Library.POS_X);
|
||||
this.sendFluid(tank, worldObj, xCoord - 2, yCoord, zCoord, Library.NEG_X);
|
||||
this.sendFluid(tank, worldObj, xCoord, yCoord + 2, zCoord, Library.POS_Z);
|
||||
this.sendFluid(tank, worldObj, xCoord, yCoord - 2, zCoord, Library.NEG_Z);
|
||||
|
||||
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
|
||||
tank.updateTank(xCoord, yCoord, zCoord, this.worldObj.provider.dimensionId);
|
||||
|
||||
@ -100,7 +100,7 @@ public class TileEntityMachineMixer extends TileEntityMachineBase implements INB
|
||||
}
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
if(tanks[2].getFill() > 0) this.sendFluid(tanks[2].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
if(tanks[2].getFill() > 0) this.sendFluid(tanks[2], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
|
||||
@ -142,8 +142,8 @@ public class TileEntityMachineRadiolysis extends TileEntityMachineBase implement
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.sendPower(worldObj, pos.getX(), pos.getY(),pos.getZ(), pos.getDir());
|
||||
this.trySubscribe(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(tanks[2].getFill() > 0) this.sendFluid(tanks[2].getTankType(), worldObj, pos.getX(), pos.getY(),pos.getZ(), pos.getDir());
|
||||
if(tanks[1].getFill() > 0) this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(),pos.getZ(), pos.getDir());
|
||||
if(tanks[2].getFill() > 0) this.sendFluid(tanks[2], worldObj, pos.getX(), pos.getY(),pos.getZ(), pos.getDir());
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
|
||||
@ -771,7 +771,7 @@ public class TileEntityMachineReactorLarge extends TileEntityLoadedBase implemen
|
||||
if(worldObj.getBlock(xCoord + dir.offsetX * 2, yCoord, zCoord + dir.offsetZ * 2) == ModBlocks.reactor_hatch) {
|
||||
fillFluid(this.xCoord + dir.offsetX * 3, this.yCoord, this.zCoord + dir.offsetZ * 3, getTact(), type);
|
||||
for(int i = 0; i < 2; i++) this.trySubscribe(tanks[i].getTankType(), worldObj, this.xCoord + dir.offsetX * 3, this.yCoord, this.zCoord + dir.offsetZ * 3, Library.NEG_X);
|
||||
this.sendFluid(tanks[2].getTankType(), worldObj, this.xCoord + dir.offsetX * 3, this.yCoord, this.zCoord + dir.offsetZ * 3, Library.NEG_X);
|
||||
this.sendFluid(tanks[2], worldObj, this.xCoord + dir.offsetX * 3, this.yCoord, this.zCoord + dir.offsetZ * 3, Library.NEG_X);
|
||||
} else {
|
||||
for(int i = 0; i < 2; i++) this.tryUnsubscribe(tanks[i].getTankType(), worldObj, this.xCoord + dir.offsetX * 3, this.yCoord, this.zCoord + dir.offsetZ * 3);
|
||||
}
|
||||
@ -780,8 +780,8 @@ public class TileEntityMachineReactorLarge extends TileEntityLoadedBase implemen
|
||||
fillFluid(this.xCoord, this.yCoord + height + 1, this.zCoord, getTact(), type);
|
||||
fillFluid(this.xCoord, this.yCoord - depth - 1, this.zCoord, getTact(), type);
|
||||
|
||||
this.sendFluid(tanks[2].getTankType(), worldObj, this.xCoord, this.yCoord + height + 1, this.zCoord, Library.POS_Y);
|
||||
this.sendFluid(tanks[2].getTankType(), worldObj, this.xCoord, this.yCoord - depth - 1, this.zCoord, Library.NEG_Y);
|
||||
this.sendFluid(tanks[2], worldObj, this.xCoord, this.yCoord + height + 1, this.zCoord, Library.POS_Y);
|
||||
this.sendFluid(tanks[2], worldObj, this.xCoord, this.yCoord - depth - 1, this.zCoord, Library.NEG_Y);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -261,7 +261,7 @@ public class TileEntityMachineTurbine extends TileEntityLoadedBase implements IS
|
||||
if(!valid) tanks[1].setTankType(Fluids.NONE);
|
||||
if(power > maxPower) power = maxPower;
|
||||
|
||||
this.sendFluidToAll(tanks[1].getTankType(), this);
|
||||
this.sendFluidToAll(tanks[1], this);
|
||||
|
||||
tanks[1].unloadTank(5, 6, slots);
|
||||
|
||||
|
||||
@ -139,7 +139,7 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
|
||||
this.trySubscribe(tanks[2].getTankType(), worldObj, xCoord - dir.offsetX * 2 + rot.offsetX * -4, yCoord, zCoord - dir.offsetZ * 2 + rot.offsetZ * -4, dir.getOpposite());
|
||||
this.trySubscribe(tanks[2].getTankType(), worldObj, xCoord + dir.offsetX * 2 + rot.offsetX * -4, yCoord, zCoord + dir.offsetZ * 2 + rot.offsetZ * -4, dir);
|
||||
//steam
|
||||
this.sendFluid(tanks[3].getTankType(), worldObj, xCoord + dir.offsetZ * 6, yCoord + 1, zCoord - dir.offsetX * 6, rot.getOpposite());
|
||||
this.sendFluid(tanks[3], worldObj, xCoord + dir.offsetZ * 6, yCoord + 1, zCoord - dir.offsetX * 6, rot.getOpposite());
|
||||
|
||||
//if(audio != null) // audio shouldn't even exist serverside
|
||||
// audio.updatePitch((float) (0.45 + 0.05 * rpm / 10));
|
||||
|
||||
@ -168,7 +168,7 @@ public class TileEntityMachineTurbofan extends TileEntityMachineBase implements
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.sendPower(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
this.trySubscribe(tank.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
if(this.blood.getFill() > 0) this.sendFluid(blood.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
if(this.blood.getFill() > 0) this.sendFluid(blood, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
|
||||
if(burnValue > 0 && amountToBurn > 0) {
|
||||
|
||||
@ -230,7 +230,7 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IF
|
||||
}
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.sendFluid(steam.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
this.sendFluid(steam, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
|
||||
checkIfMeltdown();
|
||||
|
||||
@ -56,8 +56,8 @@ public class TileEntitySolarBoiler extends TileEntityLoadedBase implements IFlui
|
||||
water.setFill(water.getFill() - process);
|
||||
steam.setFill(steam.getFill() + process * 100);
|
||||
|
||||
this.sendFluid(steam.getTankType(), worldObj, xCoord, yCoord + 3, zCoord, Library.POS_Y);
|
||||
this.sendFluid(steam.getTankType(), worldObj, xCoord, yCoord - 1, zCoord, Library.NEG_Y);
|
||||
this.sendFluid(steam, worldObj, xCoord, yCoord + 3, zCoord, Library.POS_Y);
|
||||
this.sendFluid(steam, worldObj, xCoord, yCoord - 1, zCoord, Library.NEG_Y);
|
||||
|
||||
heat = 0;
|
||||
} else {
|
||||
|
||||
@ -120,7 +120,7 @@ public class TileEntitySteamEngine extends TileEntityLoadedBase implements IFlui
|
||||
if(this.powerBuffer > 0)
|
||||
this.sendPower(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
this.sendFluid(tanks[1].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
if(tanks[1].getFill() > 0) fillFluidInit(tanks[1].getTankType());
|
||||
|
||||
|
||||
@ -148,8 +148,8 @@ public class TileEntityStorageDrum extends TileEntityMachineBase implements IFlu
|
||||
fillFluidInit(tanks[1].getTankType());
|
||||
}
|
||||
|
||||
this.sendFluidToAll(tanks[0].getTankType(), this);
|
||||
this.sendFluidToAll(tanks[1].getTankType(), this);
|
||||
this.sendFluidToAll(tanks[0], this);
|
||||
this.sendFluidToAll(tanks[1], this);
|
||||
|
||||
tanks[0].updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
|
||||
tanks[1].updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
|
||||
|
||||
@ -68,14 +68,14 @@ public class TileEntityTowerLarge extends TileEntityCondenser {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendFluidToAll(FluidType type, TileEntity te) {
|
||||
public void sendFluidToAll(FluidTank tank, TileEntity te) {
|
||||
|
||||
for(int i = 2; i < 6; i++) {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(i);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
this.sendFluid(this.tanks[1].getTankType(), worldObj, xCoord + dir.offsetX * 5, yCoord, zCoord + dir.offsetZ * 5, dir);
|
||||
this.sendFluid(this.tanks[1].getTankType(), worldObj, xCoord + dir.offsetX * 5 + rot.offsetX * 3, yCoord, zCoord + dir.offsetZ * 5 + rot.offsetZ * 3, dir);
|
||||
this.sendFluid(this.tanks[1].getTankType(),worldObj, xCoord + dir.offsetX * 5 + rot.offsetX * -3, yCoord, zCoord + dir.offsetZ * 5 + rot.offsetZ * -3, dir);
|
||||
this.sendFluid(this.tanks[1], worldObj, xCoord + dir.offsetX * 5, yCoord, zCoord + dir.offsetZ * 5, dir);
|
||||
this.sendFluid(this.tanks[1], worldObj, xCoord + dir.offsetX * 5 + rot.offsetX * 3, yCoord, zCoord + dir.offsetZ * 5 + rot.offsetZ * 3, dir);
|
||||
this.sendFluid(this.tanks[1], worldObj, xCoord + dir.offsetX * 5 + rot.offsetX * -3, yCoord, zCoord + dir.offsetZ * 5 + rot.offsetZ * -3, dir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -53,11 +53,11 @@ public class TileEntityTowerSmall extends TileEntityCondenser {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendFluidToAll(FluidType type, TileEntity te) {
|
||||
this.sendFluid(this.tanks[1].getTankType(), worldObj, xCoord + 3, yCoord, zCoord, Library.POS_X);
|
||||
this.sendFluid(this.tanks[1].getTankType(), worldObj, xCoord - 3, yCoord, zCoord, Library.NEG_X);
|
||||
this.sendFluid(this.tanks[1].getTankType(), worldObj, xCoord, yCoord, zCoord + 3, Library.POS_Z);
|
||||
this.sendFluid(this.tanks[1].getTankType(), worldObj, xCoord, yCoord, zCoord - 3, Library.NEG_Z);
|
||||
public void sendFluidToAll(FluidTank tank, TileEntity te) {
|
||||
this.sendFluid(this.tanks[1], worldObj, xCoord + 3, yCoord, zCoord, Library.POS_X);
|
||||
this.sendFluid(this.tanks[1], worldObj, xCoord - 3, yCoord, zCoord, Library.NEG_X);
|
||||
this.sendFluid(this.tanks[1], worldObj, xCoord, yCoord, zCoord + 3, Library.POS_Z);
|
||||
this.sendFluid(this.tanks[1], worldObj, xCoord, yCoord, zCoord - 3, Library.NEG_Z);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -318,8 +318,8 @@ public class TileEntityWatz extends TileEntityMachineBase implements IFluidStand
|
||||
protected void sendOutBottom() {
|
||||
|
||||
for(DirPos pos : getSendingPos()) {
|
||||
if(tanks[1].getFill() > 0) this.sendFluid(tanks[1].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
if(tanks[2].getFill() > 0) this.sendFluid(tanks[2].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
if(tanks[1].getFill() > 0) this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
if(tanks[2].getFill() > 0) this.sendFluid(tanks[2], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -565,10 +565,10 @@ public class TileEntityWatzCore extends TileEntityLoadedBase implements ISidedIn
|
||||
this.sendPower(worldObj, xCoord, yCoord + 7, zCoord, ForgeDirection.UP);
|
||||
this.sendPower(worldObj, xCoord, yCoord - 7, zCoord, ForgeDirection.DOWN);
|
||||
|
||||
this.sendFluid(tank.getTankType(), worldObj, xCoord + 4, yCoord, zCoord, Library.POS_X);
|
||||
this.sendFluid(tank.getTankType(), worldObj, xCoord, yCoord, zCoord + 4, Library.POS_Z);
|
||||
this.sendFluid(tank.getTankType(), worldObj, xCoord - 4, yCoord, zCoord, Library.NEG_X);
|
||||
this.sendFluid(tank.getTankType(), worldObj, xCoord, yCoord, zCoord - 4, Library.NEG_Z);
|
||||
this.sendFluid(tank, worldObj, xCoord + 4, yCoord, zCoord, Library.POS_X);
|
||||
this.sendFluid(tank, worldObj, xCoord, yCoord, zCoord + 4, Library.POS_Z);
|
||||
this.sendFluid(tank, worldObj, xCoord - 4, yCoord, zCoord, Library.NEG_X);
|
||||
this.sendFluid(tank, worldObj, xCoord, yCoord, zCoord - 4, Library.NEG_Z);
|
||||
|
||||
if (age == 9 || age == 19) {
|
||||
fillFluidInit(tank.getTankType());
|
||||
|
||||
@ -49,7 +49,7 @@ public class TileEntityMachineCatalyticCracker extends TileEntityLoadedBase impl
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
for(int i = 2; i <= 4; i++) {
|
||||
if(tanks[i].getFill() > 0) this.sendFluid(tanks[i].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
if(tanks[i].getFill() > 0) this.sendFluid(tanks[i], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@ public class TileEntityMachineCatalyticReformer extends TileEntityMachineBase im
|
||||
for(DirPos pos : getConPos()) {
|
||||
for(int i = 1; i < 4; i++) {
|
||||
if(tanks[i].getFill() > 0) {
|
||||
this.sendFluid(tanks[i].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
this.sendFluid(tanks[i], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ public class TileEntityMachineCoker extends TileEntityMachineBase implements IFl
|
||||
}
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
if(this.tanks[1].getFill() > 0) this.sendFluid(tanks[1].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
if(this.tanks[1].getFill() > 0) this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
|
||||
@ -104,8 +104,8 @@ public class TileEntityMachineFractionTower extends TileEntityLoadedBase impleme
|
||||
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());
|
||||
this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
this.sendFluid(tanks[2], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -97,7 +97,7 @@ public class TileEntityMachineLiquefactor extends TileEntityMachineBase implemen
|
||||
|
||||
private void sendFluid() {
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.sendFluid(tank.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
this.sendFluid(tank, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -174,7 +174,7 @@ public class TileEntityMachineRefinery extends TileEntityMachineBase implements
|
||||
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());
|
||||
this.sendFluid(tanks[i], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ public class TileEntityMachineVacuumDistill extends TileEntityMachineBase implem
|
||||
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());
|
||||
this.sendFluid(tanks[i], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -132,8 +132,8 @@ public abstract class TileEntityOilDrillBase extends TileEntityMachineBase imple
|
||||
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(tanks[0].getFill() > 0) this.sendFluid(tanks[0], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
if(tanks[1].getFill() > 0) this.sendFluid(tanks[1], 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()) {
|
||||
|
||||
@ -95,7 +95,7 @@ public class TileEntityRBMKBoiler extends TileEntityRBMKSlottedBase implements I
|
||||
|
||||
this.trySubscribe(feed.getTankType(), worldObj, xCoord, yCoord - 1, zCoord, Library.NEG_Y);
|
||||
for(DirPos pos : getOutputPos()) {
|
||||
if(this.steam.getFill() > 0) this.sendFluid(steam.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
if(this.steam.getFill() > 0) this.sendFluid(steam, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -86,7 +86,7 @@ public class TileEntityRBMKHeater extends TileEntityRBMKSlottedBase implements I
|
||||
|
||||
this.trySubscribe(feed.getTankType(), worldObj, xCoord, yCoord - 1, zCoord, Library.NEG_Y);
|
||||
for(DirPos pos : getOutputPos()) {
|
||||
if(this.steam.getFill() > 0) this.sendFluid(steam.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
if(this.steam.getFill() > 0) this.sendFluid(steam, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ public class TileEntityRBMKOutgasser extends TileEntityRBMKSlottedBase implement
|
||||
}
|
||||
|
||||
for(DirPos pos : getOutputPos()) {
|
||||
if(this.gas.getFill() > 0) this.sendFluid(gas.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
if(this.gas.getFill() > 0) this.sendFluid(gas, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ public class TileEntityRBMKOutlet extends TileEntityLoadedBase implements IFluid
|
||||
}
|
||||
|
||||
fillFluidInit(this.steam.getTankType());
|
||||
this.sendFluidToAll(steam.getTankType(), this);
|
||||
this.sendFluidToAll(steam, this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ public class TileEntityBarrel extends TileEntityMachineBase implements IFluidAcc
|
||||
tank.updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
|
||||
|
||||
this.sendingBrake = true;
|
||||
tank.setFill(transmitFluidFairly(worldObj, tank.getTankType(), this, tank.getFill(), this.mode == 0 || this.mode == 1, this.mode == 1 || this.mode == 2, getConPos()));
|
||||
tank.setFill(transmitFluidFairly(worldObj, tank, this, tank.getFill(), this.mode == 0 || this.mode == 1, this.mode == 1 || this.mode == 2, getConPos()));
|
||||
this.sendingBrake = false;
|
||||
|
||||
age++;
|
||||
@ -106,10 +106,12 @@ public class TileEntityBarrel extends TileEntityMachineBase implements IFluidAcc
|
||||
};
|
||||
}
|
||||
|
||||
protected static int transmitFluidFairly(World world, FluidType type, IFluidConnector that, int fill, boolean connect, boolean send, DirPos[] connections) {
|
||||
protected static int transmitFluidFairly(World world, FluidTank tank, IFluidConnector that, int fill, boolean connect, boolean send, DirPos[] connections) {
|
||||
|
||||
Set<IPipeNet> nets = new HashSet();
|
||||
Set<IFluidConnector> consumers = new HashSet();
|
||||
FluidType type = tank.getTankType();
|
||||
int pressure = tank.getPressure();
|
||||
|
||||
for(DirPos pos : connections) {
|
||||
|
||||
@ -144,7 +146,7 @@ public class TileEntityBarrel extends TileEntityMachineBase implements IFluidAcc
|
||||
if(x instanceof PipeNet) PipeNet.trackingInstances.add((PipeNet) x);
|
||||
});
|
||||
|
||||
fill = (int) PipeNet.fairTransfer(con, type, fill);
|
||||
fill = (int) PipeNet.fairTransfer(con, type, pressure, fill);
|
||||
}
|
||||
|
||||
//resubscribe to buffered nets, if necessary
|
||||
|
||||
@ -107,7 +107,7 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
|
||||
age = 0;
|
||||
|
||||
this.sendingBrake = true;
|
||||
tank.setFill(TileEntityBarrel.transmitFluidFairly(worldObj, tank.getTankType(), this, tank.getFill(), this.mode == 0 || this.mode == 1, this.mode == 1 || this.mode == 2, getConPos()));
|
||||
tank.setFill(TileEntityBarrel.transmitFluidFairly(worldObj, tank, this, tank.getFill(), this.mode == 0 || this.mode == 1, this.mode == 1 || this.mode == 2, getConPos()));
|
||||
this.sendingBrake = false;
|
||||
|
||||
if((mode == 1 || mode == 2) && (age == 9 || age == 19))
|
||||
@ -359,18 +359,20 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public long transferFluid(FluidType type, long fluid) {
|
||||
long toTransfer = Math.min(getDemand(type), fluid);
|
||||
public long transferFluid(FluidType type, int pressure, long fluid) {
|
||||
long toTransfer = Math.min(getDemand(type, pressure), fluid);
|
||||
tank.setFill(tank.getFill() + (int) toTransfer);
|
||||
return fluid - toTransfer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDemand(FluidType type) {
|
||||
public long getDemand(FluidType type, int pressure) {
|
||||
|
||||
if(this.mode == 2 || this.mode == 3 || this.sendingBrake)
|
||||
return 0;
|
||||
|
||||
if(tank.getPressure() != pressure) return 0;
|
||||
|
||||
return type == tank.getTankType() ? tank.getMaxFill() - tank.getFill() : 0;
|
||||
}
|
||||
|
||||
|
||||
@ -107,16 +107,16 @@ public class TileEntityPipeBaseNT extends TileEntity implements IFluidConductor
|
||||
}
|
||||
|
||||
@Override
|
||||
public long transferFluid(FluidType type, long fluid) {
|
||||
public long transferFluid(FluidType type, int pressure, long fluid) {
|
||||
|
||||
if(this.network == null)
|
||||
return fluid;
|
||||
|
||||
return this.network.transferFluid(fluid);
|
||||
return this.network.transferFluid(fluid, pressure);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDemand(FluidType type) {
|
||||
public long getDemand(FluidType type, int pressure) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.hbm.util;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.NumberFormat;
|
||||
@ -9,6 +10,7 @@ import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnegative;
|
||||
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@ -193,4 +195,15 @@ public class BobMathUtil {
|
||||
public static double squirt(double x) {
|
||||
return Math.sqrt(x + 1D / ((x + 2D) * (x + 2D))) - 1D / (x + 2D);
|
||||
}
|
||||
|
||||
/** A convenient way to re-define the value of pi, should the laws of nature change. */
|
||||
public static void setPi(double pi) {
|
||||
Field field = ReflectionHelper.findField(Math.class, "PI");
|
||||
try { field.setDouble(null, pi); } catch(Exception e) { }
|
||||
}
|
||||
|
||||
public static double angularDifference(double alpha, double beta) {
|
||||
double delta = (beta - alpha + 180) % 360 - 180;
|
||||
return delta < -180 ? delta + 360 : delta;
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,8 +11,8 @@ public class Dummies {
|
||||
public static class JarDummyConnector extends TileEntity implements IEnergyConnector, IFluidConnector {
|
||||
|
||||
@Override public boolean isLoaded() { return false; }
|
||||
@Override public long transferFluid(FluidType type, long fluid) { return 0; }
|
||||
@Override public long getDemand(FluidType type) { return 0; }
|
||||
@Override public long transferFluid(FluidType type, int pressure, long fluid) { return 0; }
|
||||
@Override public long getDemand(FluidType type, int pressure) { return 0; }
|
||||
@Override public long transferPower(long power) { return 0; }
|
||||
@Override public long getPower() { return 0; }
|
||||
@Override public long getMaxPower() { return 0; }
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.8 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 719 B After Width: | Height: | Size: 811 B |
Loading…
x
Reference in New Issue
Block a user