Merge pull request #2100 from yueh/fix-2099

Fixes #2099: No neighbor update of Pressure P2P before IAirHandler is validated.
This commit is contained in:
yueh 2016-01-13 14:57:59 +01:00
commit ac45095cb4

View file

@ -58,6 +58,7 @@ public final class PartP2PPressure extends PartP2PTunnel<PartP2PPressure> implem
@Nonnull @Nonnull
private final IAirHandler handler; private final IAirHandler handler;
private boolean isConnected = false; private boolean isConnected = false;
private boolean isValid = false;
public PartP2PPressure( final ItemStack is ) public PartP2PPressure( final ItemStack is )
{ {
@ -87,14 +88,20 @@ public final class PartP2PPressure extends PartP2PTunnel<PartP2PPressure> implem
public void onNeighborChanged() public void onNeighborChanged()
{ {
super.onNeighborChanged(); super.onNeighborChanged();
this.getInternalHandler().onNeighborChange();
if( this.isValid )
{
this.getInternalHandler().onNeighborChange();
}
} }
@Override @Override
public void addToWorld() public void addToWorld()
{ {
super.addToWorld(); super.addToWorld();
this.getInternalHandler().validateI( this.getTile() ); this.getInternalHandler().validateI( this.getTile() );
this.isValid = true;
} }
@Override @Override
@ -102,6 +109,7 @@ public final class PartP2PPressure extends PartP2PTunnel<PartP2PPressure> implem
{ {
super.removeFromWorld(); super.removeFromWorld();
this.isValid = false;
if( this.isOutput() && this.getInput() != null ) if( this.isOutput() && this.getInput() != null )
{ {
this.getInternalHandler().removeConnection( this.getInput().getInternalHandler() ); this.getInternalHandler().removeConnection( this.getInput().getInternalHandler() );