mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-23 11:49:23 +01:00
parent
c6b6f1610a
commit
0953c0e906
2 changed files with 39 additions and 12 deletions
|
@ -154,15 +154,32 @@ public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay{
|
||||||
if(relayTile instanceof TileEntityLaserRelayEnergy){
|
if(relayTile instanceof TileEntityLaserRelayEnergy){
|
||||||
TileEntityLaserRelayEnergy theRelay = (TileEntityLaserRelayEnergy)relayTile;
|
TileEntityLaserRelayEnergy theRelay = (TileEntityLaserRelayEnergy)relayTile;
|
||||||
if(theRelay.mode != Mode.INPUT_ONLY){
|
if(theRelay.mode != Mode.INPUT_ONLY){
|
||||||
int amount = theRelay.receiversAround.size();
|
boolean workedOnce = false;
|
||||||
if(theRelay == this && theRelay.receiversAround.containsKey(from)){
|
|
||||||
//So that the tile energy was gotten from isn't factored into the amount
|
for(EnumFacing facing : theRelay.receiversAround.keySet()){
|
||||||
amount--;
|
if(theRelay != this || facing != from){
|
||||||
|
TileEntity tile = theRelay.receiversAround.get(facing);
|
||||||
|
|
||||||
|
EnumFacing opp = facing.getOpposite();
|
||||||
|
if(tile.hasCapability(CapabilityEnergy.ENERGY, opp)){
|
||||||
|
IEnergyStorage cap = tile.getCapability(CapabilityEnergy.ENERGY, opp);
|
||||||
|
if(cap != null && cap.receiveEnergy(maxTransfer, true) > 0){
|
||||||
|
totalReceiverAmount++;
|
||||||
|
workedOnce = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(ActuallyAdditions.teslaLoaded && tile.hasCapability(TeslaUtil.teslaConsumer, opp)){
|
||||||
|
ITeslaConsumer cap = tile.getCapability(TeslaUtil.teslaConsumer, opp);
|
||||||
|
if(cap != null && cap.givePower(maxTransfer, true) > 0){
|
||||||
|
totalReceiverAmount++;
|
||||||
|
workedOnce = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(amount > 0){
|
if(workedOnce){
|
||||||
relaysThatWork.add(theRelay);
|
relaysThatWork.add(theRelay);
|
||||||
totalReceiverAmount += amount;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,15 +151,25 @@ public class TileEntityLaserRelayFluids extends TileEntityLaserRelay implements
|
||||||
if(relayTile instanceof TileEntityLaserRelayFluids){
|
if(relayTile instanceof TileEntityLaserRelayFluids){
|
||||||
TileEntityLaserRelayFluids theRelay = (TileEntityLaserRelayFluids)relayTile;
|
TileEntityLaserRelayFluids theRelay = (TileEntityLaserRelayFluids)relayTile;
|
||||||
if(theRelay.mode != Mode.INPUT_ONLY){
|
if(theRelay.mode != Mode.INPUT_ONLY){
|
||||||
int amount = theRelay.receiversAround.size();
|
boolean workedOnce = false;
|
||||||
if(theRelay == this && theRelay.receiversAround.containsKey(from)){
|
|
||||||
//So that the tile energy was gotten from isn't factored into the amount
|
for(EnumFacing facing : theRelay.receiversAround.keySet()){
|
||||||
amount--;
|
if(theRelay != this || facing != from){
|
||||||
|
TileEntity tile = theRelay.receiversAround.get(facing);
|
||||||
|
|
||||||
|
EnumFacing opp = facing.getOpposite();
|
||||||
|
if(tile.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, opp)){
|
||||||
|
IFluidHandler cap = tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, opp);
|
||||||
|
if(cap != null && cap.fill(stack, false) > 0){
|
||||||
|
totalReceiverAmount++;
|
||||||
|
workedOnce = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(amount > 0){
|
if(workedOnce){
|
||||||
relaysThatWork.add(theRelay);
|
relaysThatWork.add(theRelay);
|
||||||
totalReceiverAmount += amount;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue