p2p fixes redton, light, items
This commit is contained in:
@@ -76,11 +76,14 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IItemHa
|
||||
this.cachedInv = null;
|
||||
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.items.parts.PartModels;
|
||||
import appeng.me.GridAccessException;
|
||||
import org.apache.logging.log4j.core.appender.rolling.action.IfAll;
|
||||
|
||||
|
||||
public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTickable
|
||||
@@ -198,17 +199,24 @@ public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTi
|
||||
{
|
||||
try
|
||||
{
|
||||
boolean hasValidInput = false;
|
||||
int light = 0;
|
||||
for( PartP2PLight src : this.getInputs() )
|
||||
{
|
||||
if( src != null && src.getProxy().isActive() )
|
||||
{
|
||||
this.setLightLevel( src.lastValue );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.getHost().markForUpdate();
|
||||
hasValidInput = true;
|
||||
light = Math.max( light, src.lastValue );
|
||||
}
|
||||
}
|
||||
if( hasValidInput )
|
||||
{
|
||||
this.setLightLevel( light );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.getHost().markForUpdate();
|
||||
}
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
{
|
||||
|
||||
@@ -72,13 +72,15 @@ public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone>
|
||||
{
|
||||
try
|
||||
{
|
||||
int power = 0;
|
||||
for( PartP2PRedstone in : this.getInputs() )
|
||||
{
|
||||
if( in != null )
|
||||
{
|
||||
this.putInput( in.power );
|
||||
power = Math.max( power, in.power );
|
||||
}
|
||||
}
|
||||
this.putInput( power );
|
||||
}
|
||||
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 = 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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user