mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
some compat crap
This commit is contained in:
parent
fea8dd9628
commit
1c79e4b900
@ -1,6 +1,7 @@
|
||||
package api.hbm.fluid;
|
||||
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
@ -90,4 +91,11 @@ public interface IFluidUser extends IFluidConnector {
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
this.tryUnsubscribe(type, world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all internal tanks of this tile. Not used by the fluid network, it should only be used for display purposes or edge cases that can't be solved otherwise.
|
||||
* The array is either composed of the original tank or outright the original tank array, so changes done to this array will extend to the IFluidUser.
|
||||
* @return
|
||||
*/
|
||||
public FluidTank[] getAllTanks();
|
||||
}
|
||||
|
||||
@ -282,4 +282,9 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IFluidAcc
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] {tanks[0]};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return tanks;
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,4 +163,9 @@ public class TileEntityCondenser extends TileEntity implements IFluidAcceptor, I
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] {tanks [0]};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return tanks;
|
||||
}
|
||||
}
|
||||
|
||||
@ -292,7 +292,12 @@ public class TileEntityCoreEmitter extends TileEntityMachineBase implements IEne
|
||||
|
||||
@Override
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] {tank};
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
|
||||
// do some opencomputer stuff
|
||||
|
||||
@ -182,6 +182,11 @@ public class TileEntityCoreInjector extends TileEntityMachineBase implements IFl
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] {tanks[0], tanks[1]};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return tanks;
|
||||
}
|
||||
|
||||
// do some opencomputer stuff
|
||||
@Override
|
||||
|
||||
@ -178,6 +178,11 @@ public class TileEntityCoreReceiver extends TileEntityMachineBase implements IEn
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
|
||||
// do some opencomputer stuff
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
|
||||
@ -187,4 +187,9 @@ public class TileEntityDeuteriumExtractor extends TileEntityMachineBase implemen
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] { tanks[0] };
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return tanks;
|
||||
}
|
||||
}
|
||||
@ -435,8 +435,14 @@ public class TileEntityFWatzCore extends TileEntityLoadedBase implements ISidedI
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] { tanks[1], tanks[2] };
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return tanks;
|
||||
}
|
||||
}
|
||||
|
||||
@ -190,4 +190,9 @@ public class TileEntityHeaterOilburner extends TileEntityMachineBase implements
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
}
|
||||
|
||||
@ -534,4 +534,9 @@ public class TileEntityITER extends TileEntityMachineBase implements IEnergyUser
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] {tanks[0]};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return tanks;
|
||||
}
|
||||
}
|
||||
|
||||
@ -447,4 +447,9 @@ public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase im
|
||||
public int getMaxFluidFill(FluidType type) {
|
||||
return type == water.getTankType() ? water.getMaxFill() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return new FluidTank[] { water, steam };
|
||||
}
|
||||
}
|
||||
|
||||
@ -401,4 +401,9 @@ public class TileEntityMachineBoiler extends TileEntity implements ISidedInvento
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] {tanks[0]};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return tanks;
|
||||
}
|
||||
}
|
||||
|
||||
@ -423,4 +423,9 @@ public class TileEntityMachineBoilerElectric extends TileEntityLoadedBase implem
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] {tanks[0]};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return tanks;
|
||||
}
|
||||
}
|
||||
|
||||
@ -356,6 +356,11 @@ public class TileEntityMachineCMBFactory extends TileEntityLoadedBase implements
|
||||
|
||||
@Override
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] {tank};
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
}
|
||||
|
||||
@ -611,4 +611,9 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] {tanks[0], tanks[1]};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return tanks;
|
||||
}
|
||||
}
|
||||
|
||||
@ -343,4 +343,9 @@ public class TileEntityMachineCoal extends TileEntityLoadedBase implements ISide
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] {tank};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
}
|
||||
|
||||
@ -380,4 +380,9 @@ public class TileEntityMachineCrystallizer extends TileEntityMachineBase impleme
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] {tank};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
}
|
||||
|
||||
@ -536,4 +536,9 @@ public class TileEntityMachineCyclotron extends TileEntityMachineBase implements
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] { coolant };
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return new FluidTank[] { amat, coolant };
|
||||
}
|
||||
}
|
||||
|
||||
@ -236,4 +236,9 @@ public class TileEntityMachineDiesel extends TileEntityMachineBase implements IE
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] {tank};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
}
|
||||
|
||||
@ -340,6 +340,11 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
|
||||
AxisAlignedBB bb = null;
|
||||
|
||||
|
||||
@ -308,4 +308,9 @@ public class TileEntityMachineIGenerator extends TileEntityMachineBase implement
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] { tanks[0], tanks[1], tanks[2] };
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return tanks;
|
||||
}
|
||||
}
|
||||
|
||||
@ -686,4 +686,9 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen
|
||||
public FluidTank[] getSendingTanks() {
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
}
|
||||
|
||||
@ -363,4 +363,9 @@ public class TileEntityMachineTurbine extends TileEntityLoadedBase implements IS
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] { tanks[0] };
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return tanks;
|
||||
}
|
||||
}
|
||||
|
||||
@ -403,4 +403,9 @@ public class TileEntityMachineTurbofan extends TileEntityMachineBase implements
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
}
|
||||
|
||||
@ -530,6 +530,11 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IF
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] { water, carbonDioxide };
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return new FluidTank[] { water, steam, carbonDioxide };
|
||||
}
|
||||
|
||||
// do some opencomputer stuff
|
||||
@Override
|
||||
|
||||
@ -189,4 +189,9 @@ public class TileEntitySolarBoiler extends TileEntity implements IFluidAcceptor,
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] { water };
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return new FluidTank[] { water, steam };
|
||||
}
|
||||
}
|
||||
|
||||
@ -317,4 +317,9 @@ public class TileEntityStorageDrum extends TileEntityMachineBase implements IFlu
|
||||
public FluidTank[] getSendingTanks() {
|
||||
return new FluidTank[] { tanks[0], tanks[1] };
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return tanks;
|
||||
}
|
||||
}
|
||||
|
||||
@ -754,4 +754,9 @@ public class TileEntityWatzCore extends TileEntityLoadedBase implements ISidedIn
|
||||
public FluidTank[] getSendingTanks() {
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
}
|
||||
|
||||
@ -278,4 +278,9 @@ public class TileEntityMachineCatalyticCracker extends TileEntity implements IFl
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] {tanks[0], tanks[1]};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return tanks;
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,6 +121,11 @@ public class TileEntityMachineFrackingTower extends TileEntityOilDrillBase imple
|
||||
return new FluidTank[] { tanks[2] };
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return tanks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DirPos[] getConPos() {
|
||||
return new DirPos[] {
|
||||
|
||||
@ -272,4 +272,9 @@ public class TileEntityMachineFractionTower extends TileEntity implements IFluid
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] { tanks[0] };
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return tanks;
|
||||
}
|
||||
}
|
||||
|
||||
@ -273,4 +273,9 @@ public class TileEntityMachineGasFlare extends TileEntityMachineBase implements
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
}
|
||||
|
||||
@ -273,4 +273,9 @@ public class TileEntityMachineLiquefactor extends TileEntityMachineBase implemen
|
||||
public FluidTank[] getSendingTanks() {
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package com.hbm.tileentity.machine.oil;
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
|
||||
@ -358,4 +358,9 @@ public class TileEntityMachineRefinery extends TileEntityMachineBase implements
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] { tanks[0] };
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return tanks;
|
||||
}
|
||||
}
|
||||
|
||||
@ -247,4 +247,9 @@ public class TileEntityMachineSolidifier extends TileEntityMachineBase implement
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
}
|
||||
|
||||
@ -339,6 +339,11 @@ public abstract class TileEntityOilDrillBase extends TileEntityMachineBase imple
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return tanks;
|
||||
}
|
||||
|
||||
public abstract DirPos[] getConPos();
|
||||
|
||||
|
||||
@ -222,6 +222,11 @@ public class TileEntityBarrel extends TileEntityMachineBase implements IFluidAcc
|
||||
return (mode == 0 || mode == 1) ? new FluidTank[] {tank} : new FluidTank[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeNBT(NBTTagCompound nbt) {
|
||||
if(tank.getFill() == 0) return;
|
||||
|
||||
@ -209,6 +209,11 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
|
||||
return type == tank.getTankType() ? tank.getMaxFill() - tank.getFill() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeNBT(NBTTagCompound nbt) {
|
||||
if(tank.getFill() == 0) return;
|
||||
|
||||
@ -207,4 +207,9 @@ public class TileEntityTurretFritz extends TileEntityTurretBaseNT implements IFl
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
}
|
||||
|
||||
90
src/main/java/com/hbm/util/CompatExternal.java
Normal file
90
src/main/java/com/hbm/util/CompatExternal.java
Normal file
@ -0,0 +1,90 @@
|
||||
package com.hbm.util;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.tileentity.machine.TileEntityDummy;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* EXTERNAL COMPATIBILITY CLASS - DO NOT CHANGE METHOD NAMES/PARAMS ONCE CREATED
|
||||
* Is there a smarter way to do this? Most likely. Is there an easier one? Probably not.
|
||||
* @author hbm
|
||||
*/
|
||||
public class CompatExternal {
|
||||
|
||||
/**
|
||||
* Gets the tile entity at that pos. If the tile entity is an mk1 or mk2 dummy, it will return the core instead.
|
||||
* This method will be updated in the event that other multiblock systems or dummies are added to retrain the intended functionality.
|
||||
* @return the core tile entity if the given position holds a dummy, the tile entity at that position if it doesn't or null if there is no tile entity
|
||||
*/
|
||||
public static TileEntity getCoreFromPos(World world, int x, int y, int z) {
|
||||
|
||||
Block b = world.getBlock(x, y, z);
|
||||
|
||||
//if the block at that pos is a Dummyable, use the mk2's system to find the core
|
||||
if(b instanceof BlockDummyable) {
|
||||
BlockDummyable dummy = (BlockDummyable) b;
|
||||
int[] pos = dummy.findCore(world, x, y, z);
|
||||
|
||||
if(pos != null) {
|
||||
return world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
}
|
||||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
//if the tile at that pos is an old dummy tile, use mk1
|
||||
if(tile instanceof TileEntityDummy) {
|
||||
TileEntityDummy dummy = (TileEntityDummy) tile;
|
||||
return world.getTileEntity(dummy.targetX, dummy.targetY, dummy.targetZ);
|
||||
}
|
||||
|
||||
//otherwise, return the tile at that position whihc could be null
|
||||
return tile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the numeric value of the buffered energy held by that tile entity. Current implementation relies on IEnergyUser.
|
||||
* @param tile
|
||||
* @return power
|
||||
*/
|
||||
public static long getBufferedPowerFromTile(TileEntity tile) {
|
||||
|
||||
if(tile instanceof IEnergyUser) {
|
||||
return ((IEnergyUser) tile).getPower();
|
||||
}
|
||||
|
||||
return 0L;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the numeric value of the energy capacity of this tile entity. Current implementation relies on IEnergyUser.
|
||||
* @param tile
|
||||
* @return max power
|
||||
*/
|
||||
public static long getMaxPowerFromTile(TileEntity tile) {
|
||||
|
||||
if(tile instanceof IEnergyUser) {
|
||||
return ((IEnergyUser) tile).getMaxPower();
|
||||
}
|
||||
|
||||
return 0L;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ordinal of the energy priority from the supplied tile entity. 0 = low, 1 = normal, 2 = high. Returns -1 if not applicable.
|
||||
* @param tile
|
||||
* @return priority
|
||||
*/
|
||||
public static int getEnergyPriorityFromTile(TileEntity tile) {
|
||||
|
||||
if(tile instanceof IEnergyUser) {
|
||||
return ((IEnergyUser) tile).getPriority().ordinal();
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user