update image
This commit is contained in:
parent
3a6581c065
commit
759fdf458e
2 changed files with 75 additions and 62 deletions
|
@ -63,6 +63,7 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
|
|||
public long mRestRF;
|
||||
public short mOverheat;
|
||||
private boolean mCheckConnections = !GT_Mod.gregtechproxy.gt6Cable;
|
||||
private byte[] IC2RectorAtSide = new byte[]{-1,-1,-1,-1,-1};
|
||||
|
||||
public GT_MetaPipeEntity_Cable(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial, long aCableLossPerMeter, long aAmperage, long aVoltage, boolean aInsulated, boolean aCanShock) {
|
||||
super(aID, aName, aNameRegional, 0);
|
||||
|
@ -155,32 +156,34 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
|
|||
return (int) mAmperage * 64;
|
||||
}
|
||||
|
||||
private void pullFromIc2EnergySources(IGregTechTileEntity aBaseMetaTileEntity) {
|
||||
private void pullFromIc2EnergySources(IGregTechTileEntity aBaseMetaTileEntity,byte[] aSides) {
|
||||
if(!GT_Mod.gregtechproxy.ic2EnergySourceCompat) return;
|
||||
|
||||
for( byte aSide = 0 ; aSide < 6 ; aSide++) if(isConnectedAtSide(aSide)) {
|
||||
final TileEntity tTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(aSide);
|
||||
for(byte i = 0;i<aSides.length;i++) {
|
||||
final TileEntity tTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(aSides[i]);
|
||||
final TileEntity tEmitter;
|
||||
if (tTileEntity instanceof IReactorChamber)
|
||||
tEmitter = (TileEntity) ((IReactorChamber) tTileEntity).getReactor();
|
||||
else tEmitter = (tTileEntity == null || tTileEntity instanceof IEnergyTile || EnergyNet.instance == null) ? tTileEntity :
|
||||
else
|
||||
tEmitter = (tTileEntity == null || tTileEntity instanceof IEnergyTile || EnergyNet.instance == null) ? tTileEntity :
|
||||
EnergyNet.instance.getTileEntity(tTileEntity.getWorldObj(), tTileEntity.xCoord, tTileEntity.yCoord, tTileEntity.zCoord);
|
||||
|
||||
if (tEmitter instanceof IEnergySource) {
|
||||
final GT_CoverBehavior coverBehavior = aBaseMetaTileEntity.getCoverBehaviorAtSide(aSide);
|
||||
final int coverId = aBaseMetaTileEntity.getCoverIDAtSide(aSide),
|
||||
coverData = aBaseMetaTileEntity.getCoverDataAtSide(aSide);
|
||||
final ForgeDirection tDirection = ForgeDirection.getOrientation(GT_Utility.getOppositeSide(aSide));
|
||||
final GT_CoverBehavior coverBehavior = aBaseMetaTileEntity.getCoverBehaviorAtSide(aSides[i]);
|
||||
final int coverId = aBaseMetaTileEntity.getCoverIDAtSide(aSides[i]),
|
||||
coverData = aBaseMetaTileEntity.getCoverDataAtSide(aSides[i]);
|
||||
final ForgeDirection tDirection = ForgeDirection.getOrientation(GT_Utility.getOppositeSide(aSides[i]));
|
||||
|
||||
if (((IEnergySource) tEmitter).emitsEnergyTo((TileEntity) aBaseMetaTileEntity, tDirection) &&
|
||||
coverBehavior.letsEnergyIn(aSide, coverId, coverData, aBaseMetaTileEntity)) {
|
||||
coverBehavior.letsEnergyIn(aSides[i], coverId, coverData, aBaseMetaTileEntity)) {
|
||||
final long tEU = (long) ((IEnergySource) tEmitter).getOfferedEnergy();
|
||||
|
||||
if (transferElectricity(aSide, tEU, 1, Sets.newHashSet((TileEntity) aBaseMetaTileEntity)) > 0)
|
||||
if (transferElectricity(aSides[i], tEU, 1, Sets.newHashSet((TileEntity) aBaseMetaTileEntity)) > 0)
|
||||
((IEnergySource) tEmitter).drawEnergy(tEU);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -327,10 +330,12 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
|
||||
if (aBaseMetaTileEntity.isServerSide()) {
|
||||
if (GT_Mod.gregtechproxy.ic2EnergySourceCompat) pullFromIc2EnergySources(aBaseMetaTileEntity);
|
||||
if (GT_Mod.gregtechproxy.ic2EnergySourceCompat&&IC2RectorAtSide[0]>=0) pullFromIc2EnergySources(aBaseMetaTileEntity,IC2RectorAtSide);
|
||||
|
||||
mTransferredAmperage = 0;
|
||||
if(mOverheat>0)mOverheat--;
|
||||
|
@ -417,8 +422,10 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
|
|||
{
|
||||
final TileEntity ic2Energy;
|
||||
|
||||
if (tTileEntity instanceof IReactorChamber)
|
||||
if (tTileEntity instanceof IReactorChamber) {
|
||||
ic2Energy = (TileEntity) ((IReactorChamber) tTileEntity).getReactor();
|
||||
|
||||
}
|
||||
else
|
||||
ic2Energy = (tTileEntity == null || tTileEntity instanceof IEnergyTile || EnergyNet.instance == null) ? tTileEntity :
|
||||
EnergyNet.instance.getTileEntity(tTileEntity.getWorldObj(), tTileEntity.xCoord, tTileEntity.yCoord, tTileEntity.zCoord);
|
||||
|
@ -430,6 +437,12 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
|
|||
// IC2 Source Compat
|
||||
if (GT_Mod.gregtechproxy.ic2EnergySourceCompat && (ic2Energy instanceof IEnergySource)) {
|
||||
if (((IEnergySource) ic2Energy).emitsEnergyTo((TileEntity) baseMetaTile, tDir)) {
|
||||
for(byte i = 0;i<5;i++){
|
||||
if(IC2RectorAtSide[i]<0){
|
||||
IC2RectorAtSide[i] = aSide;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 2.5 KiB |
Loading…
Reference in a new issue