p2p fixes redton, light, items

This commit is contained in:
PrototypeTrousers
2021-11-02 21:40:49 -03:00
parent b423d99879
commit c5d33ed892
4 changed files with 39 additions and 11 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ aechannel=stable
aebuild=7 aebuild=7
aegroup=appeng aegroup=appeng
aebasename=appliedenergistics2 aebasename=appliedenergistics2
trousers=omni-fixes-v49d trousers=omni-fixes-v49e
######################################################### #########################################################
# Versions # # Versions #
@@ -76,11 +76,14 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IItemHa
this.cachedInv = null; this.cachedInv = null;
try try
{ {
for( PartP2PItems input : this.getInputs() ) if( this.isOutput() )
{ {
if( input != null && this.isOutput() ) for( PartP2PItems input : this.getInputs() )
{ {
input.onTunnelNetworkChange(); if( input != null )
{
input.onTunnelNetworkChange();
}
} }
} }
} }
@@ -41,6 +41,7 @@ import appeng.api.parts.IPartModel;
import appeng.core.settings.TickRates; import appeng.core.settings.TickRates;
import appeng.items.parts.PartModels; import appeng.items.parts.PartModels;
import appeng.me.GridAccessException; import appeng.me.GridAccessException;
import org.apache.logging.log4j.core.appender.rolling.action.IfAll;
public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTickable public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTickable
@@ -198,17 +199,24 @@ public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTi
{ {
try try
{ {
boolean hasValidInput = false;
int light = 0;
for( PartP2PLight src : this.getInputs() ) for( PartP2PLight src : this.getInputs() )
{ {
if( src != null && src.getProxy().isActive() ) if( src != null && src.getProxy().isActive() )
{ {
this.setLightLevel( src.lastValue ); hasValidInput = true;
} light = Math.max( light, src.lastValue );
else
{
this.getHost().markForUpdate();
} }
} }
if( hasValidInput )
{
this.setLightLevel( light );
}
else
{
this.getHost().markForUpdate();
}
} }
catch( GridAccessException e ) catch( GridAccessException e )
{ {
@@ -72,13 +72,15 @@ public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone>
{ {
try try
{ {
int power = 0;
for( PartP2PRedstone in : this.getInputs() ) for( PartP2PRedstone in : this.getInputs() )
{ {
if( in != null ) if( in != null )
{ {
this.putInput( in.power ); power = Math.max( power, in.power );
} }
} }
this.putInput( power );
} }
catch( GridAccessException e ) catch( GridAccessException e )
{ {
@@ -176,7 +178,22 @@ public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone>
this.power = b.getWeakPower( state, this.getTile().getWorld(), target, srcSide ); this.power = b.getWeakPower( state, this.getTile().getWorld(), target, srcSide );
this.power = Math.max( this.power, b.getWeakPower( state, this.getTile().getWorld(), target, srcSide ) ); this.power = Math.max( this.power, b.getWeakPower( state, this.getTile().getWorld(), target, srcSide ) );
this.sendToOutput( this.power ); int powerOut = this.power;
try
{
for( PartP2PRedstone in : this.getInputs() )
{
if( in != null )
{
powerOut = Math.max( in.power, powerOut );
}
}
}
catch( GridAccessException e )
{
e.printStackTrace();
}
this.sendToOutput( powerOut );
} }
else else
{ {