Changed IPart#onNeighborChanged() to add vanilla arguments (#2985)

Allows more precise checks to limit an update to the facing side.
This commit is contained in:
yueh
2017-07-29 15:45:18 +02:00
committed by GitHub
parent b72fce97db
commit bb1e191666
19 changed files with 83 additions and 43 deletions
@@ -33,6 +33,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
@@ -212,16 +213,11 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
}
@Override
public void onNeighborChanged()
public void onNeighborChanged( IBlockAccess w, BlockPos pos, BlockPos neighbor )
{
this.isAccepting = true;
try
if( pos.offset( this.getSide().getFacing() ).equals( neighbor ) )
{
this.getProxy().getTick().alertDevice( this.getProxy().getNode() );
}
catch( final GridAccessException e )
{
// :P
this.refresh();
}
}
@@ -419,7 +415,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
@MENetworkEventSubscribe
public void chanRender( final MENetworkChannelsChanged c )
{
this.onNeighborChanged();
this.refresh();
this.getHost().markForUpdate();
}
@@ -427,7 +423,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
@MENetworkEventSubscribe
public void powerRender( final MENetworkPowerStatusChange c )
{
this.onNeighborChanged();
this.refresh();
this.getHost().markForUpdate();
}
@@ -595,6 +591,20 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
}
}
private void refresh()
{
this.isAccepting = true;
try
{
this.getProxy().getTick().alertDevice( this.getProxy().getNode() );
}
catch( final GridAccessException e )
{
// :P
}
}
@Override
public IPartModel getStaticModels()
{